]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: consolidate list of supported daemons
authorMichael Fritch <mfritch@suse.com>
Tue, 28 Jan 2020 23:19:38 +0000 (16:19 -0700)
committerMichael Fritch <mfritch@suse.com>
Thu, 12 Mar 2020 14:03:18 +0000 (08:03 -0600)
Signed-off-by: Michael Fritch <mfritch@suse.com>
src/cephadm/cephadm

index a835bf9b2b03cf63ca8c9547057cdf4e0d2036f0..c0125c972770bec49a8f9f8a03d59e897f6cc4c4 100755 (executable)
@@ -157,6 +157,15 @@ class Monitoring(object):
         },
     }  # type: ignore
 
+
+def get_supported_daemons():
+    supported_daemons = list(Ceph.daemons)
+    supported_daemons.extend(Monitoring.components)
+    assert len(supported_daemons) == len(set(supported_daemons))
+    return supported_daemons
+
+##################################
+
 def attempt_bind(s, address, port):
     # type (str) -> None
     try:
@@ -2134,10 +2143,7 @@ def command_deploy():
     l = FileLock(args.fsid)
     l.acquire()
 
-    supported_daemons = list(Ceph.daemons)
-    supported_daemons.extend(Monitoring.components)
-
-    if daemon_type not in supported_daemons:
+    if daemon_type not in get_supported_daemons():
         raise Error('daemon type %s not recognized' % daemon_type)
 
     if daemon_type in Ceph.daemons:
@@ -2973,9 +2979,7 @@ class CustomValidation(argparse.Action):
             raise argparse.ArgumentError(self,
                                          "must be of the format <type>.<id>. For example, osd.1 or prometheus.myhost.com")
 
-        daemons = list(Ceph.daemons)
-        daemons.extend(Monitoring.components.keys())
-
+        daemons = get_supported_daemons()
         if daemon_type not in daemons:
             raise argparse.ArgumentError(self,
                                          "name must declare the type of daemon e.g. "