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

[lorax] Add the pedantic option



By default copy file errors are ignored,
when pedantic is set to True, they result in an exception.
---
 src/bin/lorax         |    4 ++++
 src/pylorax/base.py   |    3 ++-
 src/pylorax/config.py |    4 +++-
 src/pylorax/images.py |    6 ++++--
 4 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/bin/lorax b/src/bin/lorax
index eaf2d51..4962e71 100644
--- a/src/bin/lorax
+++ b/src/bin/lorax
@@ -74,6 +74,8 @@ def main(args):
 
     # lorax settings
     settings = OptionGroup(parser, "lorax settings")
+    settings.add_option("--pedantic", help="don't ignore copy errors",
+            action="store_true", default=False)
     settings.add_option("-c", "--cleanup", help="clean up on exit",
             action="store_true", default=False)
 
@@ -123,6 +125,8 @@ def main(args):
     config.encoding = opts.encoding
     config.debug = opts.debug
 
+    config.pedantic = opts.pedantic
+
     # run lorax
     params = {"installtree": installtree,
               "outputdir": opts.outputdir,
diff --git a/src/pylorax/base.py b/src/pylorax/base.py
index 54f472f..10c5582 100644
--- a/src/pylorax/base.py
+++ b/src/pylorax/base.py
@@ -130,7 +130,8 @@ class BaseImageClass(BaseLoraxClass):
         if dstdir:
             makedirs_(os.path.join(self.dsttree, dstdir))
 
-        dcopy_(fname, dstdir, self.srctree, self.dsttree)
+        dcopy_(fname, dstdir, self.srctree, self.dsttree,
+               ignore_errors=not self.conf.pedantic)
 
     def rename(self, fname, target):
         fname = os.path.join(self.dsttree, fname)
diff --git a/src/pylorax/config.py b/src/pylorax/config.py
index 4c155ea..136088a 100644
--- a/src/pylorax/config.py
+++ b/src/pylorax/config.py
@@ -30,7 +30,9 @@ class LoraxConfig(object):
         # output settings
         self.colors = True
         self.encoding = "utf-8"
-        self.debug = False
+        self.debug = True
+
+        self.pedantic = False
 
         self.confdir = "/etc/lorax"
         self.datadir = "/usr/share/lorax"
diff --git a/src/pylorax/images.py b/src/pylorax/images.py
index a8fdf3a..3c2a72b 100644
--- a/src/pylorax/images.py
+++ b/src/pylorax/images.py
@@ -806,12 +806,14 @@ class Install(BaseImageClass):
     def move_bins(self):
         # move bin to usr/bin
         scopy_(src_root=self.srctree, src_path="bin/*",
-               dst_root=self.srctree, dst_path="usr/bin")
+               dst_root=self.srctree, dst_path="usr/bin",
+               ignore_errors=not self.conf.pedantic)
         remove_(os.path.join(self.srctree, "bin"))
 
         # move sbin to /usr/sbin
         scopy_(src_root=self.srctree, src_path="sbin/*",
-               dst_root=self.srctree, dst_path="usr/sbin")
+               dst_root=self.srctree, dst_path="usr/sbin",
+               ignore_errors=not self.conf.pedantic)
         remove_(os.path.join(self.srctree, "sbin"))
 
         # fix broken links
-- 
1.6.6.1


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