Skip to content

Commit

Permalink
Add 'idempotent' attribute (#337)
Browse files Browse the repository at this point in the history
* Add 'idempotent' attribute.

* Mention check mode in attribute description.

Co-authored-by: Alexei Znamensky <[email protected]>

---------

Co-authored-by: Alexei Znamensky <[email protected]>
  • Loading branch information
felixfontein and russoz authored Dec 30, 2024
1 parent 2a34608 commit 44e6bb6
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 0 deletions.
14 changes: 14 additions & 0 deletions plugins/doc_fragments/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,20 @@ class ModuleDocFragment(object):
platform:
description: Target OS/families that can be operated against.
support: N/A
idempotent:
description:
- When run twice in a row outside check mode, with the same arguments, the second invocation indicates no change.
- This assumes that the system controlled/queried by the module has not changed in a relevant way.
"""

# Should be used together with the standard fragment
IDEMPOTENT_NOT_MODIFY_STATE = r"""
options: {}
attributes:
idempotent:
support: full
details:
- This action does not modify state.
"""

# Should be used together with the standard fragment
Expand Down
4 changes: 4 additions & 0 deletions plugins/modules/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
platforms: RouterOS
action_group:
version_added: 2.1.0
idempotent:
support: N/A
details:
- Whether the executed command is idempotent depends on the operation performed.
options:
path:
description:
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/api_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
- community.routeros.attributes.actiongroup_api
- community.routeros.attributes.facts
- community.routeros.attributes.facts_module
- community.routeros.attributes.idempotent_not_modify_state
attributes:
platform:
support: full
Expand Down
2 changes: 2 additions & 0 deletions plugins/modules/api_find_and_modify.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
platform:
support: full
platforms: RouterOS
idempotent:
support: full
options:
path:
description:
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/api_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
- community.routeros.api.restrict
- community.routeros.attributes
- community.routeros.attributes.actiongroup_api
- community.routeros.attributes.idempotent_not_modify_state
- community.routeros.attributes.info_module
attributes:
platform:
Expand Down
2 changes: 2 additions & 0 deletions plugins/modules/api_modify.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
platform:
support: full
platforms: RouterOS
idempotent:
support: full
options:
path:
description:
Expand Down
4 changes: 4 additions & 0 deletions plugins/modules/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
platform:
support: full
platforms: RouterOS
idempotent:
support: N/A
details:
- Whether the executed command is idempotent depends on the command.
options:
commands:
description:
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- community.routeros.attributes
- community.routeros.attributes.facts
- community.routeros.attributes.facts_module
- community.routeros.attributes.idempotent_not_modify_state
attributes:
platform:
support: full
Expand Down

0 comments on commit 44e6bb6

Please sign in to comment.