Skip to content

Commit

Permalink
[ignore] Changes based on PR comments
Browse files Browse the repository at this point in the history
- no_verification is now suppress_verification and added aliases
- suppressed verification current == proposed
- Adjusted documentation
- Fixed integration tests based on changes
  • Loading branch information
samiib authored and lhercot committed Mar 26, 2024
1 parent 0f8e364 commit 87ed190
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 26 deletions.
6 changes: 4 additions & 2 deletions plugins/doc_fragments/aci.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,15 @@ class ModuleDocFragment(object):
- Path to a file that will be used to dump the ACI JSON configuration objects generated by the module.
- If the value is not specified in the task, the value of environment variable C(ACI_OUTPUT_PATH) will be used instead.
type: str
no_verification:
suppress_verification:
description:
- If C(true), a verifying GET will not be sent after a POST update to APIC.
- If the value is not specified in the task, the value of environment variable C(ACI_NO_VERIFICATION) will be used instead.
- WARNING - This causes the current return value to be empty and any updates will be unverifiable.
- The default value is C(false).
- WARNING - This causes the current return value to be set to the proposed value.
- The current object including default values will be unverifiable in a single task.
type: bool
aliases: [ no_verification, no_verify, suppress_verify ]
seealso:
- ref: aci_guide
description: Detailed information on how to manage your ACI infrastructure using Ansible.
Expand Down
9 changes: 5 additions & 4 deletions plugins/module_utils/aci.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def aci_argument_spec():
use_ssl=dict(type="bool", fallback=(env_fallback, ["ACI_USE_SSL"])),
validate_certs=dict(type="bool", fallback=(env_fallback, ["ACI_VALIDATE_CERTS"])),
output_path=dict(type="str", fallback=(env_fallback, ["ACI_OUTPUT_PATH"])),
no_verification=dict(type="bool", fallback=(env_fallback, ["ACI_NO_VERIFICATION"])),
suppress_verification=dict(type="bool", aliases=["no_verification", "no_verify", "suppress_verify"], fallback=(env_fallback, ["ACI_NO_VERIFICATION"])),
)


Expand Down Expand Up @@ -418,7 +418,7 @@ def __init__(self, module):
self.totalCount = None

# get no verify flag
self.no_verification = self.params.get("no_verification")
self.suppress_verification = self.params.get("suppress_verification")

# Ensure protocol is set
self.define_protocol()
Expand Down Expand Up @@ -1597,12 +1597,13 @@ def exit_json(self, filter_existing=None, **kwargs):
if "state" in self.params:
self.original = self.existing
if self.params.get("state") in ("absent", "present"):
if self.no_verification:
if self.suppress_verification:
if self.result["changed"]:
self.result["current_verified"] = False
self.existing = []
self.existing = [self.proposed]
else:
self.result["current_verified"] = True
# exisiting already equals the previous
else:
self.get_existing()

Expand Down
9 changes: 5 additions & 4 deletions tests/integration/targets/aci_aep/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,10 @@
that:
- aep_present_no_verify_cm is changed
- aep_present_no_verify_cm.current_verified == false
- aep_present_no_verify_cm.current == []
- aep_present_no_verify_cm.current.0 == aep_present_no_verify_cm.proposed
- aep_present_no_verify is changed
- aep_present_no_verify.current_verified == false
- aep_present_no_verify.current == []
- aep_present_no_verify.current.0 == aep_present_no_verify.proposed
- aep_present_no_verify.previous == []
- aep_present_no_verify_again is not changed
- aep_present_no_verify_again.current_verified == true
Expand All @@ -249,18 +249,19 @@
- aep_present_no_verify_again.previous.0.infraAttEntityP.attributes.descr == "Ansible Test"
- update_aep_present_no_verify is changed
- update_aep_present_no_verify.current_verified == false
- update_aep_present_no_verify.current == []
- update_aep_present_no_verify.current.0 == update_aep_present_no_verify.proposed
- update_aep_present_no_verify.previous.0.infraAttEntityP.attributes.name == "anstest-no-verify"
- update_aep_present_no_verify.previous.0.infraAttEntityP.attributes.descr == "Ansible Test"
- delete_aep_present_no_verify is changed
- delete_aep_present_no_verify.current_verified == false
- delete_aep_present_no_verify.current == []
- delete_aep_present_no_verify.current.0 == delete_aep_present_no_verify.proposed
- delete_aep_present_no_verify.previous.0.infraAttEntityP.attributes.name == "anstest-no-verify"
- delete_aep_present_no_verify.previous.0.infraAttEntityP.attributes.descr == "Ansible Test No Verify"
- delete_aep_present_no_verify_again is not changed
- delete_aep_present_no_verify_again.current_verified == true
- delete_aep_present_no_verify_again.current == []
- delete_aep_present_no_verify_again.previous == []
- delete_aep_present_no_verify_again.proposed == {}

