Skip to content

Commit

Permalink
[ignore] Move previous setting to correct location in code and fix no…
Browse files Browse the repository at this point in the history
…te in code
  • Loading branch information
akinross authored and lhercot committed Jul 9, 2024
1 parent 01e9eed commit b490e6d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion plugins/module_utils/mso.py
Original file line number Diff line number Diff line change
Expand Up @@ -1491,7 +1491,7 @@ def input_validation(self, attr_name, attr_value, required_attributes, target_ob
elif empty_attributes:
self.module.fail_json(msg="When the '{0}' is '{1}', the {2} attributes must be set".format(attr_name, attr_value, empty_attributes))

# Temporary introduced method to handle nd specific query without introducing a dependency on the nd collection in code
# Temporarily introduced method to handle nd specific query without introducing a dependency on the nd collection in code
# Copied method from the nd collection: https://github.com/CiscoDevNet/ansible-nd/blob/master/plugins/module_utils/nd.py#L221
# TODO: Refactor the code for bundled nd collection
def nd_request(self, path, method=None, data=None, file=None, qs=None, prefix="", file_key="file", output_format="json", ignore_not_found_error=False):
Expand Down
5 changes: 3 additions & 2 deletions plugins/modules/mso_tenant.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,11 @@ def main():
else:
mso.existing = mso.query_objs(path)

mso.previous = mso.existing

if state == "query":
pass

elif state == "absent":
mso.previous = mso.existing
if mso.existing:
if module.check_mode:
mso.existing = {}
Expand All @@ -193,6 +192,8 @@ def main():
mso.existing = mso.request(path, method="DELETE")

elif state == "present":
mso.previous = mso.existing

# Convert sites and users
sites = mso.lookup_sites(module.params.get("sites"))
users = mso.lookup_users(module.params.get("users"))
Expand Down

0 comments on commit b490e6d

Please sign in to comment.