ansible-collections / netapp.ontap

Ansible collection to support NetApp ONTAP configuration.
https://galaxy.ansible.com/netapp/ontap
GNU General Public License v3.0
56 stars 36 forks source link

na_ontap_autosupport fails enabling support on ONTAP 9.11 #71

Closed darksoul42 closed 2 years ago

darksoul42 commented 2 years ago

Summary

When trying to enable support on a recent OnTAP 9.11 node, I get a TypeError from get_modified_attributes in plugins/module_utils/netapp_module.py TypeError: TypeError("'>' not supported between instances of 'str' and 'bool'",), key: support, value: 'enable', desired: True

Component Name

na_ontap_autosupport

Ansible Version

$ ansible --version
ansible [core 2.11.2]
  config file = /home/users/.../.ansible.cfg
  configured module search path = ['/home/users/.../.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/server_config/lib64/python3.6/site-packages/ansible
  ansible collection location = /home/users/.../.ansible/collections:/usr/share/ansible/collections
  executable location = /opt/server_config/bin/ansible
  python version = 3.6.3 (default, Apr 10 2019, 14:37:36) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]
  jinja version = 2.10.1
  libyaml = True

ONTAP Collection Version

$ ansible-galaxy collection list
# /opt/server_config/lib64/python3.6/site-packages/ansible_collections
Collection                    Version
----------------------------- -------
amazon.aws                    1.5.0
ansible.netcommon             2.2.0
ansible.posix                 1.2.0
ansible.utils                 2.3.0
ansible.windows               1.7.0
arista.eos                    2.2.0
awx.awx                       19.2.2
azure.azcollection            1.7.0
check_point.mgmt              2.0.0
chocolatey.chocolatey         1.1.0
cisco.aci                     2.0.0
cisco.asa                     2.0.2
cisco.intersight              1.0.15
cisco.ios                     2.3.0
cisco.iosxr                   2.3.0
cisco.meraki                  2.4.2
cisco.mso                     1.2.0
cisco.nso                     1.0.3
cisco.nxos                    2.4.0
cisco.ucs                     1.6.0
cloudscale_ch.cloud           2.2.0
community.aws                 1.5.0
community.azure               1.0.0
community.crypto              1.7.1
community.digitalocean        1.7.0
community.docker              1.8.0
community.fortios             1.0.0
community.general             3.3.0
community.google              1.0.0
community.grafana             1.2.1
community.hashi_vault         1.3.0
community.hrobot              1.1.1
community.kubernetes          1.2.1
community.kubevirt            1.0.0
community.libvirt             1.0.1
community.mongodb             1.2.1
community.mysql               2.1.0
community.network             3.0.0
community.okd                 1.1.2
community.postgresql          1.3.0
community.proxysql            1.0.0
community.rabbitmq            1.0.3
community.routeros            1.2.0
community.skydive             1.0.0
community.sops                1.1.0
community.vmware              1.11.0
community.windows             1.5.0
community.zabbix              1.3.0
containers.podman             1.6.1
cyberark.conjur               1.1.0
cyberark.pas                  1.0.7
dellemc.enterprise_sonic      1.1.0
dellemc.openmanage            3.5.0
dellemc.os10                  1.1.1
dellemc.os6                   1.0.7
dellemc.os9                   1.0.4
f5networks.f5_modules         1.10.1
fortinet.fortimanager         2.1.2
fortinet.fortios              2.1.1
frr.frr                       1.0.3
gluster.gluster               1.0.1
google.cloud                  1.0.2
hetzner.hcloud                1.4.3
hpe.nimble                    1.1.3
ibm.qradar                    1.0.3
infinidat.infinibox           1.2.4
inspur.sm                     1.2.0
junipernetworks.junos         2.3.0
kubernetes.core               1.2.1
mellanox.onyx                 1.0.0
netapp.aws                    21.2.0
netapp.azure                  21.7.0
netapp.cloudmanager           21.7.0
netapp.elementsw              21.6.1
netapp.ontap                  21.7.0
netapp.um_info                21.6.0
netapp_eseries.santricity     1.2.13
netbox.netbox                 3.1.1
ngine_io.cloudstack           2.1.0
ngine_io.exoscale             1.0.0
ngine_io.vultr                1.1.0
openstack.cloud               1.5.0
openvswitch.openvswitch       2.0.0
ovirt.ovirt                   1.5.3
purestorage.flasharray        1.8.0
purestorage.flashblade        1.6.0
sensu.sensu_go                1.11.1
servicenow.servicenow         1.0.6
splunk.es                     1.0.2
t_systems_mms.icinga_director 1.18.0
theforeman.foreman            2.1.1
vyos.vyos                     2.3.1
wti.remote                    1.0.1

