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

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