summaryrefslogtreecommitdiff
path: root/src/op_mode/container.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-12-23 17:35:12 +0100
committerChristian Poessinger <christian@poessinger.com>2022-12-23 17:36:34 +0100
commit91c34b5a464c60d10a3e00bbd9155de2f13d149e (patch)
treee736d3b90362bd0f1dc817580ceac3556006c69e /src/op_mode/container.py
parent843ebb323c99ddea200c12d143640e4e3c1bcd89 (diff)
downloadvyos-1x-91c34b5a464c60d10a3e00bbd9155de2f13d149e.tar.gz
vyos-1x-91c34b5a464c60d10a3e00bbd9155de2f13d149e.zip
containers: T4585: remove redundant sudo calls in op-mode script
Diffstat (limited to 'src/op_mode/container.py')
-rwxr-xr-xsrc/op_mode/container.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/op_mode/container.py b/src/op_mode/container.py
index ce466ffc1..ecefc556e 100755
--- a/src/op_mode/container.py
+++ b/src/op_mode/container.py
@@ -23,7 +23,6 @@ from vyos.util import cmd
import vyos.opmode
-
def _get_json_data(command: str) -> list:
"""
Get container command format JSON
@@ -38,7 +37,7 @@ def _get_raw_data(command: str) -> list:
def show_container(raw: bool):
- command = 'sudo podman ps --all'
+ command = 'podman ps --all'
container_data = _get_raw_data(command)
if raw:
return container_data
@@ -47,8 +46,8 @@ def show_container(raw: bool):
def show_image(raw: bool):
- command = 'sudo podman image ls'
- container_data = _get_raw_data('sudo podman image ls')
+ command = 'podman image ls'
+ container_data = _get_raw_data('podman image ls')
if raw:
return container_data
else:
@@ -56,7 +55,7 @@ def show_image(raw: bool):
def show_network(raw: bool):
- command = 'sudo podman network ls'
+ command = 'podman network ls'
container_data = _get_raw_data(command)
if raw:
return container_data
@@ -67,7 +66,7 @@ def show_network(raw: bool):
def restart(name: str):
from vyos.util import rc_cmd
- rc, output = rc_cmd(f'sudo podman restart {name}')
+ rc, output = rc_cmd(f'systemctl restart vyos-container-{name}.service')
if rc != 0:
print(output)
return None