Skip to content

Commit

Permalink
[ignore] Handle classes that don't support annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
samiib committed Oct 20, 2023
1 parent eae0317 commit b5986c0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion plugins/modules/aci_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,8 @@
from ansible_collections.cisco.aci.plugins.module_utils.aci import ACIModule, aci_argument_spec, aci_annotation_spec
from ansible.module_utils._text import to_text

ANNOTATION_UNSUPPORTED = ["tagTag"]


def update_qsl(url, params):
"""Add or update a URL query string"""
Expand All @@ -310,7 +312,9 @@ def update_qsl(url, params):
def add_annotation(annotation, payload):
"""Add annotation to payload only if it has not already been added"""
if annotation:
for val in payload.values():
for key, val in payload.items():
if key in ANNOTATION_UNSUPPORTED:
return
att = val.get("attributes", {})
if "annotation" not in att.keys():
att["annotation"] = annotation
Expand All @@ -320,6 +324,8 @@ def add_annotation_xml(annotation, tree):
"""Add annotation to payload xml only if it has not already been added"""
if annotation:
for element in tree.iter():
if element.tag in ANNOTATION_UNSUPPORTED:
return
ann = element.get("annotation")
if ann is None:
element.set("annotation", annotation)
Expand Down

0 comments on commit b5986c0

Please sign in to comment.