diff --git a/plinth/setup.py b/plinth/setup.py index a7fcef3e6..a90e3f3f4 100644 --- a/plinth/setup.py +++ b/plinth/setup.py @@ -469,12 +469,6 @@ class ForceUpgrader(): """ for _ in range(self.UPGRADE_ATTEMPTS): - logger.info('Waiting for %s seconds before attempting upgrade', - self.UPGRADE_ATTEMPT_WAIT_SECONDS) - if self._wait_event.wait(self.UPGRADE_ATTEMPT_WAIT_SECONDS): - logger.info('Stopping upgrade attempts due to shutdown') - return - try: logger.info('Attempting to perform upgrade') self._attempt_upgrade() @@ -489,6 +483,12 @@ class ForceUpgrader(): # Assume all other errors are temporary logger.exception('Unknown exception: %s', exception) + logger.info('Waiting for %s seconds before attempting upgrade', + self.UPGRADE_ATTEMPT_WAIT_SECONDS) + if self._wait_event.wait(self.UPGRADE_ATTEMPT_WAIT_SECONDS): + logger.info('Stopping upgrade attempts due to shutdown') + return + logger.info('Giving up on upgrade after too many retries') def shutdown(self): @@ -748,14 +748,6 @@ class DpkgHandler: This method is guaranteed to not to run more than once simultaneously. """ for _ in range(self.HANDLE_ATTEMPTS): - logger.info( - 'Waiting for %s seconds before attempting post-dpkg ' - 'operations', self.HANDLE_ATTEMPT_WAIT_SECONDS) - if self._wait_event.wait(self.HANDLE_ATTEMPT_WAIT_SECONDS): - logger.info( - 'Stopping post-dpkg operation attempts due to shutdown') - return - try: logger.info('Attempting to perform post-dpkg operations') self._attempt_post_invoke() @@ -771,6 +763,14 @@ class DpkgHandler: # Assume all other errors are temporary logger.exception('Unknown exception: %s', exception) + logger.info( + 'Waiting for %s seconds before attempting post-dpkg ' + 'operations', self.HANDLE_ATTEMPT_WAIT_SECONDS) + if self._wait_event.wait(self.HANDLE_ATTEMPT_WAIT_SECONDS): + logger.info( + 'Stopping post-dpkg operation attempts due to shutdown') + return + logger.info('Giving up on post-dpkg operations after too many retries') def _attempt_post_invoke(self) -> None: