tolerate some OS errors in the image confirations stage
authorJF Ding <jian-feng.ding@intel.com>
Wed, 18 Apr 2012 14:17:50 +0000 (22:17 +0800)
committerJF Ding <jian-feng.ding@intel.com>
Wed, 18 Apr 2012 14:21:59 +0000 (22:21 +0800)
VERSION
mic/kickstart/__init__.py
plugins/backend/zypppkgmgr.py

diff --git a/VERSION b/VERSION
index b63ba69..4437171 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.9
+0.10git
index d306fb3..3cab18f 100644 (file)
@@ -206,11 +206,10 @@ class TimezoneConfig(KickstartConfig):
         try:
             shutil.copyfile(tz_source, tz_dest)
         except (IOError, OSError), (errno, msg):
-            raise errors.KsError("Error copying timezone info from "
+            msger.warning("Error copying timezone info from "
                                         "'%s' to '%s': %s" \
                                         % (tz_source, tz_dest, msg))
 
-
 class AuthConfig(KickstartConfig):
     """A class to apply a kickstart authconfig configuration to a system."""
     def apply(self, ksauthconfig):
@@ -293,12 +292,16 @@ class UserConfig(KickstartConfig):
             args += [ "--groups", string.join(userconfig.groups, ",") ]
         if userconfig.name:
             args.append(userconfig.name)
-            dev_null = os.open("/dev/null", os.O_WRONLY)
-            subprocess.call(args,
-                             stdout = dev_null,
-                             stderr = dev_null,
-                             preexec_fn = self.chroot)
-            os.close(dev_null)
+            try:
+                dev_null = os.open("/dev/null", os.O_WRONLY)
+                subprocess.call(args,
+                                 stdout = dev_null,
+                                 stderr = dev_null,
+                                 preexec_fn = self.chroot)
+                os.close(dev_null)
+            except:
+                msger.warning('Cannot add user using "useradd"')
+
             if userconfig.password not in (None, ""):
                 if userconfig.isCrypted:
                     self.set_encrypted_passwd(userconfig.name,
index 8df1f6d..2d94cb5 100755 (executable)
@@ -152,7 +152,7 @@ class Zypp(BackendPlugin):
 
         def cmpEVR(ed1, ed2):
             (e1, v1, r1) = map(str, [ed1.epoch(), ed1.version(), ed1.release()])
-            (e2, v2, v2) = map(str, [ed2.epoch(), ed2.version(), ed2.release()])
+            (e2, v2, r2) = map(str, [ed2.epoch(), ed2.version(), ed2.release()])
             return rpm.labelCompare((e1, v1, r1), (e2, v2, r2))
 
         found = False