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

Vratislav Podzimek vpodzime at redhat.com
Thu Jan 15 07:24:45 UTC 2015


On Wed, 2015-01-14 at 17:18 -0800, Brian C. Lane wrote:
> 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)
These all look good to me.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list