Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] validate-modules: 'choices' disable string conversion #56892

Open
wants to merge 5 commits into
base: devel
from

Conversation

Projects
None yet
4 participants
@pilou-
Copy link
Contributor

commented May 24, 2019

SUMMARY

validate-modules sanity check:

  • disable string conversion
  • allow to explicitly use None in choices

Fix E328 errors:

  • azure_rm_manageddisk: zone param: values are str
  • clc_loadbalancer: port parameter is an int
  • yum_repository: ip_resolve parameter: fix doc (values are strings)
  • os_security_group_rule.py: protocol parameter: None (Python)/null (YAML)
ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

validate-modules

ADDITIONAL INFORMATION

pilou- added some commits May 23, 2019

[validate-modules] choices: disable string conversion
This applies both to values mentioned in documentation and to values
mentioned in argument_spec.
azure_rm_manageddisk: values for 'zone' parameter are str
Fix sanity error:

    E328 Argument 'zone' in documentation defines choices as (1) but this is incompatible with argument type 'str'
clc_loadbalancer: port parameter is an int
Fix validate-modules error:

    E328 Argument 'port' in documentation defines choices as (80) but this is incompatible with argument type 'str'

clc documentation states that 'port' is an integer:
https://github.com/CenturyLinkCloud/APIDocs/blob/master/Shared%20Load%20Balancers/get-shared-load-balancer.md#pools-definition
yum_repository: 'ip_resolve' is str, fix doc
Fix validate-modules error:

    E328 Argument 'ip_resolve' in documentation defines choices as (4) but this is incompatible with argument type 'str'
@ansibot

This comment has been minimized.

Copy link
Contributor

commented May 24, 2019

@pilou-, just so you are aware we have a dedicated Working Group for azure.
You can find other people interested in this in #ansible-azure on Freenode IRC
For more information about communities, meetings and agendas see https://github.com/ansible/community

click here for bot help

@ansibot

This comment has been minimized.

Copy link
Contributor

commented May 24, 2019

The test ansible-test sanity --test validate-modules [explain] failed with 81 errors:

