From b4f14aba8e314beaa9c5a84d617e4973b7b599c5 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Wed, 20 Mar 2019 09:14:17 +0100 Subject: [PATCH] ceph_key: `lookup_ceph_initial_entities` shouldn't fail on update As of nautilus, the initial keyrings list has changed, it means when upgrading from Luminous or Mimic, it is expected there's a mismatch between what is found on the cluster and the expected initial keyring list hardcoded in ceph_key module. We shouldn't fail when upgrading to nautilus. str_to_bool() took from ceph-volume. Signed-off-by: Guillaume Abrioux Co-Authored-by: Alfredo Deza --- library/ceph_key.py | 14 +++++++++++++- roles/ceph-mon/tasks/ceph_keys.yml | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/library/ceph_key.py b/library/ceph_key.py index 03785e316..1db473b0c 100644 --- a/library/ceph_key.py +++ b/library/ceph_key.py @@ -185,6 +185,18 @@ CEPH_INITIAL_KEYS = ['client.admin', 'client.bootstrap-mds', 'client.bootstrap-m 'client.bootstrap-osd', 'client.bootstrap-rbd', 'client.bootstrap-rbd-mirror', 'client.bootstrap-rgw'] # noqa E501 +def str_to_bool(val): + try: + val = val.lower() + except AttributeError: + val = str(val).lower() + if val == 'true': + return True + elif val == 'false': + return False + else: + raise ValueError("Invalid input value: %s" % val) + def fatal(message, module): ''' Report a fatal error and exit @@ -478,7 +490,7 @@ def lookup_ceph_initial_entities(module, out): else: fatal("'auth_dump' key not present in json output:", module) # noqa E501 - if len(entities) != len(CEPH_INITIAL_KEYS): + if len(entities) != len(CEPH_INITIAL_KEYS) and not str_to_bool(os.environ.get('CEPH_ROLLING_UPDATE', False)): # must be missing in auth_dump, as if it were in CEPH_INITIAL_KEYS # it'd be in entities from the above test. Report what's missing. missing = [] diff --git a/roles/ceph-mon/tasks/ceph_keys.yml b/roles/ceph-mon/tasks/ceph_keys.yml index ab2c699f1..141e4055b 100644 --- a/roles/ceph-mon/tasks/ceph_keys.yml +++ b/roles/ceph-mon/tasks/ceph_keys.yml @@ -26,6 +26,7 @@ environment: CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}" + CEPH_ROLLING_UPDATE: "{{ rolling_update }}" when: - cephx