Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

delete->replace->update ordering #31

Merged
merged 1 commit into from
Dec 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading