From 08cb762347208b21a8cbf81f7b35707d7e6dd4ac Mon Sep 17 00:00:00 2001 From: Viacheslav Hletenko Date: Tue, 2 Aug 2022 14:33:57 +0000 Subject: containers: T4585: Add option restart to containers.py Add option restart to `containers.py` --- src/op_mode/container.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/op_mode') 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__]) -- cgit v1.2.3