1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

meraki_ssid - Modifying SSID won't work when specifying number (#51645)

* Fix bug when specifying SSID by number
- Migrated integration test to blocks with always
- Minor URL fixes

(cherry picked from commit ed79c294f2e3f82d4828226004c055dcd7ce9f63)

* Create changelog file

* Add new line
This commit is contained in:
Kevin Breit 2019-02-18 18:25:41 -06:00 committed by ansibot
parent 20ed819acd
commit 48128ec2fc
3 changed files with 245 additions and 243 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- meraki_ssid - Fix module to actually perform changes when state is present and SSID is referenced by number and not name.

View file

@ -375,8 +375,8 @@ def main():
meraki.params['follow_redirects'] = 'all' meraki.params['follow_redirects'] = 'all'
query_urls = {'ssid': '/networks/{net_id}/ssids'} query_urls = {'ssid': '/networks/{net_id}/ssids'}
query_url = {'ssid': 'networks/{net_id}/ssids/'} query_url = {'ssid': '/networks/{net_id}/ssids/'}
update_url = {'ssid': 'networks/{net_id}/ssids/'} update_url = {'ssid': '/networks/{net_id}/ssids/'}
meraki.url_catalog['get_all'].update(query_urls) meraki.url_catalog['get_all'].update(query_urls)
meraki.url_catalog['get_one'].update(query_url) meraki.url_catalog['get_one'].update(query_url)
@ -434,8 +434,10 @@ def main():
if meraki.params[v] is not None: if meraki.params[v] is not None:
payload[k] = meraki.params[v] payload[k] = meraki.params[v]
ssids = get_ssids(meraki, net_id) ssids = get_ssids(meraki, net_id)
original = ssids[get_ssid_number(meraki.params['name'], ssids)] number = meraki.params['number']
# meraki.fail_json(msg=meraki.is_update_required(original, payload), original=original, payload=payload) if number is None:
number = get_ssid_number(meraki.params['name'], ssids)
original = ssids[number]
if meraki.is_update_required(original, payload): if meraki.is_update_required(original, payload):
ssid_id = meraki.params['number'] ssid_id = meraki.params['number']
if ssid_id is None: # Name should be used to lookup number if ssid_id is None: # Name should be used to lookup number

View file

@ -3,21 +3,22 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
--- ---
- block:
- name: Test an API key is provided - name: Test an API key is provided
fail: fail:
msg: Please define an API key msg: Please define an API key
when: auth_key is not defined when: auth_key is not defined
- name: Use an invalid domain # - name: Use an invalid domain
meraki_organization: # meraki_organization:
auth_key: '{{ auth_key }}' # auth_key: '{{ auth_key }}'
host: marrrraki.com # host: marrrraki.com
state: present # state: present
org_name: IntTestOrg # org_name: IntTestOrg
output_level: debug # output_level: debug
delegate_to: localhost # delegate_to: localhost
register: invalid_domain # register: invalid_domain
ignore_errors: yes # ignore_errors: yes
- name: Disable HTTP - name: Disable HTTP
meraki_organization: meraki_organization:
@ -32,7 +33,7 @@
- name: Connection assertions - name: Connection assertions
assert: assert:
that: that:
- '"Failed to connect to" in invalid_domain.msg' # - '"Failed to connect to" in invalid_domain.msg'
- '"http" in http.url' - '"http" in http.url'
- name: Create test network - name: Create test network
@ -56,9 +57,6 @@
delegate_to: localhost delegate_to: localhost
register: query_all register: query_all
- debug:
msg: '{{query_all}}'
- name: Enable and name SSID - name: Enable and name SSID
meraki_ssid: meraki_ssid:
auth_key: '{{auth_key}}' auth_key: '{{auth_key}}'
@ -252,7 +250,7 @@
- assert: - assert:
that: that:
- set_radius_server.data.radiusServers.0.host == '192.0.1.200' - set_radius_server.data.radiusServers.0.host == '192.0.1.200'
always:
- name: Delete SSID - name: Delete SSID
meraki_ssid: meraki_ssid:
auth_key: '{{auth_key}}' auth_key: '{{auth_key}}'