[lorax/master 1/4] livemedia-creator: Create parent dirs for logfile path

Brian C. Lane bcl at redhat.com
Thu Jan 15 01:18:11 UTC 2015


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.
---
 src/sbin/livemedia-creator | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/sbin/livemedia-creator b/src/sbin/livemedia-creator
index d8ee275..a9b29d7 100755
--- a/src/sbin/livemedia-creator
+++ b/src/sbin/livemedia-creator
@@ -1092,6 +1092,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)
-- 
1.9.3



More information about the anaconda-patches mailing list