From 9495ddbc21da2a5c7967f01c4a958d32f203af65 Mon Sep 17 00:00:00 2001 From: Dag Wieers Date: Tue, 16 Apr 2019 14:13:24 +0200 Subject: [PATCH] ACI: Cleanup deprecated boolean behaviour (#55207) * ACI: Cleanup deprecated boolean behaviour * Remove from sanity ignore list --- lib/ansible/module_utils/network/aci/aci.py | 17 ----------------- .../modules/network/aci/aci_epg_to_domain.py | 2 +- .../network/aci/aci_interface_policy_l2.py | 2 +- .../network/aci/aci_interface_policy_lldp.py | 4 ++-- .../network/aci/aci_interface_policy_mcp.py | 2 +- .../network/aci/aci_tenant_span_src_group.py | 2 +- test/sanity/validate-modules/ignore.txt | 5 ----- 7 files changed, 6 insertions(+), 28 deletions(-) diff --git a/lib/ansible/module_utils/network/aci/aci.py b/lib/ansible/module_utils/network/aci/aci.py index bb58f12a938..215d1fbfbc9 100644 --- a/lib/ansible/module_utils/network/aci/aci.py +++ b/lib/ansible/module_utils/network/aci/aci.py @@ -141,23 +141,6 @@ class ACIModule(object): elif value is False: return false - # When we expect value is of type=raw, deprecate in Ansible v2.8 (and all modules use type=bool) - try: - # This supports all Ansible boolean types - bool_value = boolean(value) - if bool_value is True: - return true - elif bool_value is False: - return false - except Exception: - # This provides backward compatibility to Ansible v2.4, deprecate in Ansible v2.8 - if value == true: - self.module.deprecate("Boolean value '%s' is no longer valid, please use 'yes' as a boolean value." % value, '2.9') - return true - elif value == false: - self.module.deprecate("Boolean value '%s' is no longer valid, please use 'no' as a boolean value." % value, '2.9') - return false - # If all else fails, escalate back to user self.module.fail_json(msg="Boolean value '%s' is an invalid ACI boolean value.") diff --git a/lib/ansible/modules/network/aci/aci_epg_to_domain.py b/lib/ansible/modules/network/aci/aci_epg_to_domain.py index 24aeb883cf1..286d2a7c5c3 100644 --- a/lib/ansible/modules/network/aci/aci_epg_to_domain.py +++ b/lib/ansible/modules/network/aci/aci_epg_to_domain.py @@ -297,7 +297,7 @@ def main(): encap=dict(type='int'), encap_mode=dict(type='str', choices=['auto', 'vlan', 'vxlan']), epg=dict(type='str', aliases=['name', 'epg_name']), # Not required for querying all objects - netflow=dict(type='raw'), # Turn into a boolean in v2.9 + netflow=dict(type='bool'), primary_encap=dict(type='int'), resolution_immediacy=dict(type='str', choices=['immediate', 'lazy', 'pre-provision']), state=dict(type='str', default='present', choices=['absent', 'present', 'query']), diff --git a/lib/ansible/modules/network/aci/aci_interface_policy_l2.py b/lib/ansible/modules/network/aci/aci_interface_policy_l2.py index ac151c3e26f..96b8b6c81ee 100644 --- a/lib/ansible/modules/network/aci/aci_interface_policy_l2.py +++ b/lib/ansible/modules/network/aci/aci_interface_policy_l2.py @@ -196,7 +196,7 @@ def main(): description=dict(type='str', aliases=['descr']), vlan_scope=dict(type='str', choices=['global', 'portlocal']), # No default provided on purpose qinq=dict(type='str', choices=['core', 'disabled', 'edge']), - vepa=dict(type='raw'), # Turn into a boolean in v2.9 + vepa=dict(type='bool'), state=dict(type='str', default='present', choices=['absent', 'present', 'query']), ) diff --git a/lib/ansible/modules/network/aci/aci_interface_policy_lldp.py b/lib/ansible/modules/network/aci/aci_interface_policy_lldp.py index 490144e5b85..b465c394617 100644 --- a/lib/ansible/modules/network/aci/aci_interface_policy_lldp.py +++ b/lib/ansible/modules/network/aci/aci_interface_policy_lldp.py @@ -182,8 +182,8 @@ def main(): argument_spec.update( lldp_policy=dict(type='str', aliases=['name']), # Not required for querying all objects description=dict(type='str', aliases=['descr']), - receive_state=dict(type='raw'), # Turn into a boolean in v2.9 - transmit_state=dict(type='raw'), # Turn into a boolean in v2.9 + receive_state=dict(type='bool'), + transmit_state=dict(type='bool'), state=dict(type='str', default='present', choices=['absent', 'present', 'query']), ) diff --git a/lib/ansible/modules/network/aci/aci_interface_policy_mcp.py b/lib/ansible/modules/network/aci/aci_interface_policy_mcp.py index 529e5af455e..5e1ed7f7e8b 100644 --- a/lib/ansible/modules/network/aci/aci_interface_policy_mcp.py +++ b/lib/ansible/modules/network/aci/aci_interface_policy_mcp.py @@ -176,7 +176,7 @@ def main(): argument_spec.update( mcp=dict(type='str', aliases=['mcp_interface', 'name']), # Not required for querying all objects description=dict(type='str', aliases=['descr']), - admin_state=dict(type='raw'), # Turn into a boolean in v2.9 + admin_state=dict(type='bool'), state=dict(type='str', default='present', choices=['absent', 'present', 'query']), ) diff --git a/lib/ansible/modules/network/aci/aci_tenant_span_src_group.py b/lib/ansible/modules/network/aci/aci_tenant_span_src_group.py index 64ef878b717..01544da92c1 100644 --- a/lib/ansible/modules/network/aci/aci_tenant_span_src_group.py +++ b/lib/ansible/modules/network/aci/aci_tenant_span_src_group.py @@ -189,7 +189,7 @@ def main(): argument_spec.update( tenant=dict(type='str', aliases=['tenant_name']), # Not required for querying all objects src_group=dict(type='str', aliases=['name']), # Not required for querying all objects - admin_state=dict(type='raw'), # Turn into a boolean in v2.9 + admin_state=dict(type='bool'), description=dict(type='str', aliases=['descr']), dst_group=dict(type='str'), state=dict(type='str', default='present', choices=['absent', 'present', 'query']), diff --git a/test/sanity/validate-modules/ignore.txt b/test/sanity/validate-modules/ignore.txt index 13794824ee9..4db0dc83f35 100644 --- a/test/sanity/validate-modules/ignore.txt +++ b/test/sanity/validate-modules/ignore.txt @@ -397,11 +397,6 @@ lib/ansible/modules/net_tools/basics/uri.py E323 lib/ansible/modules/net_tools/basics/uri.py E326 lib/ansible/modules/network/a10/a10_server_axapi3.py E326 lib/ansible/modules/network/a10/a10_virtual_server.py E324 -lib/ansible/modules/network/aci/aci_epg_to_domain.py E325 -lib/ansible/modules/network/aci/aci_interface_policy_l2.py E325 -lib/ansible/modules/network/aci/aci_interface_policy_lldp.py E325 -lib/ansible/modules/network/aci/aci_interface_policy_mcp.py E325 -lib/ansible/modules/network/aci/aci_tenant_span_src_group.py E325 lib/ansible/modules/network/asa/asa_config.py E324 lib/ansible/modules/network/asa/asa_config.py E335 lib/ansible/modules/network/bigswitch/bigmon_policy.py E324