typo fix
This commit is contained in:
parent
949471915c
commit
1caecd5e35
@ -27,15 +27,15 @@ def update_config_file(config):
|
||||
config.write(configfile)
|
||||
|
||||
def set_new_hostname(hostname, domainname, oldhostname):
|
||||
if os.path.isfile('/etc/hosts'):
|
||||
f1=open('/etc/hosts','r').read()
|
||||
m1=f1.replace(oldhostname,hostname)
|
||||
m2=m1.replace(oldhostname+'.'+domainname, hostname+'.'+domainname)
|
||||
f2=open('/etc/hosts','w')
|
||||
f2.write(m2)
|
||||
os.system("hostname -b "+hostname)
|
||||
with open('/etc/hostname', 'w') as hostnamefile:
|
||||
hostnamefile.write(hostname)
|
||||
if not os.path.isfile('/etc/hosts'):
|
||||
f1=open('/etc/hosts','r').read()
|
||||
m=f1.replace(oldhostname,hostname)
|
||||
m=m.replace(oldhostname+'.'+domainname, hostname+'.'+domainname)
|
||||
f2=open('/etc/hosts','w')
|
||||
f2.write(m)
|
||||
return
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
|
Loading…
x
Reference in New Issue
Block a user