Meraki utility - construct_path() now supports custom keys (#42286)

* construct_path() now supports custom keys

- Allows for much more flexible test substitution
- Implemented functionality in meraki_vlan for test case

* Fix comments for PEP8
This commit is contained in:
Kevin Breit 2018-07-13 19:26:37 -05:00 committed by Dag Wieers
parent 5d76b627ef
commit 106e4b374a
2 changed files with 8 additions and 6 deletions

View file

@ -234,7 +234,7 @@ def main():
meraki.params['follow_redirects'] = 'all'
query_urls = {'vlan': '/networks/{net_id}/vlans'}
query_url = {'vlan': '/networks/{net_id}/vlans/'}
query_url = {'vlan': '/networks/{net_id}/vlans/{vlan_id}'}
create_url = {'vlan': '/networks/{net_id}/vlans'}
update_url = {'vlan': '/networks/{net_id}/vlans/'}
delete_url = {'vlan': '/networks/{net_id}/vlans/'}
@ -261,7 +261,7 @@ def main():
if not meraki.params['vlan_id']:
meraki.result['data'] = get_vlans(meraki, net_id)
else:
path = meraki.construct_path('get_one', net_id=net_id) + str(meraki.params['vlan_id'])
path = meraki.construct_path('get_one', net_id=net_id, custom={'vlan_id': meraki.params['vlan_id']})
response = meraki.request(path, method='GET')
meraki.result['data'] = response
elif meraki.params['state'] == 'present':
@ -276,7 +276,7 @@ def main():
meraki.result['changed'] = True
meraki.result['data'] = response
else:
path = meraki.construct_path('get_one', net_id=net_id) + str(meraki.params['vlan_id'])
path = meraki.construct_path('get_one', net_id=net_id, custom={'vlan_id': meraki.params['vlan_id']})
original = meraki.request(path, method='GET')
if meraki.params['dns_nameservers']:
if meraki.params['dns_nameservers'] not in ('opendns', 'google_dns', 'upstream_dns'):