Getting fatal error when creating host.
autocoder10 opened this issue · 5 comments
SUMMARY
When running a create host playbook using ibm_svc_host py module, got a fatal error and showing as Failed but creating the host entry.
Error:
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Module failed. Error [argument of type 'NoneType' is not iterable]."}
ISSUE TYPE
- Bug Report
COMPONENT NAME
ibm_svc_host
ANSIBLE VERSION
ansible 2.9.17
CONFIGURATION
OS / ENVIRONMENT
STEPS TO REPRODUCE
---
- name: Using the IBM Spectrum Virtualize collection
collections:
- ibm.spectrum_virtualize
gather_facts: no
connection: local
hosts: localhost
vars:
clustername: testcluster
username: ansibletest
password: passw0rd
tasks:
- name: Create host entry
ibm_svc_host:
clustername: "{{clustername}}"
domain:
username: "{{ username }}"
password: "{{ password }}"
log_path: /tmp/svcplaybook.debug
validate_certs: false
name: test1
state: present
fcwwpn: 11223344556633AA:11223344556633BB
iogrp: 0
protocol: scsi
type: generic
EXPECTED RESULTS
ACTUAL RESULTS
2021-03-08T14:35:39.209 INFO 140378744436544 ibm_svc_host.py:apply():372 CHANGED: host does not exist, but requested state is 'present'
2021-03-08T14:35:39.209 INFO 140378744436544 ibm_svc_host.py:host_create():272 creating host 'test1'
2021-03-08T14:35:39.209 INFO 140378744436544 ibm_svc_host.py:host_create():290 creating host command '11223344556633AA:11223344556633BB' opts 'generic'
I am getting the same error message for ibm_svc_vdisk.py and ibm_svc_vol_map.py modules as well. I did some troubleshooting and after the SVC code updated from 8.2.1.8 to 8.3.1.3 in early Jan this year which I believe this issue started. All these modules were working before the code update without any errors. Can you please check and let me know that fatal error is occurring.
In modules/ibm_svc_host.py under "def host_create" the below "if/else" condition is not working and we are getting 'message' in result. I am not seeing any of those self.log output in the debug file.
# Run command
result = self.restapi.svc_run_command(cmd, cmdopts, cmdargs=None)
self.log("create host result '%s'", result)
**if 'message' in result:
self.changed = True
self.log("create host result message '%s'", (result['message']))
else:
self.module.fail_json(
msg="Failed to create host [%s]" % self.name)**
Thanks for reporting it @autocoder10
We will analyze this and revert.
@rohitk-github: Can you please provide update on this issue. Thanks!!
Hi @autocoder10 Yes, I have an update on this. This issue is present in SV 8.3.1.3 and 8.3.1.4. Apparently, the REST calls for "mk" actions do not return JSON output and thus "json.load()" is failing.
This is fixed in Build 8.4.0.0.
Hmm that's a bummer. We are not planning to upgrade SVC's to 8.4 this year. So, will have to add some addl. validation tasks in the playbook after creating the objects before going to the next task till then.