suppress all rpm warning msg in non-debug mode
authorJF Ding <Jian-feng.Ding@intel.com>
Fri, 2 Sep 2011 05:58:49 +0000 (14:58 +0900)
committerJF Ding <Jian-feng.Ding@intel.com>
Fri, 2 Sep 2011 05:58:49 +0000 (14:58 +0900)
mic/pluginbase.py
tools/mic

index 33c9433..5d07848 100644 (file)
@@ -57,6 +57,11 @@ class ImagerPlugin(_Plugin):
 class BackendPlugin(_Plugin):
     mic_plugin_type="backend"
 
+    # suppress the verbose rpm warnings
+    if msger.get_loglevel() != 'debug':
+        import rpm
+        rpm.setVerbosity(rpm.RPMLOG_ERR)
+
     def addRepository(self):
         pass
 
index 79914c1..7a082b4 100755 (executable)
--- a/tools/mic
+++ b/tools/mic
@@ -47,6 +47,12 @@ class Mic(cmdln.Cmdln):
         if self.options.verbose:
             msger.set_loglevel('verbose')
         if self.options.debug:
+            try:
+                import rpm
+                rpm.setVerbosity(rpm.RPMLOG_NOTICE)
+            except ImportError:
+                pass
+
             msger.set_loglevel('debug')
 
     @cmdln.alias("cr")