Skip to content

Commit

Permalink
meraki_vlan - Remove unnecessary API calls when net_id is specified (#…
Browse files Browse the repository at this point in the history
…54939)

* Remove unnecessary API calls when net_id is specified

* Remove temp_get_nets commented out code

(cherry picked from commit fb3cc7f)
  • Loading branch information
kbreit authored and abadger committed Apr 16, 2019
1 parent fc37aed commit e62f751
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
3 changes: 3 additions & 0 deletions changelogs/fragments/meraki_vlan_api_calls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
bugfixes:
- "meraki_vlan - Module would make unnecessary API calls to Meraki when net_id is specified in task."
15 changes: 3 additions & 12 deletions lib/ansible/modules/network/meraki/meraki_vlan.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,13 +272,6 @@ def fixed_ip_factory(meraki, data):
return fixed_ips


def temp_get_nets(meraki, org_name):
org_id = meraki.get_org_id(org_name)
path = meraki.construct_path('get_all', function='network', org_id=org_id)
r = meraki.request(path, method='GET')
return r


def get_vlans(meraki, net_id):
path = meraki.construct_path('get_all', net_id=net_id)
return meraki.request(path, method='GET')
Expand Down Expand Up @@ -361,12 +354,10 @@ def main():
org_id = meraki.params['org_id']
if org_id is None:
org_id = meraki.get_org_id(meraki.params['org_name'])
nets = meraki.get_nets(org_id=org_id)
net_id = None
if meraki.params['net_name']:
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)
elif meraki.params['net_id']:
net_id = meraki.params['net_id']

if meraki.params['state'] == 'query':
if not meraki.params['vlan_id']:
Expand Down

0 comments on commit e62f751

Please sign in to comment.