Get the log directory from the configfile
In the lorax script create it if missing and override it with the path of --logfile
This commit is contained in:
parent
fe457ed71b
commit
9ff5897eee
@ -87,6 +87,7 @@ class Lorax(BaseLoraxClass):
|
||||
self.conf.add_section("lorax")
|
||||
self.conf.set("lorax", "debug", "1")
|
||||
self.conf.set("lorax", "sharedir", "/usr/share/lorax")
|
||||
self.conf.set("lorax", "logdir", "/var/log/lorax")
|
||||
|
||||
self.conf.add_section("output")
|
||||
self.conf.set("output", "colors", "1")
|
||||
@ -179,7 +180,7 @@ class Lorax(BaseLoraxClass):
|
||||
os.makedirs(self.workdir)
|
||||
|
||||
# set up log directory
|
||||
logdir = '/var/log/lorax'
|
||||
logdir = self.conf.get("lorax", "logdir")
|
||||
if not os.path.isdir(logdir):
|
||||
os.makedirs(logdir)
|
||||
|
||||
|
@ -171,6 +171,8 @@ def main(args):
|
||||
parser.error("output directory %s should not exist." % outputdir)
|
||||
|
||||
opts.logfile = os.path.abspath(opts.logfile)
|
||||
if not os.path.exists(os.path.dirname(opts.logfile)):
|
||||
os.makedirs(os.path.dirname(opts.logfile))
|
||||
if opts.cachedir:
|
||||
opts.cachedir = os.path.abspath(opts.cachedir)
|
||||
if opts.workdir:
|
||||
@ -214,6 +216,7 @@ def main(args):
|
||||
# run lorax
|
||||
lorax = pylorax.Lorax()
|
||||
lorax.configure(conf_file=opts.config)
|
||||
lorax.conf.set("lorax", "logdir", os.path.dirname(opts.logfile))
|
||||
lorax.run(dnfbase, opts.product, opts.version, opts.release,
|
||||
opts.variant, opts.bugurl, opts.isfinal,
|
||||
workdir=tempdir, outputdir=outputdir, buildarch=opts.buildarch,
|
||||
|
Loading…
Reference in New Issue
Block a user