ONTAP Version

ontap11-system::> version
NetApp Release 9.11.1RC1: Wed Apr 27 06:57:10 UTC 2022

Playbook

- name: Configure AutoSupport
  na_ontap_autosupport:
    state: present
    hostname: "{{ cluster_config.address }}"
    username: admin
    password: "{{ admin_password }}"
    proxy_url: "{{ proxy_url }}"
    support: True
    mail_hosts: "{{ mail_hosts }}"
    from_address: "{{ from_address }}"
    to_addresses: "{{ to_addresses }}"
    noteto: "{{ noteto_address }}"
    transport: https
    node_name: "{{ node }}"
  loop: "{{ node_list }}"
  loop_control:
    loop_var: node
  delegate_to: localhost
  tags:
    - autosupport_config

Steps to Reproduce

$ /opt/server_config/bin/ansible-playbook -c local -m na_ontap_support -a 'state=present support=True hostname=ontap11-system.mydomain username=admin password=mypassword transport=https validate_certs=False node_name=ontap11-system-01' 'localhost' -D -C

Expected Results

On an older version of ONTAP I would expect this to return a SUCCESS or CHANGED, and the command to return the current state of configuration. However, on ONTAP 9.11.1 it seems that the support current value is returned as a string 'enable', and not interpreted as boolean 'True'. This probably stems from ONTAP changing the way they return this value now.

Actual Results

localhost | FAILED! => {
    "changed": false,
    "module_stderr": "/opt/server_config/lib64/python3.6/site-packages/urllib3/connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host 'ontap11-system.mydomain'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n  InsecureRequestWarning,\n/opt/server_config/lib64/python3.6/site-packages/urllib3/connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host 'ontap11-system.mydomain'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n  InsecureRequestWarning,\nTraceback (most recent call last):\n  File \"/tmp/ansible_na_ontap_autosupport_payload_qxep8z7y/ansible_na_ontap_autosupport_payload.zip/ansible_collections/netapp/ontap/plugins/module_utils/netapp_module.py\", line 292, in get_modified_attributes\n  File \"/tmp/ansible_na_ontap_autosupport_payload_qxep8z7y/ansible_na_ontap_autosupport_payload.zip/ansible_collections/netapp/ontap/plugins/module_utils/netapp_module.py\", line 59, in cmp\nTypeError: '>' not supported between instances of 'str' and 'bool'\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/home/users/myuser/.ansible/tmp/ansible-tmp-1654057515.9916222-72543-99218988876789/AnsiballZ_na_ontap_autosupport.py\", line 100, in <module>\n    _ansiballz_main()\n  File \"/home/users/myuser/.ansible/tmp/ansible-tmp-1654057515.9916222-72543-99218988876789/AnsiballZ_na_ontap_autosupport.py\", line 92, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/users/myuser/.ansible/tmp/ansible-tmp-1654057515.9916222-72543-99218988876789/AnsiballZ_na_ontap_autosupport.py\", line 41, in invoke_module\n    run_name='__main__', alter_sys=True)\n  File \"/opt/rh/rh-python36/root/lib64/python3.6/runpy.py\", line 205, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/opt/rh/rh-python36/root/lib64/python3.6/runpy.py\", line 96, in _run_module_code\n    mod_name, mod_spec, pkg_name, script_name)\n  File \"/opt/rh/rh-python36/root/lib64/python3.6/runpy.py\", line 85, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_na_ontap_autosupport_payload_qxep8z7y/ansible_na_ontap_autosupport_payload.zip/ansible_collections/netapp/ontap/plugins/modules/na_ontap_autosupport.py\", line 456, in <module>\n  File \"/tmp/ansible_na_ontap_autosupport_payload_qxep8z7y/ansible_na_ontap_autosupport_payload.zip/ansible_collections/netapp/ontap/plugins/modules/na_ontap_autosupport.py\", line 452, in main\n  File \"/tmp/ansible_na_ontap_autosupport_payload_qxep8z7y/ansible_na_ontap_autosupport_payload.zip/ansible_collections/netapp/ontap/plugins/modules/na_ontap_autosupport.py\", line 442, in apply\n  File \"/tmp/ansible_na_ontap_autosupport_payload_qxep8z7y/ansible_na_ontap_autosupport_payload.zip/ansible_collections/netapp/ontap/plugins/module_utils/netapp_module.py\", line 294, in get_modified_attributes\nTypeError: TypeError(\"'>' not supported between instances of 'str' and 'bool'\",), key: support, value: 'enable', desired: True\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}
lonico commented 2 years ago

JIRA 5137

darksoul42 commented 2 years ago

Just noticed this was actually of the same nature as #50.