Commit 8eb8c540 authored by Stavros Sachtouris's avatar Stavros Sachtouris

Reload config after config modifications in shell

parent cccff590
......@@ -77,6 +77,7 @@ class config_set(_command_init):
section = section or 'global'
self.config.set(section, key, value)
self.config.write()
self.config.reload()
@command(config_cmds)
......@@ -88,3 +89,4 @@ class config_delete(_command_init):
section = section or 'global'
self.config.remove_option(section, key)
self.config.write()
self.config.reload()
......@@ -106,6 +106,9 @@ class Config(RawConfigParser):
for option, val in options.items():
self.set(section, option, val)
def reload(self):
self = self.__init__(self.path)
def apis(self):
return [api for api in self.sections() if api != 'global']
......@@ -148,4 +151,5 @@ class Config(RawConfigParser):
with open(self.path, 'w') as f:
os.chmod(self.path, 0600)
f.write(HEADER.lstrip())
f.flush()
RawConfigParser.write(self, f)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment