diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-04-08 22:07:58 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-04-08 22:08:57 +0200 |
commit | 12a67646986e89d94d1e41d410c7314488aa1cbe (patch) | |
tree | b06662806a977ef9dac00bb7970727ebc20d75c1 /python | |
parent | 2d33cf656f5856fb06e8390fc2250bb99ea0206b (diff) | |
download | vyos-1x-12a67646986e89d94d1e41d410c7314488aa1cbe.tar.gz vyos-1x-12a67646986e89d94d1e41d410c7314488aa1cbe.zip |
vyos-util: rename chown_file() > chown()
... to make it clear also directories can be chown(-ed)
Diffstat (limited to 'python')
-rw-r--r-- | python/vyos/util.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/python/vyos/util.py b/python/vyos/util.py index 16cfae92d..f1fb5ce27 100644 --- a/python/vyos/util.py +++ b/python/vyos/util.py @@ -93,16 +93,17 @@ def read_file(path): return data -def chown_file(path, user, group): - """ change file owner """ +def chown(path, user, group): + """ change file/directory owner """ from pwd import getpwnam from grp import getgrnam - if os.path.isfile(path): + if os.path.exists(path): uid = getpwnam(user).pw_uid gid = getgrnam(group).gr_gid os.chown(path, uid, gid) + def chmod_x(path): """ make file executable """ from stat import S_IRUSR, S_IWUSR, S_IXUSR, S_IRGRP, S_IXGRP, S_IROTH, S_IXOTH |