New module - meraki_snmp (#39882)

* Initial commit for meraki_admin module

* Initial commit for meraki_snmp module

* Update code to be operational for SNMP settings
- Add optional_ignore value to is_update_required for one-time fields
- Write documentation
- Perform checks and execute changes

* Minor fixes and test improvements
- Fix some documentation errors
- Implement and test for idempotency

* Removed meraki_admin which shouldn't be there, ansibot changes

* Rename params to be lower case
- Updated integration tests
- Changed CamelCase to lowercase and underscore

* Code cleanup changes based on comments from Dag.
This commit is contained in:
Kevin Breit
2018-05-25 19:22:38 -05:00
committed by Dag Wieers
parent 5838e88fa0
commit d5b3ffc51e
4 changed files with 379 additions and 3 deletions

View File

@@ -122,16 +122,18 @@ class MerakiModule(object):
else:
self.params['protocol'] = 'http'
def is_update_required(self, original, proposed):
def is_update_required(self, original, proposed, optional_ignore=None):
''' Compare original and proposed data to see if an update is needed '''
is_changed = False
ignored_keys = ('id', 'organizationId')
if not optional_ignore:
optional_ignore = ('')
# self.fail_json(msg="Update required check", original=original, proposed=proposed)
for k, v in original.items():
try:
if k not in ignored_keys:
if k not in ignored_keys and k not in optional_ignore:
if v != proposed[k]:
is_changed = True
except KeyError:
@@ -139,7 +141,7 @@ class MerakiModule(object):
is_changed = True
for k, v in proposed.items():
try:
if k not in ignored_keys:
if k not in ignored_keys and k not in optional_ignore:
if v != original[k]:
is_changed = True
except KeyError: