Skip to content

Commit

Permalink
ceph_orch_apply: fix yaml error when multiple rgw deployed
Browse files Browse the repository at this point in the history
ceph orch ls rgw --format=yaml returns multiple documents
when multiple rgw are installed, this was not handled
correctly.

Signed-off-by: Teoman ONAY <[email protected]>
(cherry picked from commit 823700b)
  • Loading branch information
asm0deuz authored and mergify[bot] committed Aug 23, 2024
1 parent 3b5e0b2 commit f6935f7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion infrastructure-playbooks/cephadm-adopt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
7 changes: 6 additions & 1 deletion library/ceph_orch_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit f6935f7

Please sign in to comment.