# QUERY ALL AEPS
- name: Query all AEPs (check_mode)
Expand Down
9 changes: 5 additions & 4 deletions tests/integration/targets/aci_ap/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@
that:
- ap_present_no_verify_cm is changed
- ap_present_no_verify_cm.current_verified == false
- ap_present_no_verify_cm.current == []
- ap_present_no_verify_cm.current.0 == ap_present_no_verify_cm.proposed
- ap_present_no_verify is changed
- ap_present_no_verify.current_verified == false
- ap_present_no_verify.current == []
- ap_present_no_verify.current.0 == ap_present_no_verify.proposed
- ap_present_no_verify.previous == []
- ap_present_no_verify_again is not changed
- ap_present_no_verify_again.current_verified == true
Expand All @@ -162,18 +162,19 @@
- ap_present_no_verify_again.previous.0.fvAp.attributes.descr == "Ansible Test"
- update_ap_present_no_verify is changed
- update_ap_present_no_verify.current_verified == false
- update_ap_present_no_verify.current == []
- update_ap_present_no_verify.current.0 == update_ap_present_no_verify.proposed
- update_ap_present_no_verify.previous.0.fvAp.attributes.name == "anstest-no-verify"
- update_ap_present_no_verify.previous.0.fvAp.attributes.descr == "Ansible Test"
- delete_ap_present_no_verify is changed
- delete_ap_present_no_verify.current_verified == false
- delete_ap_present_no_verify.current == []
- delete_ap_present_no_verify.current.0 == delete_ap_present_no_verify.proposed
- delete_ap_present_no_verify.previous.0.fvAp.attributes.name == "anstest-no-verify"
- delete_ap_present_no_verify.previous.0.fvAp.attributes.descr == "Ansible Test No Verify"
- delete_ap_present_no_verify_again is not changed
- delete_ap_present_no_verify_again.current_verified == true
- delete_ap_present_no_verify_again.current == []
- delete_ap_present_no_verify_again.previous == []
- delete_ap_present_no_verify_again.proposed == {}

- name: get ap - query specific ap
cisco.aci.aci_ap: &aci_ap_query
Expand Down
9 changes: 5 additions & 4 deletions tests/integration/targets/aci_bd/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -545,10 +545,10 @@
that:
- bd_present_no_verify_cm is changed
- bd_present_no_verify_cm.current_verified == false
- bd_present_no_verify_cm.current == []
- bd_present_no_verify_cm.current.0 == bd_present_no_verify_cm.proposed
- bd_present_no_verify is changed
- bd_present_no_verify.current_verified == false
- bd_present_no_verify.current == []
- bd_present_no_verify.current.0 == bd_present_no_verify.proposed
- bd_present_no_verify.previous == []
- bd_present_no_verify_again is not changed
- bd_present_no_verify_again.current_verified == true
Expand All @@ -558,18 +558,19 @@
- bd_present_no_verify_again.previous.0.fvBD.attributes.descr == "Ansible Test"
- update_bd_present_no_verify is changed
- update_bd_present_no_verify.current_verified == false
- update_bd_present_no_verify.current == []
- update_bd_present_no_verify.current.0 == update_bd_present_no_verify.proposed
- update_bd_present_no_verify.previous.0.fvBD.attributes.name == "anstest-no-verify"
- update_bd_present_no_verify.previous.0.fvBD.attributes.descr == "Ansible Test"
- delete_bd_present_no_verify is changed
- delete_bd_present_no_verify.current_verified == false
- delete_bd_present_no_verify.current == []
- delete_bd_present_no_verify.current.0 == delete_bd_present_no_verify.proposed
- delete_bd_present_no_verify.previous.0.fvBD.attributes.name == "anstest-no-verify"
- delete_bd_present_no_verify.previous.0.fvBD.attributes.descr == "Ansible Test No Verify"
- delete_bd_present_no_verify_again is not changed
- delete_bd_present_no_verify_again.current_verified == true
- delete_bd_present_no_verify_again.current == []
- delete_bd_present_no_verify_again.previous == []
- delete_bd_present_no_verify_again.proposed == {}

