Meraki performance fixes for net and org lookups (#51395)

* Performance fixes for net and org lookups
- Both methods had duplicate lookups
- This should significantly improve performance
- Currently untested

* Add ChangeLog file

* Change from bugfix to bugfixes and change indent
This commit is contained in:
Kevin Breit 2019-02-18 16:58:27 -06:00 committed by Dag Wieers
parent 75ed19a561
commit c254b93796
2 changed files with 4 additions and 2 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- Meraki - Lookups using org_name or net_name no longer query Meraki twice, only once. Major performance improvements.

View file

@ -157,7 +157,7 @@ class MerakiModule(object):
response = self.request('/organizations', method='GET') response = self.request('/organizations', method='GET')
if self.status != 200: if self.status != 200:
self.fail_json(msg='Organization lookup failed') self.fail_json(msg='Organization lookup failed')
self.orgs = self.request('/organizations', method='GET') self.orgs = response
return self.orgs return self.orgs
def is_org_valid(self, data, org_name=None, org_id=None): def is_org_valid(self, data, org_name=None, org_id=None):
@ -205,7 +205,7 @@ class MerakiModule(object):
r = self.request(path, method='GET') r = self.request(path, method='GET')
if self.status != 200: if self.status != 200:
self.fail_json(msg='Network lookup failed') self.fail_json(msg='Network lookup failed')
self.nets = self.request(path, method='GET') self.nets = r
templates = self.get_config_templates(org_id) templates = self.get_config_templates(org_id)
for t in templates: for t in templates:
self.nets.append(t) self.nets.append(t)