[Thincrust-devel] [PATCH] Fixed bug in globbing files under a directory passed via -i parameter

Perry Myers pmyers at redhat.com
Fri Nov 14 18:29:51 UTC 2008


Bug in code that joined -i to the top of file name that alread had
value of -i in it.  This resulted in an invalid directory name
and the creator would stacktrace.

Signed-off-by: Perry Myers <pmyers at redhat.com>
---
 appcreate/appliance.py |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/appcreate/appliance.py b/appcreate/appliance.py
index e0fea1c..94edabd 100644
--- a/appcreate/appliance.py
+++ b/appcreate/appliance.py
@@ -298,13 +298,12 @@ class ApplianceImageCreator(ImageCreator):
             logging.debug("adding everything in %s to %s" % (include,self._outdir))
             files = glob.glob('%s/*' % include)
             for file in files:
-                add = os.path.join(include,file)
-                if os.path.isdir(add):
-                    logging.debug("adding dir %s to %s" % (add,os.path.join(self._outdir,os.path.basename(file))))
-                    shutil.copytree(add, os.path.join(self._outdir,os.path.basename(file)),symlinks=False)
+                if os.path.isdir(file):
+                    logging.debug("adding dir %s to %s" % (file,os.path.join(self._outdir,os.path.basename(file))))
+                    shutil.copytree(file, os.path.join(self._outdir,os.path.basename(file)),symlinks=False)
                 else:
-                    logging.debug("adding %s to %s" % (add,self._outdir))
-                    shutil.copy(add, self._outdir)
+                    logging.debug("adding %s to %s" % (file,self._outdir))
+                    shutil.copy(file, self._outdir)
         elif include:
             logging.debug("adding %s to %s" % (include,self._outdir))
             shutil.copy(include, self._outdir)
-- 
1.6.0.3




More information about the Thincrust-devel mailing list