From 7b7d6a1fef42eed7e144a7c391817a0a8263c3ae Mon Sep 17 00:00:00 2001 From: Kevin Breit Date: Wed, 24 Apr 2019 11:16:51 -0500 Subject: [PATCH] meraki_static_route - Remove unnecessary API call (#55528) * Make module not get all nets every time it's executed with net_id * Add changelog fragment * Update changelogs/fragments/meraki_static_route_api_calls.yml Co-Authored-By: kbreit --- changelogs/fragments/meraki_static_route_api_calls.yml | 3 +++ lib/ansible/modules/network/meraki/meraki_static_route.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/meraki_static_route_api_calls.yml diff --git a/changelogs/fragments/meraki_static_route_api_calls.yml b/changelogs/fragments/meraki_static_route_api_calls.yml new file mode 100644 index 0000000000..b8f2996480 --- /dev/null +++ b/changelogs/fragments/meraki_static_route_api_calls.yml @@ -0,0 +1,3 @@ +--- +bugfixes: +- "meraki_static_route - Module would make unnecessary API calls to Meraki when ``net_id`` is specified in task." diff --git a/lib/ansible/modules/network/meraki/meraki_static_route.py b/lib/ansible/modules/network/meraki/meraki_static_route.py index 2a9c5af221..304eaa16d5 100644 --- a/lib/ansible/modules/network/meraki/meraki_static_route.py +++ b/lib/ansible/modules/network/meraki/meraki_static_route.py @@ -328,9 +328,9 @@ def main(): org_id = meraki.params['org_id'] if not org_id: org_id = meraki.get_org_id(meraki.params['org_name']) - nets = meraki.get_nets(org_id=org_id) net_id = meraki.params['net_id'] if net_id is None: + nets = meraki.get_nets(org_id=org_id) net_id = meraki.get_net_id(net_name=meraki.params['net_name'], data=nets) if meraki.params['state'] == 'query':