summaryrefslogtreecommitdiff
path: root/src/helpers
diff options
context:
space:
mode:
authorThomas Mangin <thomas.mangin@exa.net.uk>2020-04-05 17:47:29 +0100
committerThomas Mangin <thomas.mangin@exa.net.uk>2020-04-06 20:22:35 +0100
commit9e0c56cbfa435142f5cb71dffe5eea99470c3a61 (patch)
tree9de498e70676bcafc433d750e9375028ebf1d496 /src/helpers
parent787016f1bb590b0e001462b80eb00482c2148746 (diff)
downloadvyos-1x-9e0c56cbfa435142f5cb71dffe5eea99470c3a61.tar.gz
vyos-1x-9e0c56cbfa435142f5cb71dffe5eea99470c3a61.zip
util: T2226: rewrite load config to use cmd
Diffstat (limited to 'src/helpers')
-rwxr-xr-xsrc/helpers/vyos-load-config.py14
1 files changed, 4 insertions, 10 deletions
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: