upgrade: Switch to using crudini to update zulip.conf contents.

Using `config_file.write()` only writes out what python stored of the
file; as such, it strips all comments and whitespace.

Use `crudini --set`, which only modifies the line whose contents are
changed.
This commit is contained in:
Alex Vandiver
2020-10-21 20:58:47 -07:00
committed by Tim Abbott
parent d24c571bab
commit 16d9dd84b8

View File

@@ -32,7 +32,6 @@ from scripts.lib.zulip_tools import (
get_config_file,
get_tornado_ports,
parse_os_release,
set_config,
su_to_zulip,
)
@@ -124,9 +123,9 @@ if os.path.exists('/etc/init.d/postgresql'):
postgres_version = default_postgres_version[(vendor, os_version)]
else:
error_desupported_os(vendor, os_version)
set_config(config_file, 'postgresql', 'version', postgres_version)
with open('/etc/zulip/zulip.conf', 'w') as zulipconf:
config_file.write(zulipconf)
subprocess.check_call([
"crudini", "--set", "/etc/zulip/zulip.conf",
"postgresql", "version", postgres_version])
if glob.glob("/usr/share/postgresql/*/extension/tsearch_extras.control"):
# Remove legacy tsearch_extras package references