diff --git a/README.md b/README.md index fa6d766bd9..ca46efe6ad 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ The following table shows the supported versions. | 2.1.1 | 3.0.0 | 2.2.5 | | 2.2.2.3 | 3.3.1 | 2.3.3 | | 2.2.3.3 | 6.4.0 | 2.4.11 | -| 2.3.3.0 | 6.6.3 | 2.5.5 | +| 2.3.3.0 | 6.6.4 | 2.5.5 | If your Ansible collection is older please consider updating it first. @@ -89,7 +89,7 @@ dnac_server Then, create a playbook `myplaybook.yml` ([example](https://github.com/cisco-en-programmability/dnacenter-ansible/blob/main/playbooks/tag.yml)) referencing the variables in your credentials.yml file and specifying the full namespace path to the module, plugin and/or role: ``` - hosts: dnac_servers - gather_facts: no + gather_facts: false tasks: - name: Create tag with name "MyNewTag" cisco.dnac.tag: @@ -129,7 +129,7 @@ Then, create a playbook `myplaybook.yml` ([example](https://github.com/cisco-en- - hosts: dnac_servers vars_files: - credentials.yml - gather_facts: no + gather_facts: false tasks: - name: Create tag with name "MyNewTag" cisco.dnac.tag: diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index 71d52f429d..0385062e6b 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -623,4 +623,11 @@ releases: bugfixes: - netconf_credential - Removed to search by username. - snmpv2_read_community_credential - Removed to search by username. - - snmpv2_write_community_credential - Removed to search by username. \ No newline at end of file + - snmpv2_write_community_credential - Removed to search by username. + 6.6.4: + release_date: "2023-03-14" + changes: + release_summary: New method to compare changes + bugfixes: + - A new method to compare changes for specific cases has been added. + - network_device - Used a new method to compare changes. \ No newline at end of file diff --git a/galaxy.yml b/galaxy.yml index 30570fb3e9..c797939ed3 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -1,7 +1,7 @@ --- namespace: cisco name: dnac -version: 6.6.3 +version: 6.6.4 readme: README.md authors: - Rafael Campos diff --git a/playbooks/template_pnp_intent.yml b/playbooks/template_pnp_intent.yml index b6894d670d..4ce25e16d0 100644 --- a/playbooks/template_pnp_intent.yml +++ b/playbooks/template_pnp_intent.yml @@ -2,7 +2,7 @@ vars_files: - credentials.yml - device_details.yml - gather_facts: no + gather_facts: false connection: local tasks: # @@ -16,7 +16,7 @@ dnac_password: "{{ dnac_password }}" dnac_verify: "{{ dnac_verify }}" dnac_debug: "{{ dnac_debug }}" - dnac_log: True + dnac_log: true state: "merged" #ignore_errors: true #Enable this to continue execution even the task fails config: @@ -43,7 +43,7 @@ dnac_verify: "{{dnac_verify}}" dnac_port: "{{dnac_port}}" dnac_debug: "{{dnac_debug}}" - dnac_log: True + dnac_log: true config: - site_name: "{{ item.site_name }}" project_name: "{{ item.proj_name }}" diff --git a/playbooks/test_swim_module.yml b/playbooks/test_swim_module.yml index 7861e637a7..0fbbc20451 100644 --- a/playbooks/test_swim_module.yml +++ b/playbooks/test_swim_module.yml @@ -2,7 +2,7 @@ vars_files: - credentials_245.yml - image_details.yml #Contains image and device details - gather_facts: no + gather_facts: false connection: local tasks: # @@ -17,7 +17,7 @@ dnac_password: "{{ dnac_password }}" dnac_verify: "{{ dnac_verify }}" dnac_debug: "{{ dnac_debug }}" - dnac_log: True + dnac_log: true config: - importImageDetails: type: "{{ item.import_type }}" diff --git a/plugins/action/network_device.py b/plugins/action/network_device.py index 51fa76a193..650f0cc827 100644 --- a/plugins/action/network_device.py +++ b/plugins/action/network_device.py @@ -19,7 +19,7 @@ from ansible_collections.cisco.dnac.plugins.plugin_utils.dnac import ( DNACSDK, dnac_argument_spec, - dnac_compare_equality, + dnac_compare_equality2, get_dict_result, ) from ansible_collections.cisco.dnac.plugins.plugin_utils.exceptions import ( @@ -323,8 +323,8 @@ def requires_update(self, current_obj): ] # Method 1. Params present in request (Ansible) obj are the same as the current (DNAC) params # If any does not have eq params, it requires update - return any(not dnac_compare_equality(current_obj.get(dnac_param), - requested_obj.get(ansible_param)) + return any(not dnac_compare_equality2(current_obj.get(dnac_param), + requested_obj.get(ansible_param)) for (dnac_param, ansible_param) in obj_params) def create(self): diff --git a/plugins/plugin_utils/dnac.py b/plugins/plugin_utils/dnac.py index 9df547055b..bdd833506d 100644 --- a/plugins/plugin_utils/dnac.py +++ b/plugins/plugin_utils/dnac.py @@ -85,6 +85,28 @@ def dnac_compare_equality(current_value, requested_value): return current_value == requested_value +def fn_comp_key2(k, dict1, dict2): + return dnac_compare_equality2(dict1.get(k), dict2.get(k)) + + +def dnac_compare_equality2(current_value, requested_value, is_query_param=False): + if is_query_param: + return True + if requested_value is None and current_value is None: + return True + if requested_value is None: + return False + if current_value is None: + return False + if isinstance(current_value, dict) and isinstance(requested_value, dict): + all_dict_params = list(current_value.keys()) + list(requested_value.keys()) + return not any((not fn_comp_key2(param, current_value, requested_value) for param in all_dict_params)) + elif isinstance(current_value, list) and isinstance(requested_value, list): + return compare_list(current_value, requested_value) + else: + return current_value == requested_value + + def simple_cmp(obj1, obj2): return obj1 == obj2