diff mbox series

[AUH,v2,2/2] upgrade-helper: remove unused UpgradeNotNeededError

Message ID 20260603174448.3479497-1-daniel.turull@ericsson.com
State New
Headers show
Series None | expand

Commit Message

Daniel Turull June 3, 2026, 5:44 p.m. UTC
From: Daniel Turull <daniel.turull@ericsson.com>

UpgradeNotNeededError is never raised anywhere in the codebase.
Remove the class definition and all references to it.

Signed-off-by: Daniel Turull <daniel.turull@ericsson.com>
---
 modules/errors.py     | 7 -------
 modules/statistics.py | 4 +---
 upgrade-helper.py     | 6 ++----
 3 files changed, 3 insertions(+), 14 deletions(-)

Comments

Alexander Kanavin June 4, 2026, 11:41 a.m. UTC | #1
Thanks, applied and pushed.

Alex

On Wed, 3 Jun 2026 at 19:44, <daniel.turull@ericsson.com> wrote:
>
> From: Daniel Turull <daniel.turull@ericsson.com>
>
> UpgradeNotNeededError is never raised anywhere in the codebase.
> Remove the class definition and all references to it.
>
> Signed-off-by: Daniel Turull <daniel.turull@ericsson.com>
> ---
>  modules/errors.py     | 7 -------
>  modules/statistics.py | 4 +---
>  upgrade-helper.py     | 6 ++----
>  3 files changed, 3 insertions(+), 14 deletions(-)
>
> diff --git a/modules/errors.py b/modules/errors.py
> index 7adb103..9e8e6c9 100644
> --- a/modules/errors.py
> +++ b/modules/errors.py
> @@ -89,13 +89,6 @@ class UnsupportedProtocolError(Error):
>      def __str__(self):
>          return "Failed(Unsupported protocol)"
>
> -class UpgradeNotNeededError(Error):
> -    def __init__(self):
> -        super(UpgradeNotNeededError, self).__init__("Recipe already up to date")
> -
> -    def __str__(self):
> -        return "Failed(up to date)"
> -
>  class EmptyEnvError(Error):
>      def __init__(self, stdout):
>          super(EmptyEnvError, self).__init__("Empty environment returned", stdout)
> diff --git a/modules/statistics.py b/modules/statistics.py
> index 864cce8..227f0be 100644
> --- a/modules/statistics.py
> +++ b/modules/statistics.py
> @@ -34,9 +34,7 @@ class Statistics(object):
>          self.total_attempted = 0
>
>      def _update(self, pn, new_ver, maintainer, error):
> -        if type(error).__name__ == "UpgradeNotNeededError":
> -            return
> -        elif error is None:
> +        if error is None:
>              status = "Succeeded"
>          else:
>              status = str(error)
> diff --git a/upgrade-helper.py b/upgrade-helper.py
> index 46311f0..913bd87 100755
> --- a/upgrade-helper.py
> +++ b/upgrade-helper.py
> @@ -49,7 +49,7 @@ import shutil
>  sys.path.insert(1, os.path.join(os.path.abspath(
>      os.path.dirname(__file__)), 'modules'))
>
> -from errors import Error, EmptyEnvError, UpgradeNotNeededError, UnsupportedProtocolError
> +from errors import Error, EmptyEnvError, UnsupportedProtocolError
>
>  from utils.git import Git
>  from utils.devtool import Devtool
> @@ -527,9 +527,7 @@ class Updater(object):
>
>                  I(" %s: Upgrade SUCCESSFUL! Please test!" % pkggroup_name)
>              except Exception as e:
> -                if isinstance(e, UpgradeNotNeededError):
> -                    I(" %s: %s" % (pkggroup_name, e.message))
> -                elif isinstance(e, UnsupportedProtocolError):
> +                if isinstance(e, UnsupportedProtocolError):
>                      I(" %s: %s" % (pkggroup_name, e.message))
>                  else:
>                      if not isinstance(e, Error):
> --
> 2.51.0
>
diff mbox series

Patch

diff --git a/modules/errors.py b/modules/errors.py
index 7adb103..9e8e6c9 100644
--- a/modules/errors.py
+++ b/modules/errors.py
@@ -89,13 +89,6 @@  class UnsupportedProtocolError(Error):
     def __str__(self):
         return "Failed(Unsupported protocol)"
 
-class UpgradeNotNeededError(Error):
-    def __init__(self):
-        super(UpgradeNotNeededError, self).__init__("Recipe already up to date")
-
-    def __str__(self):
-        return "Failed(up to date)"
-
 class EmptyEnvError(Error):
     def __init__(self, stdout):
         super(EmptyEnvError, self).__init__("Empty environment returned", stdout)
diff --git a/modules/statistics.py b/modules/statistics.py
index 864cce8..227f0be 100644
--- a/modules/statistics.py
+++ b/modules/statistics.py
@@ -34,9 +34,7 @@  class Statistics(object):
         self.total_attempted = 0
 
     def _update(self, pn, new_ver, maintainer, error):
-        if type(error).__name__ == "UpgradeNotNeededError":
-            return
-        elif error is None:
+        if error is None:
             status = "Succeeded"
         else:
             status = str(error)
diff --git a/upgrade-helper.py b/upgrade-helper.py
index 46311f0..913bd87 100755
--- a/upgrade-helper.py
+++ b/upgrade-helper.py
@@ -49,7 +49,7 @@  import shutil
 sys.path.insert(1, os.path.join(os.path.abspath(
     os.path.dirname(__file__)), 'modules'))
 
-from errors import Error, EmptyEnvError, UpgradeNotNeededError, UnsupportedProtocolError
+from errors import Error, EmptyEnvError, UnsupportedProtocolError
 
 from utils.git import Git
 from utils.devtool import Devtool
@@ -527,9 +527,7 @@  class Updater(object):
 
                 I(" %s: Upgrade SUCCESSFUL! Please test!" % pkggroup_name)
             except Exception as e:
-                if isinstance(e, UpgradeNotNeededError):
-                    I(" %s: %s" % (pkggroup_name, e.message))
-                elif isinstance(e, UnsupportedProtocolError):
+                if isinstance(e, UnsupportedProtocolError):
                     I(" %s: %s" % (pkggroup_name, e.message))
                 else:
                     if not isinstance(e, Error):