Blame SOURCES/BZ-1356797-silent-exception.patch

eb5f31
commit c8c4065931bec55e9b2eb0f16a97376e8650846b
eb5f31
Author: Radek Vykydal <rvykydal@redhat.com>
eb5f31
Date:   Wed Aug 10 11:10:58 2016 +0200
eb5f31
eb5f31
    Report __del__ RepoError exceptions into log instead of stderr (#1356797)
eb5f31
    
eb5f31
    Resolves: rhbz#1356797
eb5f31
    
eb5f31
    So it does not clutter text UI of clients like Anaconda.
eb5f31
eb5f31
diff --git a/yum/__init__.py b/yum/__init__.py
eb5f31
index 57e1dfe..9e38320 100644
eb5f31
--- a/yum/__init__.py
eb5f31
+++ b/yum/__init__.py
eb5f31
@@ -234,11 +234,14 @@ class YumBase(depsolve.Depsolve):
eb5f31
         self.updateinfo_filters = {}
eb5f31
 
eb5f31
     def __del__(self):
eb5f31
-        self.close()
eb5f31
-        self.closeRpmDB()
eb5f31
-        self.doUnlock()
eb5f31
-        # call cleanup callbacks
eb5f31
-        for cb in self._cleanup: cb()
eb5f31
+        try:
eb5f31
+            self.close()
eb5f31
+            self.closeRpmDB()
eb5f31
+            self.doUnlock()
eb5f31
+            # call cleanup callbacks
eb5f31
+            for cb in self._cleanup: cb()
eb5f31
+        except Errors.RepoError, e:
eb5f31
+            self.verbose_logger.debug("Exception %s %s in %s ignored" % (repr(e), str(e), self.__del__))
eb5f31
 
eb5f31
     def close(self):
eb5f31
         """Close the history and repo objects."""
eb5f31
diff --git a/yum/repos.py b/yum/repos.py
eb5f31
index a0ef28c..017527a 100644
eb5f31
--- a/yum/repos.py
eb5f31
+++ b/yum/repos.py
eb5f31
@@ -161,7 +161,10 @@ class RepoStorage:
eb5f31
         return str(self.repos.keys())
eb5f31
 
eb5f31
     def __del__(self):
eb5f31
-        self.close()
eb5f31
+        try:
eb5f31
+            self.close()
eb5f31
+        except Errors.RepoError, e:
eb5f31
+            self.logger.debug("Exception %s %s in %s ignored" % (repr(e), str(e), self.__del__))
eb5f31
 
eb5f31
     def close(self):
eb5f31
         for repo in self.repos.values():
eb5f31
@@ -423,7 +426,10 @@ class Repository:
eb5f31
         return hash(self.id)
eb5f31
         
eb5f31
     def __del__(self):
eb5f31
-        self.close()
eb5f31
+        try:
eb5f31
+            self.close()
eb5f31
+        except Errors.RepoError, e:
eb5f31
+            self.logger.debug("Exception %s %s in %s ignored" % (repr(e), str(e), self.__del__))
eb5f31
 
eb5f31
     def _ui_id(self):
eb5f31
         """ Show self.id, so we can use it and override it. """
eb5f31
diff --git a/yum/yumRepo.py b/yum/yumRepo.py
eb5f31
index 9c3d274..2db8faf 100644
eb5f31
--- a/yum/yumRepo.py
eb5f31
+++ b/yum/yumRepo.py
eb5f31
@@ -114,7 +114,10 @@ class YumPackageSack(packageSack.PackageSack):
eb5f31
         self.added = {}
eb5f31
 
eb5f31
     def __del__(self):
eb5f31
-        self.close()
eb5f31
+        try:
eb5f31
+            self.close()
eb5f31
+        except Errors.RepoError, e:
eb5f31
+            verbose_logger.debug("Exception %s %s in %s ignored" % (repr(e), str(e), self.__del__))
eb5f31
 
eb5f31
     def close(self):
eb5f31
         self.added = {}