summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorThomas Mangin <thomas.mangin@exa.net.uk>2020-04-05 22:10:09 +0100
committerThomas Mangin <thomas.mangin@exa.net.uk>2020-04-06 20:22:35 +0100
commitecf1e3d499d8a825bb675e11c07bbc7b0981c431 (patch)
tree724e5018323d0f172a27454ccb85fecf8f9a56ae /python
parent8a93f664238101a38dec02c73a1615bfcea09f2a (diff)
downloadvyos-1x-ecf1e3d499d8a825bb675e11c07bbc7b0981c431.tar.gz
vyos-1x-ecf1e3d499d8a825bb675e11c07bbc7b0981c431.zip
util: T2226: rewrite util to use cmd
Diffstat (limited to 'python')
-rw-r--r--python/vyos/util.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/python/vyos/util.py b/python/vyos/util.py
index f63ed057e..e0030d1bd 100644
--- a/python/vyos/util.py
+++ b/python/vyos/util.py
@@ -261,12 +261,11 @@ def commit_in_progress():
# Since this will be used in scripts that modify the config outside of the CLI
# framework, those knowingly have root permissions.
# For everything else, we add a safeguard.
- from subprocess import check_output
from psutil import process_iter, NoSuchProcess
from vyos.defaults import commit_lock
- id = check_output(['/usr/bin/id', '-u']).decode().strip()
- if id != '0':
+ idu = cmd('/usr/bin/id -u')
+ if idu != '0':
raise OSError("This functions needs root permissions to return correct results")
for proc in process_iter():