[lorax] Remove workdir if it was created by lorax (#807964)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 src/pylorax/__init__.py |   10 ++++++++--
 src/sbin/lorax          |    2 +-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py
index ef0a1c0..042f21d 100644
--- a/src/pylorax/__init__.py
+++ b/src/pylorax/__init__.py
@@ -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
diff --git a/src/sbin/lorax b/src/sbin/lorax
index 5b93b96..31b8df1 100755
--- a/src/sbin/lorax
+++ b/src/sbin/lorax
@@ -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=[],
-- 
1.7.5.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux