[PATCH 3/3] DNFPayload: error handling and logging cleanups.

Ales Kozumplik akozumpl at redhat.com
Mon Oct 14 10:29:39 UTC 2013


On 10/14/2013 09:37 AM, Vratislav Podzimek wrote:
>> >+        if token == 'quit':
>> >+            progressQ.send_quit(1)
>> >+            sys.exit(1)
> The installation thread shouldn't exit the process. It should just send
> the quit message and wait for the main thread to quit the process. I
> know we have both things in the yumpayload.py module, but those
> sys.exit() calls are bugs (I'll send a patch soon). Just replace it
> with:
>
> while True:
>      time.sleep(10000)
>
> Otherwise these all look good to me.

It looked odd but I couldn't figure out what the right thing to do was. 
I'll take your word for the endless loop then, will meld it into the 
original commit:

diff --git a/pyanaconda/packaging/dnfpayload.py 
b/pyanaconda/packaging/dnfpayload.py
index fe84e7f..d0bda57 100644
--- a/pyanaconda/packaging/dnfpayload.py
+++ b/pyanaconda/packaging/dnfpayload.py
@@ -32,6 +32,7 @@ import pyanaconda.constants as constants
  import pyanaconda.errors as errors
  import pyanaconda.packaging as packaging
  import sys
+import time

  log = logging.getLogger("packaging")

@@ -52,6 +53,11 @@ REPO_DIRS = ['/etc/yum.repos.d',
               '/tmp/updates/anaconda.repos.d',
               '/tmp/product/anaconda.repos.d']

+def _failure_limbo():
+    progressQ.send_quit(1)
+    while True:
+        time.sleep(10000)
+
  class PayloadRPMDisplay(dnf.output.LoggingTransactionDisplay):
      def __init__(self, queue):
          super(PayloadRPMDisplay, self).__init__()
@@ -333,8 +339,7 @@ class DNFPayload(packaging.PackagePayload):
              self.checkSoftwareSelection()
          except packaging.DependencyError:
              if errors.errorHandler.cb(e) == errors.ERROR_RAISE:
-                progressQ.send_quit(1)
-                sys.exit(1)
+                _failure_limbo()

          pkgs_to_download = self._base.transaction.install_set
          log.info('Downloading pacakges.')
@@ -357,8 +362,7 @@ class DNFPayload(packaging.PackagePayload):
              (token, msg) = queue.get()

          if token == 'quit':
-            progressQ.send_quit(1)
-            sys.exit(1)
+            _failure_limbo()

          post_msg = _("Performing post-installation setup tasks")
          progressQ.send_message(post_msg)



More information about the anaconda-patches mailing list