From 0ac23adcda1c8a905fb79d5992651dc263b38eb5 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 27 Mar 2018 02:32:42 +0000 Subject: [PATCH] Fix minigraph_facts: mkdir recursively Signed-off-by: Qi Luo --- ansible/library/minigraph_facts.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ansible/library/minigraph_facts.py b/ansible/library/minigraph_facts.py index 125dee65606..4b9b6110575 100644 --- a/ansible/library/minigraph_facts.py +++ b/ansible/library/minigraph_facts.py @@ -607,11 +607,11 @@ def main(): try: # make the directory for caching the mini-graph. - os.mkdir(ANSIBLE_USER_MINIGRAPH_PATH) + os.makedirs(ANSIBLE_USER_MINIGRAPH_PATH) except OSError: if not os.path.isdir(ANSIBLE_USER_MINIGRAPH_PATH): # file conflict, report the error and exit. - module.fail_json(msg="'{}' exists but is not a directory".format(ANSIBLE_USER_MINIGRAPH_PATH)) + module.fail_json(msg="Cannot create dir: {}".format(ANSIBLE_USER_MINIGRAPH_PATH)) m_args = module.params local_file_path = ANSIBLE_LOCAL_MINIGRAPH_PATH.format(m_args['host'])