From 2f0ca695293dfb0d9fd71c1660b41b3f6672162b Mon Sep 17 00:00:00 2001 From: foyerunix <145095770+foyerunix@users.noreply.github.com> Date: Fri, 31 May 2024 05:41:26 +0000 Subject: [PATCH] retrieve spec by service_name if specified --- library/ceph_orch_apply.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/ceph_orch_apply.py b/library/ceph_orch_apply.py index 2b40be6..51aa8b0 100644 --- a/library/ceph_orch_apply.py +++ b/library/ceph_orch_apply.py @@ -82,7 +82,10 @@ 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"]]) + 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'