Skip to content

Commit

Permalink
retrieve spec by service_name if specified
Browse files Browse the repository at this point in the history
There are valid use cases where we apply multiples
service specs of the same type but with a
different name to distinguish them. We need to
specify the service_name while retrieving in these
cases to avoid trying to deserialze multiples YAML
files.

Signed-off-by: Foyer Unix <foyerunix@foyer.lu>
  • Loading branch information
Foyer Unix committed Jun 5, 2024
1 parent 2bbeb77 commit beed78a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion library/ceph_orch_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit beed78a

Please sign in to comment.