From: Jeff Layton Date: Tue, 12 Feb 2019 11:51:40 +0000 (-0500) Subject: mgr/orchestrator: move NoOrchestrator definition to base orchestrator.py X-Git-Tag: v14.1.0~132^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0e9a0211cc87000d236e4936f3a05deb6dd1b68a;p=ceph.git mgr/orchestrator: move NoOrchestrator definition to base orchestrator.py Signed-off-by: Jeff Layton --- diff --git a/src/pybind/mgr/orchestrator.py b/src/pybind/mgr/orchestrator.py index 9b3daabb3b4d..d67f7996edc2 100644 --- a/src/pybind/mgr/orchestrator.py +++ b/src/pybind/mgr/orchestrator.py @@ -18,6 +18,10 @@ except ImportError: import time import fnmatch +class NoOrchestrator(Exception): + def __init__(self): + super(NoOrchestrator, self).__init__("No orchestrator configured (try " + "`ceph orchestrator set backend`)") class _Completion(G): @property diff --git a/src/pybind/mgr/orchestrator_cli/module.py b/src/pybind/mgr/orchestrator_cli/module.py index 211b6c957ac3..7fad8bbedd11 100644 --- a/src/pybind/mgr/orchestrator_cli/module.py +++ b/src/pybind/mgr/orchestrator_cli/module.py @@ -13,19 +13,13 @@ from mgr_module import MgrModule, HandleCommandResult, CLIWriteCommand, CLIReadC import orchestrator -class NoOrchestrator(Exception): - def __init__(self): - super(NoOrchestrator, self).__init__("No orchestrator configured (try " - "`ceph orchestrator set backend`)") - - def handle_exceptions(func): @wraps(func) def inner(*args, **kwargs): try: return func(*args, **kwargs) - except (NoOrchestrator, ImportError) as e: + except (orchestrator.NoOrchestrator, ImportError) as e: return HandleCommandResult(-errno.ENOENT, stderr=str(e)) return inner