From 823700bc1bc1f477cd58c61cded977a706a5c308 Mon Sep 17 00:00:00 2001 From: Teoman ONAY Date: Wed, 21 Aug 2024 17:33:19 +0200 Subject: [PATCH] ceph_orch_apply: fix yaml error when multiple rgw deployed ceph orch ls rgw --format=yaml returns multiple documents when multiple rgw are installed, this was not handled correctly. Signed-off-by: Teoman ONAY --- infrastructure-playbooks/cephadm-adopt.yml | 2 +- library/ceph_orch_apply.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/infrastructure-playbooks/cephadm-adopt.yml b/infrastructure-playbooks/cephadm-adopt.yml index 94cc270f5..facac09d4 100644 --- a/infrastructure-playbooks/cephadm-adopt.yml +++ b/infrastructure-playbooks/cephadm-adopt.yml @@ -943,7 +943,7 @@ hosts: - {{ ansible_facts['nodename'] }} {% if rgw_subnet is defined %} - networks: "{{ rgw_subnet }}" + networks: "{{ radosgw_address_block }}" {% endif %} spec: rgw_frontend_port: {{ radosgw_frontend_port }} diff --git a/library/ceph_orch_apply.py b/library/ceph_orch_apply.py index 0c876b24b..1df457b09 100644 --- a/library/ceph_orch_apply.py +++ b/library/ceph_orch_apply.py @@ -82,7 +82,12 @@ def retrieve_current_spec(module: AnsibleModule, expected_spec: Dict) -> Dict: """ retrieve current config of the service """ service: str = expected_spec["service_type"] cmd = build_base_cmd_orch(module) - cmd.extend(['ls', service, '--format=yaml']) + cmd.extend(['ls', service]) + if 'service_name' in expected_spec: + cmd.extend([expected_spec["service_name"]]) + else: + cmd.extend([expected_spec["service_type"] + "." + expected_spec["service_id"]]) + cmd.extend(['--format=yaml']) out = module.run_command(cmd) if isinstance(out, str): # if there is no existing service, cephadm returns the string 'No services reported'