summaryrefslogtreecommitdiff
path: root/src/helpers/vyos-boot-config-loader.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-04-07 08:27:36 +0200
committerGitHub <noreply@github.com>2020-04-07 08:27:36 +0200
commit09ad28b28c9ebd9308cfe9048686b3b0ef9cfd9c (patch)
tree6e7b0971ecd8859cff864b3ebb37f86f8ba288f5 /src/helpers/vyos-boot-config-loader.py
parente0f13b79a669e7fc8cadac8757b2f5fbbf51dc99 (diff)
parent7256810914e6664bf92041dcd7c3daf649ce0001 (diff)
downloadvyos-1x-09ad28b28c9ebd9308cfe9048686b3b0ef9cfd9c.tar.gz
vyos-1x-09ad28b28c9ebd9308cfe9048686b3b0ef9cfd9c.zip
Merge pull request #307 from thomas-mangin/T2226
util: T2226: convert all call to use vyos.util.{popen, cmd, run}
Diffstat (limited to 'src/helpers/vyos-boot-config-loader.py')
-rwxr-xr-xsrc/helpers/vyos-boot-config-loader.py9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/helpers/vyos-boot-config-loader.py b/src/helpers/vyos-boot-config-loader.py
index 58483fe50..c5bf22f10 100755
--- a/src/helpers/vyos-boot-config-loader.py
+++ b/src/helpers/vyos-boot-config-loader.py
@@ -20,13 +20,13 @@ import os
import sys
import pwd
import grp
-import subprocess
import traceback
from datetime import datetime
from vyos.defaults import directories
from vyos.configsession import ConfigSession, ConfigSessionError
from vyos.configtree import ConfigTree
+from vyos.util import cmd
STATUS_FILE = '/tmp/vyos-config-status'
TRACE_FILE = '/tmp/boot-config-trace'
@@ -102,12 +102,7 @@ def failsafe(config_file_name):
'authentication',
'encrypted-password'])
- cmd = ("useradd -s /bin/bash -G 'users,sudo' -m -N -p '{0}' "
- "vyos".format(passwd))
- try:
- subprocess.check_call(cmd, shell=True)
- except subprocess.CalledProcessError as e:
- sys.exit("{0}".format(e))
+ cmd(f"useradd -s /bin/bash -G 'users,sudo' -m -N -p '{passwd}' vyos")
if __name__ == '__main__':
if len(sys.argv) < 2: