summaryrefslogtreecommitdiff
path: root/python/vyos
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2019-10-27 16:29:11 +0100
committerDaniil Baturin <daniil@baturin.org>2019-10-27 16:29:11 +0100
commitabecba2332d6b6756cf83ba2d87fcbf3640f0c18 (patch)
treeefa55448f7325411dd9dc41021a30919f0af8ec4 /python/vyos
parent2673f4790e19531fba719810a3a38e1917e57214 (diff)
downloadvyos-1x-abecba2332d6b6756cf83ba2d87fcbf3640f0c18.tar.gz
vyos-1x-abecba2332d6b6756cf83ba2d87fcbf3640f0c18.zip
Replace the try and wait for segfault approach with explicit inSession check.
Diffstat (limited to 'python/vyos')
-rw-r--r--python/vyos/config.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/python/vyos/config.py b/python/vyos/config.py
index 3a340b2da..ee1adb289 100644
--- a/python/vyos/config.py
+++ b/python/vyos/config.py
@@ -104,12 +104,10 @@ class Config(object):
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.
- # If that happens, we assume that a script is running from op mode and use the running config
- # for the "session config" variable as well.
- try:
+ # In op mode, we'll just use the same running config for both active and session configs.
+ if self.in_session():
session_config_text = self._run([self._cli_shell_api, '--show-working-only', '--show-show-defaults', 'showConfig'])
- except VyOSError:
+ else:
session_config_text = running_config_text
self._session_config = vyos.configtree.ConfigTree(session_config_text)