Fix some issues with replacing hostname in xmpp config.

This commit is contained in:
James Valleroy authored and Sunil Mohan Adapa committed 2015-01-03 14:43:50 +05:30
1 parent 079d774476
commit 5bee775bc8
1 file changed
+3 -2
+3 -2
View File
@@ -82,7 +82,7 @@ def subcommand_change_hostname(arguments):
with open(JWCHAT_CONFIG, 'w') as conffile:
for line in lines:
if re.match(r'\s*var\s+SITENAME', line):
conffile.write('var SITENAME = "' + new_hostname + '";')
conffile.write('var SITENAME = "' + new_hostname + '";\n')
else:
conffile.write(line)
else:
@@ -97,7 +97,8 @@ def subcommand_change_hostname(arguments):
for line in lines:
if in_hosts_section:
if re.match(r'\s*-\s+"', line):
conffile.write(line.replace(old_hostname, new_hostname))
conffile.write(line.replace('"' + old_hostname + '"',
'"' + new_hostname + '"'))
else:
in_hosts_section = False
conffile.write(line)