diff options
author | Daniil Baturin <daniil@vyos.io> | 2023-01-10 15:24:42 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-10 15:24:42 +0000 |
commit | c86ed3df1e309b6a98de3ce88b508ea79453f9b1 (patch) | |
tree | 4f24bc1da40b457309989e4a9ab55933de471070 /python | |
parent | de686b3bee8ffb410142c9eeb2a7bf788316e513 (diff) | |
parent | ba4aebaaa816d810727ded073d3b09c1723cded7 (diff) | |
download | vyos-1x-c86ed3df1e309b6a98de3ce88b508ea79453f9b1.tar.gz vyos-1x-c86ed3df1e309b6a98de3ce88b508ea79453f9b1.zip |
Merge pull request #1744 from jestabro/container-op-mode
container: T4880: expose 'add/delete container image' in HTTP-API
Diffstat (limited to 'python')
-rw-r--r-- | python/vyos/configsession.py | 14 | ||||
-rw-r--r-- | python/vyos/opmode.py | 2 |
2 files changed, 15 insertions, 1 deletions
diff --git a/python/vyos/configsession.py b/python/vyos/configsession.py index 3a60f6d92..9864aa5c5 100644 --- a/python/vyos/configsession.py +++ b/python/vyos/configsession.py @@ -34,6 +34,8 @@ REMOVE_IMAGE = ['/opt/vyatta/bin/vyatta-boot-image.pl', '--del'] GENERATE = ['/opt/vyatta/bin/vyatta-op-cmd-wrapper', 'generate'] SHOW = ['/opt/vyatta/bin/vyatta-op-cmd-wrapper', 'show'] RESET = ['/opt/vyatta/bin/vyatta-op-cmd-wrapper', 'reset'] +ADD = ['/opt/vyatta/bin/vyatta-op-cmd-wrapper', 'add'] +DELETE = ['/opt/vyatta/bin/vyatta-op-cmd-wrapper', 'delete'] # Default "commit via" string APP = "vyos-http-api" @@ -204,3 +206,15 @@ class ConfigSession(object): def reset(self, path): out = self.__run_command(RESET + path) return out + + def add_container_image(self, name): + out = self.__run_command(ADD + ['container', 'image'] + [name]) + return out + + def delete_container_image(self, name): + out = self.__run_command(DELETE + ['container', 'image'] + [name]) + return out + + def show_container_image(self): + out = self.__run_command(SHOW + ['container', 'image']) + return out diff --git a/python/vyos/opmode.py b/python/vyos/opmode.py index 5ff768859..17a9ab581 100644 --- a/python/vyos/opmode.py +++ b/python/vyos/opmode.py @@ -66,7 +66,7 @@ class InternalError(Error): def _is_op_mode_function_name(name): - if re.match(r"^(show|clear|reset|restart)", name): + if re.match(r"^(show|clear|reset|restart|add|delete)", name): return True else: return False |