meraki_device - Support for creating and modifying device notes (#51100)

* Add support for notes

* Add test for notes

* Device notes changes
- Renamed from notes to note
- Modified tests to work

* Comment device test since it only works once

* Remove assertion stanza and move assertion to existing one

* Add version_added to note documentation

* Converted from tabs to spaces

* Added changelog fragment

* Remove changelog file since it's a feature

* Add changelog fragment
This commit is contained in:
Kevin Breit 2019-03-29 08:26:28 -05:00 committed by Dag Wieers
parent c30bc24ba9
commit d16dcb8dbb
3 changed files with 26 additions and 18 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- "meraki_device - Add support for attaching notes to a device."

View file

@ -86,6 +86,11 @@ options:
serial_uplink: serial_uplink:
description: description:
- Serial number of device to query uplink information from. - Serial number of device to query uplink information from.
note:
description:
- Informational notes about a device.
- Limited to 255 characters.
version_added: '2.8'
author: author:
@ -238,6 +243,7 @@ def main():
lng=dict(type='float', aliases=['longitude']), lng=dict(type='float', aliases=['longitude']),
address=dict(type='str'), address=dict(type='str'),
move_map_marker=dict(type='bool'), move_map_marker=dict(type='bool'),
note=dict(type='str'),
) )
# seed the result dict in the object # seed the result dict in the object
@ -361,6 +367,7 @@ def main():
'lng': meraki.params['lng'], 'lng': meraki.params['lng'],
'address': meraki.params['address'], 'address': meraki.params['address'],
'moveMapMarker': meraki.params['move_map_marker'], 'moveMapMarker': meraki.params['move_map_marker'],
'notes': meraki.params['note'],
} }
query_path = meraki.construct_path('get_device', net_id=net_id) + meraki.params['serial'] query_path = meraki.construct_path('get_device', net_id=net_id) + meraki.params['serial']
device_data = meraki.request(query_path, method='GET') device_data = meraki.request(query_path, method='GET')

View file

@ -1,17 +1,17 @@
--- ---
- block: - block:
- name: Claim a device into an organization # - name: Claim a device into an organization
meraki_device: # meraki_device:
auth_key: '{{auth_key}}' # auth_key: '{{auth_key}}'
org_name: '{{test_org_name}}' # org_name: '{{test_org_name}}'
serial: '{{serial}}' # serial: '{{serial}}'
state: present # state: present
delegate_to: localhost # delegate_to: localhost
register: claim_device_org # register: claim_device_org
- assert: # - assert:
that: # that:
- claim_device_org.changed == true # - claim_device_org.changed == true
- name: Query status of all devices in an organization - name: Query status of all devices in an organization
meraki_device: meraki_device:
@ -160,16 +160,15 @@
tags: recently-added tags: recently-added
state: present state: present
move_map_marker: True move_map_marker: True
note: Test device notes
delegate_to: localhost delegate_to: localhost
register: update_device register: update_device
- debug: - assert:
msg: '{{update_device}}' that:
- update_device.changed == true
# - assert: - update_device.data.0.notes == "Test device notes"
# that: - '"1060 W. Addison St., Chicago, IL" in update_device.data.0.address'
# - update_device.changed == true
# - '"1060 W. Addison St., Chicago, IL" in update_device.data.0.address'
- name: Update a device with idempotency - name: Update a device with idempotency
meraki_device: meraki_device: