Skip to content

Commit

Permalink
delete->replace->update ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
hellt committed Dec 6, 2024
1 parent 3358adb commit 7c9889b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions plugins/modules/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,21 @@ def main():
yang_models = module.params.get("yang_models")
confirm_timeout = module.params.get("confirm_timeout")

# since operations are modelled as a dict in this collection
# an ordering is implied when multiple operations are provided.
# we add all deletes, followed by replaces, and then followed by updates.
# this ordering should satisfy most use cases where multiple operations
# are bundled in a single request, where deletes are processed first and then
# replaces and updates can be used to enact new config values.
commands = []
for obj in updates:
obj["action"] = "update"
for obj in deletes:
obj["action"] = "delete"
commands += [obj]
for obj in replaces:
obj["action"] = "replace"
commands += [obj]
for obj in deletes:
obj["action"] = "delete"
for obj in updates:
obj["action"] = "update"
commands += [obj]

diff_resp = {}
Expand Down

0 comments on commit 7c9889b

Please sign in to comment.