diff options
Diffstat (limited to 'python/vyos/config.py')
-rw-r--r-- | python/vyos/config.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/python/vyos/config.py b/python/vyos/config.py index 3a340b2da..5c2fc7285 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) @@ -224,7 +222,7 @@ class Config(object): except VyOSError: return False - def show_config(self, path='', default=None): + def show_config(self, path=[], default=None): """ Args: path (str): Configuration tree path, or empty @@ -233,6 +231,8 @@ class Config(object): Returns: str: working configuration """ + if isinstance(path, list): + path = " ".join(path) try: out = self._run(self._make_command('showConfig', path)) return out |