From a43b5c7d1ca00fe67af08ae576889e657ac9b7b0 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 16 Aug 2024 21:27:57 +0300 Subject: utils: T6658: fix write_file check in case of empty directory path (#3993) (cherry picked from commit 58125b64c6678ea581998c9f83a19fae0cdbda12) Co-authored-by: John Estabrook --- python/vyos/utils/file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'python/vyos') diff --git a/python/vyos/utils/file.py b/python/vyos/utils/file.py index c566f0334..eaebb57a3 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) -- cgit v1.2.3