summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJernej Jakob <jernej.jakob@gmail.com>2020-06-11 09:02:35 +0200
committerJernej Jakob <jernej.jakob@gmail.com>2020-06-11 22:10:47 +0200
commit71e088fbb42dbbb899dfe73989c306609a9b1135 (patch)
tree68b0c6fc656788ec4a65e55ec3e5f7347accee09
parent77081a6585fb64c1dba32c97eaaa54cf6a8741d9 (diff)
downloadvyos-1x-71e088fbb42dbbb899dfe73989c306609a9b1135.tar.gz
vyos-1x-71e088fbb42dbbb899dfe73989c306609a9b1135.zip
host_name: T2486: move Config() call into main
Init Config once in main() and pass it to both get_config() and verify().
-rwxr-xr-xsrc/conf_mode/host_name.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/conf_mode/host_name.py b/src/conf_mode/host_name.py
index a71f9f88f..4652050ab 100755
--- a/src/conf_mode/host_name.py
+++ b/src/conf_mode/host_name.py
@@ -45,8 +45,7 @@ default_config_data = {
'static_host_mapping': {}
}
-def get_config():
- conf = Config()
+def get_config(conf):
hosts = copy.deepcopy(default_config_data)
if conf.exists("system host-name"):
@@ -176,8 +175,9 @@ def apply(config):
if __name__ == '__main__':
try:
- c = get_config()
- verify(c)
+ conf = Config()
+ c = get_config(conf)
+ verify(conf, c)
generate(c)
apply(c)
except ConfigError as e: