summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2024-08-15 13:29:21 -0500
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2024-08-16 05:59:28 +0000
commit1c0105099b9e86ada9967bdb9557501fdf434afa (patch)
tree9307b402e9aeae28e833333394fc864335ad0bbc /python
parent45d8ca97291128e1549ee7bcba7eed6ac6bdfdb3 (diff)
downloadvyos-1x-1c0105099b9e86ada9967bdb9557501fdf434afa.tar.gz
vyos-1x-1c0105099b9e86ada9967bdb9557501fdf434afa.zip
utils: T6658: fix write_file check in case of empty directory pathmergify/bp/sagitta/pr-3989
(cherry picked from commit 58125b64c6678ea581998c9f83a19fae0cdbda12)
Diffstat (limited to 'python')
-rw-r--r--python/vyos/utils/file.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/python/vyos/utils/file.py b/python/vyos/utils/file.py
index 0818f1b81..e16d5b40d 100644
--- a/python/vyos/utils/file.py
+++ b/python/vyos/utils/file.py
@@ -51,7 +51,7 @@ def write_file(fname, data, defaultonfailure=None, user=None, group=None, mode=N
If directory of file is not present, it is auto-created.
"""
dirname = os.path.dirname(fname)
- if not os.path.isdir(dirname):
+ if dirname and not os.path.isdir(dirname):
os.makedirs(dirname, mode=0o755, exist_ok=False)
chown(dirname, user, group)