diff options
-rwxr-xr-x | src/helpers/vyos-merge-config.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/helpers/vyos-merge-config.py b/src/helpers/vyos-merge-config.py index 6546c03e3..10a5ea4bc 100755 --- a/src/helpers/vyos-merge-config.py +++ b/src/helpers/vyos-merge-config.py @@ -17,13 +17,13 @@ import sys import os +import subprocess import tempfile import vyos.defaults import vyos.remote from vyos.config import Config from vyos.configtree import ConfigTree from vyos.migrator import Migrator, VirtualMigrator -from vyos.util import cmd if (len(sys.argv) < 2): @@ -100,10 +100,12 @@ if path: add_cmds = [ cmd for cmd in add_cmds if path in cmd ] for cmd in add_cmds: + cmd = "/opt/vyatta/sbin/my_" + cmd + try: - cmd(f'/opt/vyatta/sbin/my_{cmd}', message='Called process error') - except OSError as err: - print(err) + subprocess.check_call(cmd, shell=True) + except subprocess.CalledProcessError as err: + print("Called process error: {}.".format(err)) if effective_config.session_changed(): print("Merge complete. Use 'commit' to make changes effective.") |