vault: check dir value before passing (#43184)

This fix checks if dirname is not equal to '' before proceeding
to create actual directory with name.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2018-07-24 16:27:17 +05:30 committed by GitHub
parent bc9a40b32d
commit 4f1746ee1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -927,7 +927,7 @@ class VaultEditor:
""" create a new encrypted file """ """ create a new encrypted file """
dirname = os.path.dirname(filename) dirname = os.path.dirname(filename)
if not os.path.exists(dirname): if dirname and not os.path.exists(dirname):
display.warning("%s does not exist, creating..." % dirname) display.warning("%s does not exist, creating..." % dirname)
makedirs_safe(dirname) makedirs_safe(dirname)