sap-linuxlab / community.sap_libs

Automation for SAP - Collection of Ansible Modules for SAP for low-level activities which are highly reusable
Apache License 2.0
16 stars 7 forks source link

sap_control_exec: "TypeError: 'NoneType' object is not iterable" #19

Closed KlapsKanthr closed 1 year ago

KlapsKanthr commented 1 year ago

Summary

When I use the sapcontrol (or even the sap_control_exec) module to stop or start the SAP instance or the sapstartsrv service (Stop, Start, RestartService, ...) I get the error mentioned in the title. Other functions such as GetProcessList or ParameterValue work fine, just stopping, starting, restarting are erroneous.

Issue Type

Bug Report

Component Name

sapcontrol.py

Ansible Version

$ ansible --version
ansible [core 2.13.3]
  config file = /home/webeda/ansible/ansible.cfg
  configured module search path = ['/home/webeda/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/webeda/ansible-env/lib/python3.8/site-packages/ansible
  ansible collection location = /home/webeda/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/webeda/ansible-env/bin/ansible
  python version = 3.8.10 (default, Jun 22 2022, 20:18:18) [GCC 9.4.0]
  jinja version = 3.1.2
  libyaml = True

community.sap_libs Version

$ ansible-galaxy collection list community.sap_libs
Collection         Version
------------------ -------
community.sap_libs 1.2.0

Configuration

$ ansible-config dump --only-changed

OS / Environment

No response

Steps to Reproduce

---
- hosts: all
  become: true
  tasks:
    - name: Test SAPControl
      community.sap_libs.sapcontrol:
        function: RestartService
        sysnr: 20
        username: <sid>adm
        password: <password>

Expected Results

The sapstartsrv service should be restarted.

Actual Results

TASK [Test SAPControl] *****************************************************************************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: 'NoneType' object is not iterable
fatal: [<hostname>]: FAILED! => {"changed": false, "module_stderr": "Shared connection to <ip_address> closed.
", "module_stdout": "Traceback (most recent call last):
  File \"/home/<ansible_user>/.ansible/tmp/ansible-tmp-1663326779.0265872-1126214-128689101340854/AnsiballZ_sapcontrol.py\", line 107, in <module>
    _ansiballz_main()
  File \"/home/<ansible_user>/.ansible/tmp/ansible-tmp-1663326779.0265872-1126214-128689101340854/AnsiballZ_sapcontrol.py\", line 99, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File \"/home/<ansible_user>/.ansible/tmp/ansible-tmp-1663326779.0265872-1126214-128689101340854/AnsiballZ_sapcontrol.py\", line 48, in invoke_module
    run_name='__main__', alter_sys=True)
  File \"/usr/lib64/python3.6/runpy.py\", line 205, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File \"/usr/lib64/python3.6/runpy.py\", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File \"/usr/lib64/python3.6/runpy.py\", line 85, in _run_code
    exec(code, run_globals)
  File \"/tmp/ansible_community.sap_libs.sapcontrol_payload_ccrn_dns/ansible_community.sap_libs.sapcontrol_payload.zip/ansible_collections/community/sap_libs/plugins/modules/sapcontrol.py\", line 389, in <module>
  File \"/tmp/ansible_community.sap_libs.sapcontrol_payload_ccrn_dns/ansible_community.sap_libs.sapcontrol_payload.zip/ansible_collections/community/sap_libs/plugins/modules/sapcontrol.py\", line 379, in main
  File \"/tmp/ansible_community.sap_libs.sapcontrol_payload_ccrn_dns/ansible_community.sap_libs.sapcontrol_payload.zip/ansible_collections/community/sap_libs/plugins/modules/sapcontrol.py\", line 297, in recursive_dict
  File \"/usr/lib/python3.6/site-packages/suds/sudsobject.py\", line 51, in asdict
    return dict(items(sobject))
  File \"/usr/lib/python3.6/site-packages/suds/sudsobject.py\", line 38, in items
    for item in sobject:
TypeError: 'NoneType' object is not iterable
", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

Code of Conduct

rainerleber commented 1 year ago

Hi @KlapsKanthr thank you for reporting this issue and sorry for the late response the bug is fixed and will be merged asap.

rainerleber commented 1 year ago

FIX in Version 1.4.0 integrated