From bd471c2db5c341d6702bc06575a88a6c5579d2de Mon Sep 17 00:00:00 2001 From: Thomas Mangin Date: Sun, 5 Apr 2020 17:43:25 +0100 Subject: util: T2226: rewrite config migration to use cmd --- src/helpers/run-config-migration.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/helpers/run-config-migration.py') diff --git a/src/helpers/run-config-migration.py b/src/helpers/run-config-migration.py index 3c06e38f8..cc7166c22 100755 --- a/src/helpers/run-config-migration.py +++ b/src/helpers/run-config-migration.py @@ -19,7 +19,8 @@ import os import sys import argparse import datetime -import subprocess + +from vyos.util import cmd from vyos.migrator import Migrator, VirtualMigrator def main(): @@ -61,12 +62,7 @@ def main(): '{0:%Y-%m-%d-%H%M%S}'.format(datetime.datetime.now()), 'pre-migration']) - try: - subprocess.check_call(['cp', '-p', config_file_name, - backup_file_name]) - except subprocess.CalledProcessError as err: - print("Called process error: {}.".format(err)) - sys.exit(1) + cmd(f'cp -p {config_file_name} {backup_file_name}') if not virtual: virtual_migration = VirtualMigrator(config_file_name) -- cgit v1.2.3