catch KeyboardInt and quit decently
authorJF Ding <Jian-feng.Ding@intel.com>
Fri, 2 Sep 2011 06:38:36 +0000 (15:38 +0900)
committerJF Ding <Jian-feng.Ding@intel.com>
Fri, 2 Sep 2011 06:38:36 +0000 (15:38 +0900)
plugins/backend/yumpkgmgr.py
tools/mic

index f36c0b4..1028c55 100644 (file)
@@ -349,6 +349,7 @@ class Yum(BackendPlugin, yum.YumBase):
                 msger.warning("Package %s is damaged: %s" % (os.path.basename(local), local))
             else:
                 cached_count +=1
+
         msger.info("%d packages to be installed, %d packages gotten from cache, %d packages to be downloaded" % (total_count, cached_count, total_count - cached_count))
         try:
             self.downloadPkgs(dlpkgs)
@@ -361,6 +362,7 @@ class Yum(BackendPlugin, yum.YumBase):
                 """ This isn't fatal, Ubuntu has this issue but it is ok. """
                 msger.debug(deps)
                 msger.warning("Dependency check failed!")
+
             rc = self.ts.order()
             if rc != 0:
                 raise CreatorError("ordering packages for installation failed!")
@@ -369,9 +371,11 @@ class Yum(BackendPlugin, yum.YumBase):
             cb = getRPMCallback()
             cb.tsInfo = self.tsInfo
             cb.filelog = False
+
             ret = self.runTransaction(cb)
             self._cleanupRpmdbLocks(self.conf.installroot)
             return ret
+
         except yum.Errors.RepoError, e:
             raise CreatorError("Unable to download from repo : %s" % (e,))
         except yum.Errors.YumBaseError, e:
index 7a082b4..6c71cdb 100755 (executable)
--- a/tools/mic
+++ b/tools/mic
@@ -173,6 +173,10 @@ if __name__ == "__main__":
     try:
         mic = Mic()
         sys.exit(mic.main())
+
+    except KeyboardInterrupt:
+        msger.error('\n^C catched, program aborted.')
+
     except errors.Usage, usage:
         msger.error(str(usage))