livemedia-creator: Create parent dirs for logfile path

The directory where the --logfile is located is also used for other log
files and for the anaconda logs when using --no-virt. Create the parent
directories if they don't exist.
This commit is contained in:
Brian C. Lane 2015-01-14 09:36:38 -08:00
parent e9c1b5f200
commit 8641caca9e

View File

@ -1093,6 +1093,9 @@ def setup_logging(opts):
:param opts: options passed to livemedia-creator
:type opts: argparse options
"""
if not os.path.isdir(os.path.abspath(os.path.dirname(opts.logfile))):
os.makedirs(os.path.abspath(os.path.dirname(opts.logfile)))
# Setup logging to console and to logfile
log.setLevel(logging.DEBUG)
pylorax_log.setLevel(logging.DEBUG)