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)
|
||||
|
||||
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
|
||||
|
||||
@ -139,7 +140,7 @@ class Lorax(BaseLoraxClass):
|
||||
os.makedirs(self.workdir)
|
||||
|
||||
# set up log directory
|
||||
logdir = joinpaths(self.workdir, "log")
|
||||
logdir = '/var/log/lorax'
|
||||
if not os.path.isdir(logdir):
|
||||
os.makedirs(logdir)
|
||||
|
||||
@ -262,6 +263,11 @@ class Lorax(BaseLoraxClass):
|
||||
treeinfo.add_section(section, data)
|
||||
treeinfo.write(joinpaths(self.outputdir, ".treeinfo"))
|
||||
|
||||
# cleanup
|
||||
if remove_temp:
|
||||
remove(self.workdir)
|
||||
|
||||
|
||||
def get_buildarch(ybo):
|
||||
# get architecture of the available anaconda package
|
||||
buildarch = None
|
||||
|
@ -126,7 +126,7 @@ def main(args):
|
||||
lorax.run(yb, opts.product, opts.version, opts.release,
|
||||
opts.variant, opts.bugurl, opts.isfinal,
|
||||
workdir=tempdir, outputdir=outputdir, buildarch=opts.buildarch,
|
||||
volid=opts.volid)
|
||||
volid=opts.volid, remove_temp=True)
|
||||
|
||||
|
||||
def get_yum_base_object(installroot, repositories, mirrorlists=[],
|
||||
|
Loading…
Reference in New Issue
Block a user