lib/ansible/modules/cloud/amazon/ec2_vol.py:0:0: E327 Argument 'iops' in documentation defines default as (100) but this is incompatible with parameter type 'str'
lib/ansible/modules/cloud/centurylink/clc_aa_policy.py:0:0: E329 Argument 'wait' in argument_spec defines default as (True) but this is incompatible with parameter type 'str'
lib/ansible/modules/cloud/centurylink/clc_blueprint_package.py:0:0: E329 Argument 'wait' in argument_spec defines default as (True) but this is incompatible with parameter type 'str'
lib/ansible/modules/cloud/centurylink/clc_firewall_policy.py:0:0: E329 Argument 'enabled' in argument_spec defines default as (True) but this is incompatible with parameter type 'str'
lib/ansible/modules/cloud/centurylink/clc_firewall_policy.py:0:0: E329 Argument 'wait' in argument_spec defines default as (True) but this is incompatible with parameter type 'str'
lib/ansible/modules/cloud/centurylink/clc_server_snapshot.py:0:0: E329 Argument 'wait' in argument_spec defines default as (True) but this is incompatible with parameter type 'str'
lib/ansible/modules/cloud/google/gce_pd.py:0:0: E329 Argument 'size_gb' in argument_spec defines default as (10) but this is incompatible with parameter type 'str'
lib/ansible/modules/cloud/misc/ovirt.py:0:0: E329 Argument 'instance_cores' in argument_spec defines default as (1) but this is incompatible with parameter type 'str'
lib/ansible/modules/cloud/misc/ovirt.py:0:0: E329 Argument 'instance_cpus' in argument_spec defines default as (1) but this is incompatible with parameter type 'str'
lib/ansible/modules/cloud/misc/proxmox.py:0:0: E327 Argument 'disk' in documentation defines default as (3) but this is incompatible with parameter type 'str'
lib/ansible/modules/cloud/openstack/os_ironic_node.py:0:0: E329 Argument 'deploy' in argument_spec defines default as (True) but this is incompatible with parameter type 'str'
lib/ansible/modules/cloud/openstack/os_server.py:0:0: E327 Argument 'flavor' in documentation defines default as (1) but this is incompatible with parameter type 'str'
lib/ansible/modules/cloud/openstack/os_subnet.py:0:0: E327 Argument 'ip_version' in documentation defines default as (4) but this is incompatible with parameter type 'str'
lib/ansible/modules/cloud/ovirt/ovirt_external_provider.py:0:0: E327 Argument 'network_type' in documentation defines default as (['external']) but this is incompatible with parameter type 'str'
lib/ansible/modules/database/mongodb/mongodb_user.py:0:0: E327 Argument 'login_port' in documentation defines default as (27017) but this is incompatible with parameter type 'str'
lib/ansible/modules/database/mssql/mssql_db.py:0:0: E327 Argument 'login_port' in documentation defines default as (1433) but this is incompatible with parameter type 'str'
lib/ansible/modules/database/vertica/vertica_configuration.py:0:0: E327 Argument 'port' in documentation defines default as (5433) but this is incompatible with parameter type 'str'
lib/ansible/modules/database/vertica/vertica_facts.py:0:0: E327 Argument 'port' in documentation defines default as (5433) but this is incompatible with parameter type 'str'
lib/ansible/modules/database/vertica/vertica_role.py:0:0: E327 Argument 'port' in documentation defines default as (5433) but this is incompatible with parameter type 'str'
lib/ansible/modules/database/vertica/vertica_schema.py:0:0: E327 Argument 'port' in documentation defines default as (5433) but this is incompatible with parameter type 'str'
lib/ansible/modules/database/vertica/vertica_user.py:0:0: E327 Argument 'port' in documentation defines default as (5433) but this is incompatible with parameter type 'str'
lib/ansible/modules/monitoring/bigpanda.py:0:0: E329 Argument 'hosts' in argument_spec defines default as (['8b6917edde1a']) but this is incompatible with parameter type 'str'
lib/ansible/modules/monitoring/pagerduty.py:0:0: E327 Argument 'hours' in documentation defines default as (1) but this is incompatible with parameter type 'str'
lib/ansible/modules/net_tools/infinity/infinity.py:0:0: E327 Argument 'network_family' in documentation defines default as (4) but this is incompatible with parameter type 'str'
lib/ansible/modules/network/cloudengine/ce_info_center_global.py:0:0: E327 Argument 'logfile_max_size' in documentation defines default as (32) but this is incompatible with parameter type 'str'
lib/ansible/modules/network/cloudengine/ce_netstream_aging.py:0:0: E327 Argument 'timeout_interval' in documentation defines default as (30) but this is incompatible with parameter type 'str'
lib/ansible/modules/network/cnos/cnos_logging.py:0:0: E327 Argument 'level' in documentation defines default as (5) but this is incompatible with parameter type 'str'
lib/ansible/modules/network/cnos/cnos_static_route.py:0:0: E327 Argument 'admin_distance' in documentation defines default as (1) but this is incompatible with parameter type 'str'
lib/ansible/modules/network/fortimanager/fmgr_fwobj_address.py:0:0: E329 Argument 'color' in argument_spec defines default as (22) but this is incompatible with parameter type 'str'
lib/ansible/modules/network/illumos/dladm_vlan.py:0:0: E327 Argument 'vlan_id' in documentation defines default as (False) but this is incompatible with parameter type 'str'
lib/ansible/modules/network/illumos/dladm_vnic.py:0:0: E327 Argument 'mac' in documentation defines default as (False) but this is incompatible with parameter type 'str'
lib/ansible/modules/network/illumos/dladm_vnic.py:0:0: E327 Argument 'vlan' in documentation defines default as (False) but this is incompatible with parameter type 'str'
lib/ansible/modules/network/junos/junos_linkagg.py:0:0: E327 Argument 'mode' in documentation defines default as (False) but this is incompatible with parameter type 'str'
lib/ansible/modules/network/nxos/nxos_hsrp.py:0:0: E327 Argument 'version' in documentation defines default as (1) but this is incompatible with parameter type 'str'
lib/ansible/modules/network/nxos/nxos_snmp_host.py:0:0: E327 Argument 'udp' in documentation defines default as (162) but this is incompatible with parameter type 'str'
lib/ansible/modules/network/nxos/nxos_vrrp.py:0:0: E327 Argument 'interval' in documentation defines default as (1) but this is incompatible with parameter type 'str'
lib/ansible/modules/network/nxos/nxos_vrrp.py:0:0: E327 Argument 'priority' in documentation defines default as (100) but this is incompatible with parameter type 'str'
lib/ansible/modules/network/onyx/onyx_linkagg.py:0:0: E327 Argument 'mode' in documentation defines default as (True) but this is incompatible with parameter type 'str'
lib/ansible/modules/network/panos/_panos_commit.py:0:0: E329 Argument 'interval' in argument_spec defines default as (0.5) but this is incompatible with parameter type 'str'
lib/ansible/modules/notification/cisco_spark.py:0:0: E329 Argument 'message_type' in argument_spec defines default as (['text']) but this is incompatible with parameter type 'str'
lib/ansible/modules/packaging/os/yum_repository.py:0:0: E327 Argument 'cost' in documentation defines default as (1000) but this is incompatible with parameter type 'str'
lib/ansible/modules/packaging/os/yum_repository.py:0:0: E327 Argument 'deltarpm_metadata_percentage' in documentation defines default as (100) but this is incompatible with parameter type 'str'
lib/ansible/modules/packaging/os/yum_repository.py:0:0: E327 Argument 'deltarpm_percentage' in documentation defines default as (75) but this is incompatible with parameter type 'str'
lib/ansible/modules/packaging/os/yum_repository.py:0:0: E327 Argument 'metadata_expire' in documentation defines default as (21600) but this is incompatible with parameter type 'str'
lib/ansible/modules/packaging/os/yum_repository.py:0:0: E327 Argument 'mirrorlist_expire' in documentation defines default as (21600) but this is incompatible with parameter type 'str'
lib/ansible/modules/packaging/os/yum_repository.py:0:0: E327 Argument 'priority' in documentation defines default as (99) but this is incompatible with parameter type 'str'
lib/ansible/modules/packaging/os/yum_repository.py:0:0: E327 Argument 'retries' in documentation defines default as (10) but this is incompatible with parameter type 'str'
lib/ansible/modules/packaging/os/yum_repository.py:0:0: E327 Argument 'timeout' in documentation defines default as (30) but this is incompatible with parameter type 'str'
lib/ansible/modules/remote_management/ucs/ucs_disk_group_policy.py:0:0: E327 Argument 'num_drives' in documentation defines default as (1) but this is incompatible with parameter type 'str'
lib/ansible/modules/storage/netapp/netapp_e_alerts.py:0:0: E327 Argument 'ssid' in documentation defines default as (1) but this is incompatible with parameter type 'str'
lib/ansible/modules/storage/netapp/netapp_e_amg.py:0:0: E327 Argument 'ssid' in documentation defines default as (1) but this is incompatible with parameter type 'str'
lib/ansible/modules/storage/netapp/netapp_e_asup.py:0:0: E327 Argument 'ssid' in documentation defines default as (1) but this is incompatible with parameter type 'str'
lib/ansible/modules/storage/netapp/netapp_e_auditlog.py:0:0: E327 Argument 'ssid' in documentation defines default as (1) but this is incompatible with parameter type 'str'
lib/ansible/modules/storage/netapp/netapp_e_global.py:0:0: E327 Argument 'ssid' in documentation defines default as (1) but this is incompatible with parameter type 'str'
lib/ansible/modules/storage/netapp/netapp_e_host.py:0:0: E327 Argument 'ssid' in documentation defines default as (1) but this is incompatible with parameter type 'str'
lib/ansible/modules/storage/netapp/netapp_e_hostgroup.py:0:0: E329 Argument 'validate_certs' in argument_spec defines default as (True) but this is incompatible with parameter type 'str'
lib/ansible/modules/storage/netapp/netapp_e_iscsi_interface.py:0:0: E327 Argument 'ssid' in documentation defines default as (1) but this is incompatible with parameter type 'str'
lib/ansible/modules/storage/netapp/netapp_e_iscsi_target.py:0:0: E327 Argument 'ssid' in documentation defines default as (1) but this is incompatible with parameter type 'str'
lib/ansible/modules/storage/netapp/netapp_e_ldap.py:0:0: E327 Argument 'ssid' in documentation defines default as (1) but this is incompatible with parameter type 'str'
lib/ansible/modules/storage/netapp/netapp_e_lun_mapping.py:0:0: E327 Argument 'ssid' in documentation defines default as (1) but this is incompatible with parameter type 'str'
lib/ansible/modules/storage/netapp/netapp_e_mgmt_interface.py:0:0: E327 Argument 'ssid' in documentation defines default as (1) but this is incompatible with parameter type 'str'
lib/ansible/modules/storage/netapp/netapp_e_snapshot_images.py:0:0: E329 Argument 'validate_certs' in argument_spec defines default as (True) but this is incompatible with parameter type 'str'
lib/ansible/modules/storage/netapp/netapp_e_storagepool.py:0:0: E327 Argument 'ssid' in documentation defines default as (1) but this is incompatible with parameter type 'str'
lib/ansible/modules/storage/netapp/netapp_e_syslog.py:0:0: E327 Argument 'ssid' in documentation defines default as (1) but this is incompatible with parameter type 'str'
lib/ansible/modules/storage/netapp/netapp_e_volume_copy.py:0:0: E327 Argument 'ssid' in documentation defines default as (1) but this is incompatible with parameter type 'str'
lib/ansible/modules/storage/netapp/netapp_e_volume_copy.py:0:0: E329 Argument 'validate_certs' in argument_spec defines default as (True) but this is incompatible with parameter type 'str'
lib/ansible/modules/system/lvg.py:0:0: E329 Argument 'pesize' in argument_spec defines default as (4) but this is incompatible with parameter type 'str'
lib/ansible/modules/system/open_iscsi.py:0:0: E329 Argument 'port' in argument_spec defines default as (3260) but this is incompatible with parameter type 'str'
test/sanity/validate-modules/ignore.txt:36:1: A102 Remove since "lib/ansible/modules/cloud/amazon/ec2_vol.py" passes "E324" test
test/sanity/validate-modules/ignore.txt:87:1: A102 Remove since "lib/ansible/modules/cloud/centurylink/clc_aa_policy.py" passes "E335" test
test/sanity/validate-modules/ignore.txt:89:1: A102 Remove since "lib/ansible/modules/cloud/centurylink/clc_blueprint_package.py" passes "E335" test
test/sanity/validate-modules/ignore.txt:91:1: A102 Remove since "lib/ansible/modules/cloud/centurylink/clc_firewall_policy.py" passes "E324" test
test/sanity/validate-modules/ignore.txt:93:1: A102 Remove since "lib/ansible/modules/cloud/centurylink/clc_firewall_policy.py" passes "E335" test
test/sanity/validate-modules/ignore.txt:94:1: A102 Remove since "lib/ansible/modules/cloud/centurylink/clc_server_snapshot.py" passes "E335" test
test/sanity/validate-modules/ignore.txt:197:1: A102 Remove since "lib/ansible/modules/cloud/ovirt/ovirt_external_provider.py" passes "E324" test
test/sanity/validate-modules/ignore.txt:513:1: A102 Remove since "lib/ansible/modules/network/illumos/dladm_vlan.py" passes "E324" test
test/sanity/validate-modules/ignore.txt:514:1: A102 Remove since "lib/ansible/modules/network/illumos/dladm_vnic.py" passes "E324" test
test/sanity/validate-modules/ignore.txt:534:1: A102 Remove since "lib/ansible/modules/network/junos/junos_linkagg.py" passes "E324" test
test/sanity/validate-modules/ignore.txt:594:1: A102 Remove since "lib/ansible/modules/network/onyx/onyx_linkagg.py" passes "E324" test
test/sanity/validate-modules/ignore.txt:623:1: A102 Remove since "lib/ansible/modules/notification/cisco_spark.py" passes "E324" test
test/sanity/validate-modules/ignore.txt:769:1: A102 Remove since "lib/ansible/modules/storage/netapp/netapp_e_volume_copy.py" passes "E335" test

click here for bot help

@ansibot ansibot added needs_revision and removed core_review labels May 24, 2019

@opendev-zuul

This comment has been minimized.

Copy link

commented May 24, 2019

Build succeeded (third-party-check pipeline).

@pilou- pilou- changed the title validate-modules: 'choices' disable string conversion [WIP] validate-modules: 'choices' disable string conversion May 24, 2019

@ansibot ansibot added the WIP label May 24, 2019

@bcoca bcoca requested a review from mattclay May 28, 2019

@bcoca bcoca removed the needs_triage label May 28, 2019

@bcoca bcoca requested a review from sivel May 28, 2019

@s-hertel

This comment has been minimized.

Copy link
Contributor

commented May 28, 2019

I like this but it seems like it will break any third party modules using null as a choice and relying on it being a string. It looks like there are other cases in the repo as well, like ansible/lib/ansible/modules/network/fortios/fortios_vpn_ipsec_manualkey_interface.py.

@ansibot ansibot added the stale_ci label Jun 5, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.