]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: move basic exception types to exceptions.py
authorJohn Mulligan <jmulligan@redhat.com>
Tue, 15 Aug 2023 18:15:41 +0000 (14:15 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Wed, 30 Aug 2023 17:57:42 +0000 (13:57 -0400)
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Pair-programmed-with: Adam King <adking@redhat.com>
Co-authored-by: Adam King <adking@redhat.com>
src/cephadm/cephadm.py
src/cephadm/cephadmlib/exceptions.py [new file with mode: 0644]

index d53e9b3c4aabd35d03a3ff66b8a5bc21a59ffd7f..198ecc0e8ddbf3eee26e4ae42804d5ec50ad9e5c 100755 (executable)
@@ -91,6 +91,13 @@ from cephadmlib.constants import (
     UNIT_DIR,
 )
 from cephadmlib.context import CephadmContext
+from cephadmlib.exceptions import (
+    ClusterAlreadyExists,
+    Error,
+    PortOccupiedError,
+    TimeoutExpired,
+    UnauthorizedRegistryError,
+)
 
 FuncT = TypeVar('FuncT', bound=Callable)
 
@@ -314,22 +321,6 @@ class termcolor:
     red = '\033[31m'
     end = '\033[0m'
 
-
-class Error(Exception):
-    pass
-
-
-class ClusterAlreadyExists(Exception):
-    pass
-
-
-class TimeoutExpired(Error):
-    pass
-
-
-class UnauthorizedRegistryError(Error):
-    pass
-
 ##################################
 
 
@@ -1517,10 +1508,6 @@ def get_supported_daemons():
 ##################################
 
 
-class PortOccupiedError(Error):
-    pass
-
-
 def attempt_bind(ctx, s, address, port):
     # type: (CephadmContext, socket.socket, str, int) -> None
     try:
diff --git a/src/cephadm/cephadmlib/exceptions.py b/src/cephadm/cephadmlib/exceptions.py
new file mode 100644 (file)
index 0000000..0d215fd
--- /dev/null
@@ -0,0 +1,21 @@
+# exceptions.py - cephadm specific exception types
+
+
+class Error(Exception):
+    pass
+
+
+class ClusterAlreadyExists(Exception):
+    pass
+
+
+class TimeoutExpired(Error):
+    pass
+
+
+class UnauthorizedRegistryError(Error):
+    pass
+
+
+class PortOccupiedError(Error):
+    pass