diff --git a/actions/matrixsynapse b/actions/matrixsynapse index 772cbe079..1db9cd8ed 100755 --- a/actions/matrixsynapse +++ b/actions/matrixsynapse @@ -31,7 +31,6 @@ from plinth import action_utils from plinth.modules import letsencrypt from plinth.modules.matrixsynapse import (CONFIG_FILE_PATH, get_configured_domain_name) -from plinth.utils import YAMLFile def parse_arguments(): diff --git a/actions/tahoe-lafs b/actions/tahoe-lafs index 792c3ad53..48512a95d 100755 --- a/actions/tahoe-lafs +++ b/actions/tahoe-lafs @@ -189,17 +189,19 @@ def subcommand_add_introducer(arguments): Param introducer must be a tuple of (pet_name, furl). """ - with YAMLFile(introducers_file, restart_storage_node) as conf: + with YAMLFile(introducers_file) as conf: pet_name, furl = arguments.introducer.split(",") conf['introducers'][pet_name] = {'furl': furl} + restart_storage_node() def subcommand_remove_introducer(arguments): """Rename the introducer entry in the introducers.yaml file specified by the param pet_name """ - with YAMLFile(introducers_file, restart_storage_node) as conf: + with YAMLFile(introducers_file) as conf: del conf['introducers'][arguments.pet_name] + restart_storage_node() def subcommand_get_introducers(_): diff --git a/plinth/utils.py b/plinth/utils.py index 052a08f86..3d3c9b977 100644 --- a/plinth/utils.py +++ b/plinth/utils.py @@ -89,16 +89,14 @@ def get_domain_names(): class YAMLFile(object): """A context management class for updating YAML files""" - def __init__(self, yaml_file, post_exit=None): + def __init__(self, yaml_file): """Return a context object for the YAML file. Parameters: yaml_file - the YAML file to update. - post_exit - a function that will be called after updating the YAML file. """ self.yaml_file = yaml_file - self.post_exit = post_exit self.conf = None def __enter__(self): @@ -114,9 +112,6 @@ class YAMLFile(object): with open(self.yaml_file, 'w') as intro_conf: ruamel.yaml.round_trip_dump(self.conf, intro_conf) - if self.post_exit: - self.post_exit() - def is_file_empty(self): return os.stat(self.yaml_file).st_size == 0