mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Removed any temporary get_net() methods (#42391)
- Made appropriate changes where needed
This commit is contained in:
parent
e9bf3c70e6
commit
a65d9257fd
2 changed files with 6 additions and 20 deletions
|
@ -249,13 +249,6 @@ def network_factory(meraki, networks, nets):
|
||||||
return networks_new
|
return networks_new
|
||||||
|
|
||||||
|
|
||||||
def get_nets_temp(meraki, org_id): # Function won't be needed when get_nets is added to util
|
|
||||||
path = meraki.construct_path('get_all', function='network', org_id=org_id)
|
|
||||||
response = meraki.request(path, method='GET')
|
|
||||||
if meraki.status == 200:
|
|
||||||
return response
|
|
||||||
|
|
||||||
|
|
||||||
def create_admin(meraki, org_id, name, email):
|
def create_admin(meraki, org_id, name, email):
|
||||||
payload = dict()
|
payload = dict()
|
||||||
payload['name'] = name
|
payload['name'] = name
|
||||||
|
@ -268,7 +261,7 @@ def create_admin(meraki, org_id, name, email):
|
||||||
if meraki.params['tags'] is not None:
|
if meraki.params['tags'] is not None:
|
||||||
payload['tags'] = json.loads(meraki.params['tags'])
|
payload['tags'] = json.loads(meraki.params['tags'])
|
||||||
if meraki.params['networks'] is not None:
|
if meraki.params['networks'] is not None:
|
||||||
nets = get_nets_temp(meraki, org_id)
|
nets = meraki.get_nets(org_id=org_id)
|
||||||
networks = network_factory(meraki, meraki.params['networks'], nets)
|
networks = network_factory(meraki, meraki.params['networks'], nets)
|
||||||
# meraki.fail_json(msg=str(type(networks)), data=networks)
|
# meraki.fail_json(msg=str(type(networks)), data=networks)
|
||||||
payload['networks'] = networks
|
payload['networks'] = networks
|
||||||
|
|
|
@ -219,13 +219,6 @@ def get_org_devices(meraki, org_id):
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
def temp_get_nets(meraki, org_name, net_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 main():
|
def main():
|
||||||
|
|
||||||
# define the available arguments/parameters that a user can pass to
|
# define the available arguments/parameters that a user can pass to
|
||||||
|
@ -300,14 +293,14 @@ def main():
|
||||||
|
|
||||||
# manipulate or modify the state as needed (this is going to be the
|
# manipulate or modify the state as needed (this is going to be the
|
||||||
# part where your module will do what it needs to do)
|
# part where your module will do what it needs to do)
|
||||||
|
|
||||||
org_id = meraki.params['org_id']
|
org_id = meraki.params['org_id']
|
||||||
if org_id is None:
|
if org_id is None:
|
||||||
org_id = meraki.get_org_id(meraki.params['org_name'])
|
org_id = meraki.get_org_id(meraki.params['org_name'])
|
||||||
net_id = meraki.params['net_id']
|
nets = meraki.get_nets(org_id=org_id)
|
||||||
if net_id is None:
|
net_id = None
|
||||||
if meraki.params['net_name']:
|
if meraki.params['net_id'] or meraki.params['net_name']:
|
||||||
nets = temp_get_nets(meraki, meraki.params['org_name'], meraki.params['net_name'])
|
net_id = meraki.params['net_id']
|
||||||
|
if net_id is None:
|
||||||
net_id = meraki.get_net_id(net_name=meraki.params['net_name'], data=nets)
|
net_id = meraki.get_net_id(net_name=meraki.params['net_name'], data=nets)
|
||||||
|
|
||||||
if meraki.params['state'] == 'query':
|
if meraki.params['state'] == 'query':
|
||||||
|
|
Loading…
Reference in a new issue