Skip to content

Commit

Permalink
Merge pull request #294 from ceph/mergify/bp/reef/pr-291
Browse files Browse the repository at this point in the history
ceph_orch_apply: code change for clarity (backport #291)
  • Loading branch information
asm0deuz authored May 17, 2024
2 parents 3e6cd69 + ff2e97c commit 555a2bc
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions library/ceph_orch_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,6 @@ def retrieve_current_spec(module: AnsibleModule, expected_spec: Dict) -> Dict:
return yaml.safe_load(out[1])


def change_required(current: Dict, expected: Dict) -> bool:
""" checks if the current config differs from what is expected """
if not current:
return True

for key, value in expected.items():
if key in current:
if current[key] != value:
return True
continue
else:
return True
return False


def apply_spec(module: "AnsibleModule",
data: str) -> Tuple[int, List[str], str, str]:
cmd = build_base_cmd_orch(module)
Expand Down Expand Up @@ -152,7 +137,7 @@ def run_module() -> None:
expected = parse_spec(module.params.get('spec'))
current_spec = retrieve_current_spec(module, expected)

if change_required(current_spec, expected):
if not current_spec or current_spec != expected:
rc, cmd, out, err = apply_spec(module, spec)
changed = True
else:
Expand Down

0 comments on commit 555a2bc

Please sign in to comment.