From 05ff916a23af59a9a6b882afe7139d8af3fd2c82 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Tue, 15 Aug 2023 14:15:41 -0400 Subject: [PATCH] cephadm: move basic exception types to exceptions.py Signed-off-by: John Mulligan Pair-programmed-with: Adam King Co-authored-by: Adam King --- src/cephadm/cephadm.py | 27 +++++++-------------------- src/cephadm/cephadmlib/exceptions.py | 21 +++++++++++++++++++++ 2 files changed, 28 insertions(+), 20 deletions(-) create mode 100644 src/cephadm/cephadmlib/exceptions.py diff --git a/src/cephadm/cephadm.py b/src/cephadm/cephadm.py index d53e9b3c4aabd..198ecc0e8ddbf 100755 --- a/src/cephadm/cephadm.py +++ b/src/cephadm/cephadm.py @@ -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 index 0000000000000..0d215fdd3325a --- /dev/null +++ b/src/cephadm/cephadmlib/exceptions.py @@ -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 -- 2.39.5