mirror of
https://github.com/thegeeklab/ansible-doctor.git
synced 2024-11-14 01:00:40 +00:00
error handling while creating output dir
This commit is contained in:
parent
8664a48477
commit
c8a860825c
@ -52,10 +52,12 @@ class Generator:
|
|||||||
self.logger.debug("Ignoring template file: " + relative_file)
|
self.logger.debug("Ignoring template file: " + relative_file)
|
||||||
|
|
||||||
def _create_dir(self, directory):
|
def _create_dir(self, directory):
|
||||||
if not self.config.config["dry_run"]:
|
if not self.config.config["dry_run"] and not os.path.isdir(directory):
|
||||||
|
try:
|
||||||
os.makedirs(directory, exist_ok=True)
|
os.makedirs(directory, exist_ok=True)
|
||||||
else:
|
|
||||||
self.logger.info("Creating dir: " + directory)
|
self.logger.info("Creating dir: " + directory)
|
||||||
|
except FileExistsError as e:
|
||||||
|
self.log.sysexit_with_message(str(e))
|
||||||
|
|
||||||
def _write_doc(self):
|
def _write_doc(self):
|
||||||
files_to_overwite = []
|
files_to_overwite = []
|
||||||
|
Loading…
Reference in New Issue
Block a user