diff options
author | John Estabrook <jestabro@sentrium.io> | 2019-10-23 10:31:16 -0500 |
---|---|---|
committer | John Estabrook <jestabro@sentrium.io> | 2019-10-23 10:31:16 -0500 |
commit | 4b3c01ceac65082a5e202d88c995c04d8c80e3ce (patch) | |
tree | e65d67f0fd3da17b508be1ba4a993f99a3c24aee /python/vyos/config.py | |
parent | 62ea78e3030802e81dd739fc4c45e6a10faddb36 (diff) | |
download | vyos-1x-4b3c01ceac65082a5e202d88c995c04d8c80e3ce.tar.gz vyos-1x-4b3c01ceac65082a5e202d88c995c04d8c80e3ce.zip |
[vyos.config] T1758: check that config setup has completed before
calling showConfig, else, default to config.boot
Diffstat (limited to 'python/vyos/config.py')
-rw-r--r-- | python/vyos/config.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/python/vyos/config.py b/python/vyos/config.py index d70093531..2232d900c 100644 --- a/python/vyos/config.py +++ b/python/vyos/config.py @@ -63,6 +63,7 @@ In operational mode, all functions return values from the running config. """ +import os import re import subprocess @@ -96,7 +97,11 @@ class Config(object): # Running config can be obtained either from op or conf mode, it always succeeds # (if config system is initialized at all). - running_config_text = self._run([self._cli_shell_api, '--show-active-only', '--show-show-defaults', 'showConfig']) + if os.path.isfile('/tmp/vyos-config-status'): + running_config_text = self._run([self._cli_shell_api, '--show-active-only', '--show-show-defaults', 'showConfig']) + else: + with open('/opt/vyatta/etc/config/config.boot') as f: + running_config_text = f.read() # Session config ("active") only exists in conf mode. # Trying to obtain it from op mode will cause a fatal cli-shell-api error. |