From 177e85f3fa49ce64970c78179b211aa42bf91b57 Mon Sep 17 00:00:00 2001 From: Michael Fritch Date: Tue, 28 Jan 2020 16:19:38 -0700 Subject: [PATCH] cephadm: consolidate list of supported daemons Signed-off-by: Michael Fritch --- src/cephadm/cephadm | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index a835bf9b2b0..c0125c97277 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -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 .. 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. " -- 2.39.5