summaryrefslogtreecommitdiff
path: root/src/conf_mode/interfaces-wirelessmodem.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-04-02 21:38:45 +0200
committerChristian Poessinger <christian@poessinger.com>2020-04-02 21:38:45 +0200
commit75fbbf8e6035247d5a677d74275e7c0a27b2964d (patch)
tree20635daa88e6e64f17ecdec37889ef90c91606f8 /src/conf_mode/interfaces-wirelessmodem.py
parente794aacfa50370e686420d5412456eaea8ae9df5 (diff)
downloadvyos-1x-75fbbf8e6035247d5a677d74275e7c0a27b2964d.tar.gz
vyos-1x-75fbbf8e6035247d5a677d74275e7c0a27b2964d.zip
wwan: migrate to new new helpers in vyos.util
Commit d2cf287 ("vyos.util: add chown_file and chmod_x_file helpers") added common helper functions to chown or chmod +x a file. Make use of those helpers.
Diffstat (limited to 'src/conf_mode/interfaces-wirelessmodem.py')
-rwxr-xr-xsrc/conf_mode/interfaces-wirelessmodem.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/conf_mode/interfaces-wirelessmodem.py b/src/conf_mode/interfaces-wirelessmodem.py
index 76ed90daa..42ab2608d 100755
--- a/src/conf_mode/interfaces-wirelessmodem.py
+++ b/src/conf_mode/interfaces-wirelessmodem.py
@@ -20,10 +20,9 @@ from sys import exit
from copy import deepcopy
from jinja2 import Template
from subprocess import Popen, PIPE
-from pwd import getpwnam
-from grp import getgrnam
from vyos.config import Config
+from vyos.util import chown_file, chmod_x_file
from vyos import ConfigError
# Please be careful if you edit the template.
@@ -225,10 +224,7 @@ def apply(wwan):
subprocess_cmd(cmd)
# make logfile owned by root / vyattacfg
- if os.path.isfile(wwan['logfile']):
- uid = getpwnam('root').pw_uid
- gid = getgrnam('vyattacfg').gr_gid
- os.chown(wwan['logfile'], uid, gid)
+ chown_file(wwan['logfile'], 'root', 'vyattacfg')
return None