Skip to content

Commit

Permalink
[ignore_changes] Fixing documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
anvitha-jain committed Nov 14, 2024
1 parent e253d7b commit 19e105d
Show file tree
Hide file tree
Showing 4 changed files with 289 additions and 243 deletions.
13 changes: 13 additions & 0 deletions plugins/module_utils/mso.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,19 @@ def write_file(module, url, dest, content, resp, tmpsrc=None):
os.remove(tmpsrc)


def format_interface_descriptions(interface_descriptions, node=None):
formated_interface_descriptions = [
{
"nodeID": node if node is not None else interface_description.get("node"),
"interfaceID": interface_description.get("interface_id", interface_description.get("interfaceID")),
"description": interface_description.get("description"),
}
for interface_description in interface_descriptions
]

return formated_interface_descriptions


class MSOModule(object):
def __init__(self, module):
self.module = module
Expand Down
6 changes: 4 additions & 2 deletions plugins/module_utils/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ def get_object_by_key_value_pairs(self, object_description, search_list, kv_list
:param fail_module: When match is not found fail the ansible module. -> Bool
:return: The object. -> Dict | None
"""
if search_list is None or kv_list is None:
return None
match, existing = self.get_object_from_list(search_list, kv_list)
if not match and fail_module:
msg = "Provided {0} with '{1}' not matching existing object(s): {2}".format(object_description, kv_list, ", ".join(existing))
Expand Down Expand Up @@ -214,7 +216,7 @@ def get_interface_policy_group_uuid(self, interface_policy_group):
:param interface_policy_group: Name of the Interface Policy Group to search for -> Str
:return: UUID of the Interface Policy Group. -> Str
"""
existing_policies = self.template.get("fabricPolicyTemplate", {}).get("template", {}).get("interfacePolicyGroups", [])
existing_policy_groups = self.template.get("fabricPolicyTemplate", {}).get("template", {}).get("interfacePolicyGroups", [])
kv_list = [KVPair("name", interface_policy_group)]
match = self.get_object_by_key_value_pairs("Interface Policy Groups", existing_policies, kv_list, fail_module=True)
match = self.get_object_by_key_value_pairs("Interface Policy Groups", existing_policy_groups, kv_list, fail_module=True)
return match.details.get("uuid")
Loading

0 comments on commit 19e105d

Please sign in to comment.