- name: get all bd
cisco.aci.aci_bd: &aci_query
Expand Down
9 changes: 5 additions & 4 deletions tests/integration/targets/aci_epg/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@
that:
- epg_present_no_verify_cm is changed
- epg_present_no_verify_cm.current_verified == false
- epg_present_no_verify_cm.current == []
- epg_present_no_verify_cm.current.0 == epg_present_no_verify_cm.proposed
- epg_present_no_verify is changed
- epg_present_no_verify.current_verified == false
- epg_present_no_verify.current == []
- epg_present_no_verify.current.0 == epg_present_no_verify.proposed
- epg_present_no_verify.previous == []
- epg_present_no_verify_again is not changed
- epg_present_no_verify_again.current_verified == true
Expand All @@ -185,18 +185,19 @@
- epg_present_no_verify_again.previous.0.fvAEPg.attributes.descr == "Ansible Test"
- update_epg_present_no_verify is changed
- update_epg_present_no_verify.current_verified == false
- update_epg_present_no_verify.current == []
- update_epg_present_no_verify.current.0 == update_epg_present_no_verify.proposed
- update_epg_present_no_verify.previous.0.fvAEPg.attributes.name == "anstest-no-verify"
- update_epg_present_no_verify.previous.0.fvAEPg.attributes.descr == "Ansible Test"
- delete_epg_present_no_verify is changed
- delete_epg_present_no_verify.current_verified == false
- delete_epg_present_no_verify.current == []
- delete_epg_present_no_verify.current.0 == delete_epg_present_no_verify.proposed
- delete_epg_present_no_verify.previous.0.fvAEPg.attributes.name == "anstest-no-verify"
- delete_epg_present_no_verify.previous.0.fvAEPg.attributes.descr == "Ansible Test No Verify"
- delete_epg_present_no_verify_again is not changed
- delete_epg_present_no_verify_again.current_verified == true
- delete_epg_present_no_verify_again.current == []
- delete_epg_present_no_verify_again.previous == []
- delete_epg_present_no_verify_again.proposed == {}

- name: Query specific epg
cisco.aci.aci_epg:
Expand Down
9 changes: 5 additions & 4 deletions tests/integration/targets/aci_tenant/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,10 @@
that:
- tenant_present_no_verify_cm is changed
- tenant_present_no_verify_cm.current_verified == false
- tenant_present_no_verify_cm.current == []
- tenant_present_no_verify_cm.current.0 == tenant_present_no_verify_cm.proposed
- tenant_present_no_verify is changed
- tenant_present_no_verify.current_verified == false
- tenant_present_no_verify.current == []
- tenant_present_no_verify.current.0 == tenant_present_no_verify.proposed
- tenant_present_no_verify.previous == []
- tenant_present_no_verify_again is not changed
- tenant_present_no_verify_again.current_verified == true
Expand All @@ -281,18 +281,19 @@
- tenant_present_no_verify_again.previous.0.fvTenant.attributes.descr == "Ansible Test"
- update_tenant_present_no_verify is changed
- update_tenant_present_no_verify.current_verified == false
- update_tenant_present_no_verify.current == []
- update_tenant_present_no_verify.current.0 == update_tenant_present_no_verify.proposed
- update_tenant_present_no_verify.previous.0.fvTenant.attributes.name == "anstest-no-verify"
- update_tenant_present_no_verify.previous.0.fvTenant.attributes.descr == "Ansible Test"
- delete_tenant_present_no_verify is changed
- delete_tenant_present_no_verify.current_verified == false
- delete_tenant_present_no_verify.current == []
- delete_tenant_present_no_verify.current.0 == delete_tenant_present_no_verify.proposed
- delete_tenant_present_no_verify.previous.0.fvTenant.attributes.name == "anstest-no-verify"
- delete_tenant_present_no_verify.previous.0.fvTenant.attributes.descr == "Ansible Test No Verify"
- delete_tenant_present_no_verify_again is not changed
- delete_tenant_present_no_verify_again.current_verified == true
- delete_tenant_present_no_verify_again.current == []
- delete_tenant_present_no_verify_again.previous == []
- delete_tenant_present_no_verify_again.proposed == {}

# QUERY ALL TENANTS
- name: Query all tenants (check_mode)
Expand Down

0 comments on commit 87ed190

Please sign in to comment.