Ensure filepath exists
Before we can write facter facts of hiera hieras, we need for the directory to exist. Change-Id: Id855da44d9e2cb06824ed3507158aeaa466768f7
This commit is contained in:
parent
226adc7f23
commit
5faac02239
|
@ -88,7 +88,8 @@ def _get_facter_dir():
|
||||||
|
|
||||||
|
|
||||||
def _write_structured_data(basedir, basename, data):
|
def _write_structured_data(basedir, basename, data):
|
||||||
# Ensure filepath?
|
if not os.path.exists(basedir):
|
||||||
|
os.makedirs(basedir)
|
||||||
file_path = os.path.join(basedir, "{0}.json".format(basename))
|
file_path = os.path.join(basedir, "{0}.json".format(basename))
|
||||||
with os.fdopen(
|
with os.fdopen(
|
||||||
os.open(file_path, os.O_CREAT | os.O_WRONLY, 0o600),
|
os.open(file_path, os.O_CREAT | os.O_WRONLY, 0o600),
|
||||||
|
|
Loading…
Reference in New Issue