ansible-collections / ibm.spectrum_virtualize

IBM Spectrum Virtualize
GNU General Public License v3.0
21 stars 26 forks source link

Python error when creating resources #86

Closed abhirams-1 closed 1 year ago

abhirams-1 commented 1 year ago
SUMMARY

When trying to create resources (user, volume, host, hostvdiskmap, etc.) the tasks fail with Python error. Despite errors, the resources are created, as evident when listing. The error appears to originate in _svc_rest method in ibm_svc_utils.py plugin as suggested by the log output.

ISSUE TYPE
COMPONENT NAME

ibm_svc_utils.py, ibm_svc_manage_user, ibm_svc_vdisk, ibm_svc_host, ibm_svc_vol_map

ANSIBLE VERSION
ansible [core 2.13.7]
  config file = xxxx
  configured module search path = ['xxxx']
  ansible python module location = /usr/lib/python3.8/site-packages/ansible
  ansible collection location = xxxx
  executable location = /usr/bin/ansible
  python version = 3.8.10 (default, Feb  1 2023, 13:02:41) [GCC 7.5.0]
  jinja version = 3.0.3
  libyaml = True
COLLECTION VERSION
# /usr/lib/python3.8/site-packages/ansible_collections
Collection              Version
----------------------- -------
ibm.spectrum_virtualize 1.10.0
CONFIGURATION
CALLBACKS_ENABLED(xxxx/ansible.cfg) = ['profile_tasks', 'colo_log']
COLLECTIONS_PATHS(env: ANSIBLE_COLLECTIONS_PATH) = ['xxxx/playbooks/collections']
DEFAULT_CALLBACK_PLUGIN_PATH(xxxx/ansible.cfg) = ['/home/deployment_contain
DEFAULT_MODULE_PATH(env: ANSIBLE_LIBRARY) = ['xxxx/library']
LOCALHOST_WARNING(xxxx/ansible.cfg) = False
OS / ENVIRONMENT

IBM FlashSystem 9100 version 8.3.1.5 (build 150.27.2104221539000)

STEPS TO REPRODUCE
- name: "Ensure user {{ params.state }}"
      ibm.spectrum_virtualize.ibm_svc_manage_user:
        clustername: "{{ params.ip }}"
        token: "{{ auth_result.token }}"
        log_path: "{{ params.log_path }}"
        state: "{{ params.state }}"
        name: "{{ params.name }}"
        user_password: "{{ params.user_password }}"
        auth_type: "usergrp"
        usergroup: "{{ params.usergroup }}"
EXPECTED RESULTS

Expecting user to be created without any errors.

ACTUAL RESULTS

User was created, but module failed with error.

The full traceback is:
  File "/tmp/ansible_ibm.spectrum_virtualize.ibm_svc_manage_user_payload_vjtorsq9/ansible_ibm.spectrum_virtualize.ibm_svc_manage_user_payload.z
ip/ansible_collections/ibm/spectrum_virtualize/plugins/modules/ibm_svc_manage_user.py", line 378, in main
  File "/tmp/ansible_ibm.spectrum_virtualize.ibm_svc_manage_user_payload_vjtorsq9/ansible_ibm.spectrum_virtualize.ibm_svc_manage_user_payload.z
ip/ansible_collections/ibm/spectrum_virtualize/plugins/modules/ibm_svc_manage_user.py", line 354, in apply
  File "/tmp/ansible_ibm.spectrum_virtualize.ibm_svc_manage_user_payload_vjtorsq9/ansible_ibm.spectrum_virtualize.ibm_svc_manage_user_payload.z
ip/ansible_collections/ibm/spectrum_virtualize/plugins/modules/ibm_svc_manage_user.py", line 266, in create_user
fatal: [localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "auth_type": "usergrp",
            "clustername": "x.x.x.x",
            "domain": null,
            "forcepasswordchange": null,
            "keyfile": null,
            "lock": null,
            "log_path": "xxxxx/playbook.debug",
            "name": "IAUT-test_user_1",
            "nokey": null,
            "nopassword": null,
            "password": null,
            "state": "present",
            "token": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "unlock": null,
            "user_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "usergroup": "Monitor",
            "username": null,
            "validate_certs": false
        }
    },
    "msg": "Module failed. Error [argument of type 'NoneType' is not iterable]."
}

Output from log:

2023-03-15T05:53:06.329  INFO 140509157261440 ibm_svc_utils.py:_svc_rest():184 _svc_rest: url=https://x.x.x.x/:x/rest/mkuser
2023-03-15T05:53:06.329  INFO 140509157261440 ibm_svc_utils.py:_svc_rest():189 _svc_rest: payload={'name': 'IAUT-test_user_1', 'password': 'xxxxxxxxxxx', 'usergrp': 'Monitor'}
2023-03-15T05:53:06.902  INFO 140509157261440 ibm_svc_utils.py:_svc_rest():208 _svc_rest: value error pass: Extra data: line 2 column 1 (char 3)
2023-03-15T05:53:06.902  INFO 140509157261440 ibm_svc_utils.py:svc_run_command():274 svc_run_command rest={'url': 'https://x.x.x.x/:x/rest/mkuser', 'code': None, 'err': None, 'out': None, 'data': {'name': 'IAUT-test_user_1', 'password': 'xxxxxxxxxxx', 'usergrp': 'Monitor'}}
2023-03-15T05:53:06.903  INFO 140509157261440 ibm_svc_manage_user.py:create_user():265 create user result None
2023-03-15T05:53:06.903  INFO 140509157261440 ibm_svc_manage_user.py:main():380 Exception in apply(): 
Traceback (most recent call last):
  File "/tmp/ansible_ibm.spectrum_virtualize.ibm_svc_manage_user_payload_vjtorsq9/ansible_ibm.spectrum_virtualize.ibm_svc_manage_user_payload.zip/ansible_collections/ibm/spectrum_virtualize/plugins/modules/ibm_svc_manage_user.py", line 378, in main
  File "/tmp/ansible_ibm.spectrum_virtualize.ibm_svc_manage_user_payload_vjtorsq9/ansible_ibm.spectrum_virtualize.ibm_svc_manage_user_payload.zip/ansible_collections/ibm/spectrum_virtualize/plugins/modules/ibm_svc_manage_user.py", line 354, in apply
  File "/tmp/ansible_ibm.spectrum_virtualize.ibm_svc_manage_user_payload_vjtorsq9/ansible_ibm.spectrum_virtualize.ibm_svc_manage_user_payload.zip/ansible_collections/ibm/spectrum_virtualize/plugins/modules/ibm_svc_manage_user.py", line 266, in create_user
TypeError: argument of type 'NoneType' is not iterable
Shilpi-J commented 1 year ago

thanks for contacting us. On analyzing this issue, we found out that REST calls are not returning JSON output in SV 8.3.1.5 (The build on which the issue is reported).

This is a known issue on SV 8.3.1.3 and 8.3.1.4 versions. The same is mentioned as a limitation in README as well (https://github.com/ansible-collections/ibm.spectrum_virtualize#limitation)

we will update the README to include 8.3.1.5 as well. The fix for this issue is present in 8.3.1.6 version.

For solution, we would recommend upgrading to other SV versions, upgrading to 8.3.1.6 would work, else 8.4.x and 8.5.x would also work.

Shilpi-J commented 1 year ago

@abhirams-1 Let me know if I can close this issue.

Shilpi-J commented 1 year ago

@abhirams-1 Closing this issue, in case you still face the issue, feel free to reopen it.