From 05f7d64a98e2c4e68b96a5cac6b39b9e528fea5f Mon Sep 17 00:00:00 2001 From: Kevin Breit Date: Tue, 3 Jul 2018 03:23:12 -0500 Subject: [PATCH] Add properties for orgs and nets (#42085) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Module utility now has orgs, nets, org_id, and net_id properties - get_nets and get_orgs sets nets and orgs properties respectively - Allows for storage of this data in the module. org_id and net_id aren’t set as I cannot guarantee that’s always desired. --- lib/ansible/module_utils/network/meraki/meraki.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/ansible/module_utils/network/meraki/meraki.py b/lib/ansible/module_utils/network/meraki/meraki.py index a66b0d5612..c395de9d5f 100644 --- a/lib/ansible/module_utils/network/meraki/meraki.py +++ b/lib/ansible/module_utils/network/meraki/meraki.py @@ -56,6 +56,10 @@ class MerakiModule(object): self.result = dict(changed=False) self.headers = dict() self.function = function + self.orgs = None + self.nets = None + self.org_id = None + self.net_id = None # normal output self.existing = None @@ -153,7 +157,8 @@ class MerakiModule(object): response = self.request('/organizations', method='GET') if self.status != 200: self.fail_json(msg='Organization lookup failed') - return response + self.orgs = self.request('/organizations', method='GET') + return self.orgs def is_org_valid(self, data, org_name=None, org_id=None): """Checks whether a specific org exists and is duplicated. @@ -200,7 +205,8 @@ class MerakiModule(object): r = self.request(path, method='GET') if self.status != 200: self.fail_json(msg='Network lookup failed') - return r + self.nets = self.request(path, method='GET') + return self.nets def get_net(self, org_name, net_name, data=None): """Return network information about a particular network."""