From 9e0c56cbfa435142f5cb71dffe5eea99470c3a61 Mon Sep 17 00:00:00 2001 From: Thomas Mangin Date: Sun, 5 Apr 2020 17:47:29 +0100 Subject: util: T2226: rewrite load config to use cmd --- src/helpers/vyos-load-config.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src/helpers') diff --git a/src/helpers/vyos-load-config.py b/src/helpers/vyos-load-config.py index 693529c23..a9fa15778 100755 --- a/src/helpers/vyos-load-config.py +++ b/src/helpers/vyos-load-config.py @@ -30,25 +30,19 @@ import vyos.remote from vyos.config import Config, VyOSError from vyos.migrator import Migrator, VirtualMigrator, MigratorError -system_config_file = 'config.boot' - class LoadConfig(Config): """A subclass for calling 'loadFile'. This does not belong in config.py, and only has a single caller. """ - def load_config(self, file_path): - cmd = [self._cli_shell_api, 'loadFile', file_path] - self._run(cmd) + def load_config(self, path): + return self._run(['/bin/cli-shell-api','loadFile',path]) -if len(sys.argv) > 1: - file_name = sys.argv[1] -else: - file_name = system_config_file +file_name = sys.argv[1] if len(sys.argv) > 1 else 'config.boot' configdir = vyos.defaults.directories['config'] - protocols = ['scp', 'sftp', 'http', 'https', 'ftp', 'tftp'] + if any(x in file_name for x in protocols): config_file = vyos.remote.get_remote_config(file_name) if not config_file: -- cgit v1.2.3