From a3f11567d930b7da0db068c3b313f6f4abbf12a1 Mon Sep 17 00:00:00 2001 From: Dagfinn Ilmari Mannsåker Date: Tue, 16 Jun 2020 13:51:47 +0100 Subject: Replace all remaining six usage with native Python 3 equivalents (#7704) --- synctl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'synctl') diff --git a/synctl b/synctl index 960fd357ee..ca398b84bd 100755 --- a/synctl +++ b/synctl @@ -26,8 +26,6 @@ import subprocess import sys import time -from six import iteritems - import yaml from synapse.config import find_config_files @@ -251,7 +249,7 @@ def main(): os.environ["SYNAPSE_CACHE_FACTOR"] = str(cache_factor) cache_factors = config.get("synctl_cache_factors", {}) - for cache_name, factor in iteritems(cache_factors): + for cache_name, factor in cache_factors.items(): os.environ["SYNAPSE_CACHE_FACTOR_" + cache_name.upper()] = str(factor) worker_configfiles = [] @@ -362,7 +360,7 @@ def main(): if worker.cache_factor: os.environ["SYNAPSE_CACHE_FACTOR"] = str(worker.cache_factor) - for cache_name, factor in iteritems(worker.cache_factors): + for cache_name, factor in worker.cache_factors.items(): os.environ["SYNAPSE_CACHE_FACTOR_" + cache_name.upper()] = str(factor) if not start_worker(worker.app, configfile, worker.configfile): -- cgit 1.4.1 From 8097659f6e5740ed2dcaedca2a10bdda29dd6ace Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Fri, 3 Jul 2020 17:19:03 +0500 Subject: Allow YAML config file to contain None (#7779) Useful when config file is fully commented Signed-off-by: Alex Kotov --- changelog.d/7779.bugfix | 1 + synctl | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelog.d/7779.bugfix (limited to 'synctl') diff --git a/changelog.d/7779.bugfix b/changelog.d/7779.bugfix new file mode 100644 index 0000000000..61de45d570 --- /dev/null +++ b/changelog.d/7779.bugfix @@ -0,0 +1 @@ +Fix synctl to handle empty config files correctly. Contributed by @kotovalexarian. diff --git a/synctl b/synctl index ca398b84bd..9395ebd048 100755 --- a/synctl +++ b/synctl @@ -239,7 +239,8 @@ def main(): for config_file in config_files: with open(config_file) as file_stream: yaml_config = yaml.safe_load(file_stream) - config.update(yaml_config) + if yaml_config is not None: + config.update(yaml_config) pidfile = config["pid_file"] cache_factor = config.get("synctl_cache_factor") -- cgit 1.4.1