Repository: ansible/ansible

Issue:
meraki - Idempotency check is broken
##### SUMMARY
Current: The Meraki module will do a two pass comparison between the original and proposed configuration. First, it looks at the original and compares that data to the proposed. Second, it looks at the proposed data and compares to the original. This makes sure keys from both data structures are compared.

This has worked fine since most modules have a minimal number of parameters. However, Meraki's SSID API for wireless network configuration has around 2 dozen parameters. The API also returns a lot of information about the SSID. Both of these conditions increases the chance of idempotency problems with the current state.

A likely fix is to make the comparison only one pass. The one pass should compare the data in the proposed to the data in the comparison.

##### ISSUE TYPE
 - Bug Report

##### COMPONENT NAME
meraki

##### ANSIBLE VERSION
```
ansible 2.7.0.dev0 (meraki/meraki_ssid f7ef022171) last updated 2018/06/24 19:45:10 (GMT -500)
  config file = None
  configured module search path = ['/Users/kbreit/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/kbreit/Documents/Programming/ansible/lib/ansible
  executable location = /Users/kbreit/Documents/Programming/ansible/bin/ansible
  python version = 3.5.4 (default, Feb 25 2018, 14:56:02) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)]
```


Discussion:
Files identified in the description:
* [lib/ansible/module_utils/network/meraki/meraki.py](https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/network/meraki/meraki.py)

If these files are inaccurate, please update the `component name` section of the description or use the `!component` bot command.

[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->
cc @Qalthos @dagwieers @ganeshrn @gdpak @gundalow @privateip @rcarrillocruz @trishnaguha
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: notify --->

Resolving patch:
diff --git a/lib/ansible/module_utils/network/meraki/meraki.py b/lib/ansible/module_utils/network/meraki/meraki.py
--- a/lib/ansible/module_utils/network/meraki/meraki.py
+++ b/lib/ansible/module_utils/network/meraki/meraki.py
@@ -130,14 +130,14 @@ def is_update_required(self, original, proposed, optional_ignore=None):
         if not optional_ignore:
             optional_ignore = ('')
 
-        for k, v in original.items():
-            try:
-                if k not in ignored_keys and k not in optional_ignore:
-                    if v != proposed[k]:
-                        is_changed = True
-            except KeyError:
-                if v != '':
-                    is_changed = True
+        # for k, v in original.items():
+        #     try:
+        #         if k not in ignored_keys and k not in optional_ignore:
+        #             if v != proposed[k]:
+        #                 is_changed = True
+        #     except KeyError:
+        #         if v != '':
+        #             is_changed = True
         for k, v in proposed.items():
             try:
                 if k not in ignored_keys and k not in optional_ignore:


Test patch: