Skip to content

Commit

Permalink
[ignore] Fixed ndo_l3out_node_routing_policy module examples issue
Browse files Browse the repository at this point in the history
  • Loading branch information
sajagana authored and lhercot committed Oct 18, 2024
1 parent f166c1a commit 4fa9818
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions plugins/module_utils/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,16 +189,21 @@ def get_vrf_object(self, vrf_dict, tenant_id, templates_objects_path):
else:
self.mso.fail_json(msg="Provided VRF {0} not found.".format(vrf_dict.get("name")))

def get_l3out_node_routing_policy_object(self, uuid, name):
def get_l3out_node_routing_policy_object(self, uuid=None, name=None, fail_module=False):
"""
Get the L3Out Node Routing Policy by uuid or name.
Get the L3Out Node Routing Policy by UUID or Name.
:param uuid: UUID of the L3Out Node Routing Policy to search for -> Str
:param name: Name of the L3Out Node Routing Policy to search for -> Str
:return: The L3Out Node Routing Policy object. -> Str
:param fail_module: When match is not found fail the ansible module -> Bool
:return: Dict | None | List[Dict] | List[]: The processed result which could be:
When the UUID | Name is existing in the search list -> Dict
When the UUID | Name is not existing in the search list -> None
When both UUID and Name are None, and the search list is not empty -> List[Dict]
When both UUID and Name are None, and the search list is empty -> List[]
"""
existing_l3out_node_routing_policy = self.template.get("tenantPolicyTemplate", {}).get("template", {}).get("l3OutNodePolGroups", [])
if uuid or name: # Query a specific object
return self.get_object_by_key_value_pairs(
"L3Out Node Routing Policy", existing_l3out_node_routing_policy, [KVPair("uuid", uuid) if uuid else KVPair("name", name)]
"L3Out Node Routing Policy", existing_l3out_node_routing_policy, [KVPair("uuid", uuid) if uuid else KVPair("name", name)], fail_module
)
return existing_l3out_node_routing_policy # Query all objects
2 changes: 1 addition & 1 deletion plugins/modules/ndo_l3out_node_routing_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
username: admin
password: SomeSecretPassword
template: ansible_tenant_template
uuid: "{{ nrp_2.current.uuid }}
uuid: "{{ nrp_2.current.uuid }}"
name: nrp_2_updated
bgp_node_settings:
graceful_restart_helper: disabled
Expand Down

0 comments on commit 4fa9818

Please sign in to comment.