summaryrefslogtreecommitdiff
path: root/src/op_mode
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2022-08-02 14:33:57 +0000
committerViacheslav Hletenko <v.gletenko@vyos.io>2022-08-02 14:33:57 +0000
commit08cb762347208b21a8cbf81f7b35707d7e6dd4ac (patch)
tree77f2632c5b4b2d0ec5aeff8a814e4c6136875ab2 /src/op_mode
parentb72a7dc0fd33f1f0bca9016ed4d70effc55bfd75 (diff)
downloadvyos-1x-08cb762347208b21a8cbf81f7b35707d7e6dd4ac.tar.gz
vyos-1x-08cb762347208b21a8cbf81f7b35707d7e6dd4ac.zip
containers: T4585: Add option restart to containers.py
Add option restart to `containers.py`
Diffstat (limited to 'src/op_mode')
-rwxr-xr-xsrc/op_mode/container.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/op_mode/container.py b/src/op_mode/container.py
index 02d4a13b7..78d42f800 100755
--- a/src/op_mode/container.py
+++ b/src/op_mode/container.py
@@ -64,6 +64,17 @@ def show_network(raw: bool):
return cmd(command)
+def restart(name: str):
+ from vyos.util import rc_cmd
+
+ rc, output = rc_cmd(f'sudo podman restart {name}')
+ if rc != 0:
+ print(output)
+ return None
+ print(f'Container name "{name}" restarted!')
+ return output
+
+
if __name__ == '__main__':
try:
res = vyos.opmode.run(sys.modules[__name__])