Skip parameters that are being deprecated (#35319)

* Skip parameters that are being deprecated

So in most cases when parameters are deprecated, you may not want to
advertise them in the documentation. One reason for this is because
these parameters were not introduced within Ansible but predate
upstreaming them.

So this change avoids reporting parameters that are not documented and
are deprecated. It's only a small subset of the existing E322 errors.

* Add support for E323 with these changes

* Unsure about the other issues now

* Add better error message with E321

* Restore some erroneously remove files

* Readd false positives to ignore.txt
This commit is contained in:
Dag Wieers 2018-01-25 18:10:49 +01:00 committed by Matt Martz
parent ed082af8c9
commit 417accf88d
2 changed files with 10 additions and 55 deletions

View file

@ -34,40 +34,20 @@ lib/ansible/modules/cloud/amazon/s3_lifecycle.py E322
lib/ansible/modules/cloud/amazon/s3_sync.py E322
lib/ansible/modules/cloud/amazon/sts_assume_role.py E317
lib/ansible/modules/cloud/atomic/atomic_container.py E317
lib/ansible/modules/cloud/azure/azure_rm_acs.py E322
lib/ansible/modules/cloud/azure/azure_rm_availabilityset.py E322
lib/ansible/modules/cloud/azure/azure_rm_availabilityset_facts.py E322
lib/ansible/modules/cloud/azure/azure_rm_containerinstance.py E322
lib/ansible/modules/cloud/azure/azure_rm_containerregistry.py E322
lib/ansible/modules/cloud/azure/azure_rm_deployment.py E322
lib/ansible/modules/cloud/azure/azure_rm_dnsrecordset.py E322
lib/ansible/modules/cloud/azure/azure_rm_dnsrecordset_facts.py E322
lib/ansible/modules/cloud/azure/azure_rm_dnszone.py E322
lib/ansible/modules/cloud/azure/azure_rm_dnszone_facts.py E322
lib/ansible/modules/cloud/azure/azure_rm_functionapp.py E322
lib/ansible/modules/cloud/azure/azure_rm_functionapp_facts.py E322
lib/ansible/modules/cloud/azure/azure_rm_image.py E322
lib/ansible/modules/cloud/azure/azure_rm_loadbalancer.py E322
lib/ansible/modules/cloud/azure/azure_rm_loadbalancer_facts.py E322
lib/ansible/modules/cloud/azure/azure_rm_managed_disk.py E322
lib/ansible/modules/cloud/azure/azure_rm_managed_disk_facts.py E322
lib/ansible/modules/cloud/azure/azure_rm_mysqldatabase.py E322
lib/ansible/modules/cloud/azure/azure_rm_mysqlserver.py E322
lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py E322
lib/ansible/modules/cloud/azure/azure_rm_networkinterface_facts.py E322
lib/ansible/modules/cloud/azure/azure_rm_postgresqldatabase.py E322
lib/ansible/modules/cloud/azure/azure_rm_postgresqlserver.py E322
lib/ansible/modules/cloud/azure/azure_rm_publicipaddress.py E322
lib/ansible/modules/cloud/azure/azure_rm_publicipaddress_facts.py E322
lib/ansible/modules/cloud/azure/azure_rm_resourcegroup.py E322
lib/ansible/modules/cloud/azure/azure_rm_resourcegroup_facts.py E322
lib/ansible/modules/cloud/azure/azure_rm_securitygroup.py E322
lib/ansible/modules/cloud/azure/azure_rm_securitygroup_facts.py E322
lib/ansible/modules/cloud/azure/azure_rm_sqlserver.py E322
lib/ansible/modules/cloud/azure/azure_rm_sqlserver_facts.py E322
lib/ansible/modules/cloud/azure/azure_rm_storageaccount.py E322
lib/ansible/modules/cloud/azure/azure_rm_storageaccount_facts.py E322
lib/ansible/modules/cloud/azure/azure_rm_storageblob.py E322
lib/ansible/modules/cloud/azure/azure_rm_storageblob.py E323
lib/ansible/modules/cloud/azure/azure_rm_subnet.py E322
lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py E322
@ -267,34 +247,6 @@ lib/ansible/modules/net_tools/ldap/ldap_attr.py E322
lib/ansible/modules/net_tools/omapi_host.py E317
lib/ansible/modules/net_tools/omapi_host.py E322
lib/ansible/modules/net_tools/snmp_facts.py E322
lib/ansible/modules/network/aci/aci_ap.py E322
lib/ansible/modules/network/aci/aci_bd.py E322
lib/ansible/modules/network/aci/aci_bd_subnet.py E322
lib/ansible/modules/network/aci/aci_bd_to_l3out.py E322
lib/ansible/modules/network/aci/aci_contract.py E322
lib/ansible/modules/network/aci/aci_contract_subject.py E322
lib/ansible/modules/network/aci/aci_contract_subject_to_filter.py E322
lib/ansible/modules/network/aci/aci_epg.py E322
lib/ansible/modules/network/aci/aci_epg_monitoring_policy.py E322
lib/ansible/modules/network/aci/aci_epg_to_contract.py E322
lib/ansible/modules/network/aci/aci_epg_to_domain.py E322
lib/ansible/modules/network/aci/aci_filter.py E322
lib/ansible/modules/network/aci/aci_interface_policy_fc.py E322
lib/ansible/modules/network/aci/aci_interface_policy_l2.py E322
lib/ansible/modules/network/aci/aci_interface_policy_lldp.py E322
lib/ansible/modules/network/aci/aci_interface_policy_mcp.py E322
lib/ansible/modules/network/aci/aci_interface_policy_port_channel.py E322
lib/ansible/modules/network/aci/aci_interface_policy_port_security.py E322
lib/ansible/modules/network/aci/aci_l3out_route_tag_policy.py E322
lib/ansible/modules/network/aci/aci_rest.py E322
lib/ansible/modules/network/aci/aci_taboo_contract.py E322
lib/ansible/modules/network/aci/aci_tenant.py E322
lib/ansible/modules/network/aci/aci_tenant_action_rule_profile.py E322
lib/ansible/modules/network/aci/aci_tenant_ep_retention_policy.py E322
lib/ansible/modules/network/aci/aci_tenant_span_dst_group.py E322
lib/ansible/modules/network/aci/aci_tenant_span_src_group.py E322
lib/ansible/modules/network/aci/aci_tenant_span_src_group_to_dst_group.py E322
lib/ansible/modules/network/aci/aci_vrf.py E322
lib/ansible/modules/network/cloudengine/ce_aaa_server.py E322
lib/ansible/modules/network/cloudengine/ce_aaa_server_host.py E322
lib/ansible/modules/network/cloudengine/ce_acl.py E322
@ -371,8 +323,6 @@ lib/ansible/modules/network/cnos/cnos_rollback.py E323
lib/ansible/modules/network/cnos/cnos_showrun.py E323
lib/ansible/modules/network/cumulus/_cl_interface.py E322
lib/ansible/modules/network/dellos10/dellos10_command.py E322
lib/ansible/modules/network/dellos6/dellos6_command.py E322
lib/ansible/modules/network/dellos9/dellos9_command.py E322
lib/ansible/modules/network/enos/enos_command.py E323
lib/ansible/modules/network/enos/enos_config.py E323
lib/ansible/modules/network/enos/enos_facts.py E323

View file

@ -1011,11 +1011,11 @@ class ModuleValidator(Validator):
try:
spec, args, kwargs = get_argument_spec(self.path)
except AnsibleModuleImportError:
except AnsibleModuleImportError as e:
self.reporter.error(
path=self.object_path,
code=321,
msg='Exception attempting to import module for argument_spec introspection'
msg="Exception attempting to import module for argument_spec introspection, '%s'" % e
)
self.reporter.trace(
path=self.object_path,
@ -1025,9 +1025,14 @@ class ModuleValidator(Validator):
provider_args = set()
args_from_argspec = set()
deprecated_args_from_argspec = set()
for arg, data in spec.items():
args_from_argspec.add(arg)
args_from_argspec.update(data.get('aliases', []))
if not data.get('removed_in_version', None):
args_from_argspec.add(arg)
args_from_argspec.update(data.get('aliases', []))
else:
deprecated_args_from_argspec.add(arg)
deprecated_args_from_argspec.update(data.get('aliases', []))
if arg == 'provider' and self.object_path.startswith('lib/ansible/modules/network/'):
# Record provider options from network modules, for later comparison
for provider_arg, provider_data in data.get('options', {}).items():
@ -1061,7 +1066,7 @@ class ModuleValidator(Validator):
args_from_docs.update(data.get('aliases', []))
args_missing_from_docs = args_from_argspec.difference(args_from_docs)
docs_missing_from_args = args_from_docs.difference(args_from_argspec)
docs_missing_from_args = args_from_docs.difference(args_from_argspec | deprecated_args_from_argspec)
for arg in args_missing_from_docs:
# args_from_argspec contains undocumented argument
if kwargs.get('add_file_common_args', False) and arg in file_common_arguments: