diff options
author | Christian Poessinger <christian@poessinger.com> | 2019-10-24 15:26:55 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2019-10-24 15:26:55 +0200 |
commit | 1d8e7c841d7eee501e9a822db727fc1eec449b5e (patch) | |
tree | 6d31b0319a71e92b2b0ef18abe6c0bd64fb55457 /python/vyos/configsession.py | |
parent | 034c68aa62b5a9a493e77e8ac18f4e38ee621b25 (diff) | |
parent | 3400b1dd79702553ebbd40516bf454f3fe47885b (diff) | |
download | vyos-1x-1d8e7c841d7eee501e9a822db727fc1eec449b5e.tar.gz vyos-1x-1d8e7c841d7eee501e9a822db727fc1eec449b5e.zip |
Merge branch 'current' of github.com:vyos/vyos-1x into equuleus
* 'current' of github.com:vyos/vyos-1x:
T1762: adjust the set_level() calls to use the new list representation.
[vyos.config] T1764: support both string and list arguments in config functions.
T1759: bug fixes, missing interface IP
[vyos.config] T1758: use vyos.configtree for reading values, instead of calling cli-shell-api.
[HTTP API] Add endpoints for config file and image management.
ddclient: T1030: add cloudflare zone config entry
[service https] T1443: organize internal data by server block
[vyos.config] T1758: check that config setup has completed before calling showConfig, else, default to config.boot
[HTTP API] Use a decorator for functions that require authentication.
ddclient: T1030: adjust to latest syntax
ddclient: T1030: auto create runtime directories
ddclient: T1030: use new default configuration file path
T1759: Migrating interfaces
T1755: fixes issue with 'show vpn ipsec sa' command where lack of keysize (encr-keysize) will result in KeyError - such as for CHACHA20_POLY1305
T1755: fixes issue with 'show vpn ipsec sa' command where lack of hash (integ-alg) will result in KeyError - such as with GCM based options
Diffstat (limited to 'python/vyos/configsession.py')
-rw-r--r-- | python/vyos/configsession.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/python/vyos/configsession.py b/python/vyos/configsession.py index 09fae78a1..ed6288939 100644 --- a/python/vyos/configsession.py +++ b/python/vyos/configsession.py @@ -25,6 +25,9 @@ COMMIT = '/opt/vyatta/sbin/my_commit' DISCARD = '/opt/vyatta/sbin/my_discard' SHOW_CONFIG = ['/bin/cli-shell-api', 'showConfig'] LOAD_CONFIG = ['/bin/cli-shell-api', 'loadFile'] +SAVE_CONFIG = ['/opt/vyatta/sbin/vyatta-save-config.pl'] +INSTALL_IMAGE = ['/opt/vyatta/sbin/install-image'] +REMOVE_IMAGE = ['/opt/vyatta/bin/vyatta-boot-image.pl', '--del'] # Default "commit via" string APP = "vyos-http-api" @@ -36,6 +39,8 @@ APP = "vyos-http-api" def inject_vyos_env(env): env['VYATTA_CFG_GROUP_NAME'] = 'vyattacfg' env['VYATTA_USER_LEVEL_DIR'] = '/opt/vyatta/etc/shell/level/admin' + env['VYATTA_PROCESS_CLIENT'] = 'gui2_rest' + env['VYOS_HEADLESS_CLIENT'] = 'vyos_http_api' env['vyatta_bindir']= '/opt/vyatta/bin' env['vyatta_cfg_templates'] = '/opt/vyatta/share/vyatta-cfg/templates' env['vyatta_configdir'] = '/opt/vyatta/config' @@ -160,3 +165,16 @@ class ConfigSession(object): def load_config(self, file_path): out = self.__run_command(LOAD_CONFIG + [file_path]) return out + + def save_config(self, file_path): + out = self.__run_command(SAVE_CONFIG + [file_path]) + return out + + def install_image(self, url): + out = self.__run_command(INSTALL_IMAGE + [url]) + return out + + def remove_image(self, name): + out = self.__run_command(REMOVE_IMAGE + [name]) + return out + |