Remove workdir if it was created by lorax (#807964)
This commit is contained in:
parent
cf1c3a8d66
commit
613822a228
@ -129,7 +129,8 @@ class Lorax(BaseLoraxClass):
|
|||||||
logger.addHandler(fh)
|
logger.addHandler(fh)
|
||||||
|
|
||||||
def run(self, ybo, product, version, release, variant="", bugurl="",
|
def run(self, ybo, product, version, release, variant="", bugurl="",
|
||||||
isfinal=False, workdir=None, outputdir=None, buildarch=None, volid=None):
|
isfinal=False, workdir=None, outputdir=None, buildarch=None, volid=None,
|
||||||
|
remove_temp=False):
|
||||||
|
|
||||||
assert self._configured
|
assert self._configured
|
||||||
|
|
||||||
@ -139,7 +140,7 @@ class Lorax(BaseLoraxClass):
|
|||||||
os.makedirs(self.workdir)
|
os.makedirs(self.workdir)
|
||||||
|
|
||||||
# set up log directory
|
# set up log directory
|
||||||
logdir = joinpaths(self.workdir, "log")
|
logdir = '/var/log/lorax'
|
||||||
if not os.path.isdir(logdir):
|
if not os.path.isdir(logdir):
|
||||||
os.makedirs(logdir)
|
os.makedirs(logdir)
|
||||||
|
|
||||||
@ -262,6 +263,11 @@ class Lorax(BaseLoraxClass):
|
|||||||
treeinfo.add_section(section, data)
|
treeinfo.add_section(section, data)
|
||||||
treeinfo.write(joinpaths(self.outputdir, ".treeinfo"))
|
treeinfo.write(joinpaths(self.outputdir, ".treeinfo"))
|
||||||
|
|
||||||
|
# cleanup
|
||||||
|
if remove_temp:
|
||||||
|
remove(self.workdir)
|
||||||
|
|
||||||
|
|
||||||
def get_buildarch(ybo):
|
def get_buildarch(ybo):
|
||||||
# get architecture of the available anaconda package
|
# get architecture of the available anaconda package
|
||||||
buildarch = None
|
buildarch = None
|
||||||
|
@ -126,7 +126,7 @@ def main(args):
|
|||||||
lorax.run(yb, opts.product, opts.version, opts.release,
|
lorax.run(yb, opts.product, opts.version, opts.release,
|
||||||
opts.variant, opts.bugurl, opts.isfinal,
|
opts.variant, opts.bugurl, opts.isfinal,
|
||||||
workdir=tempdir, outputdir=outputdir, buildarch=opts.buildarch,
|
workdir=tempdir, outputdir=outputdir, buildarch=opts.buildarch,
|
||||||
volid=opts.volid)
|
volid=opts.volid, remove_temp=True)
|
||||||
|
|
||||||
|
|
||||||
def get_yum_base_object(installroot, repositories, mirrorlists=[],
|
def get_yum_base_object(installroot, repositories, mirrorlists=[],
|
||||||
|
Loading…
Reference in New Issue
Block a user