community.sap_libs icon indicating copy to clipboard operation
community.sap_libs copied to clipboard

select statement against hana runs into python error

Open woreis opened this issue 1 year ago • 3 comments

Summary

Hi, I just wanted to test sap_hdbsql.py and immediately run into an issue.

When I run this, I get the error shown below. But of course the struct.py file can be found on the target system.

Any idea, what could cause this problem ? Help would be appreciated, Thanks, Wolfgang

Issue Type

Bug Report

Component Name

sap_libs, module sap_hdbsql.py

Ansible Version

ansible [core 2.16.3]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/bechtle/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.12/site-packages/ansible
  ansible collection location = /etc/ansible/{{ ANSIBLE_HOME ~ "/collections:/usr/share/ansible/collections:/etc/ansible/collections" }}
  executable location = /usr/bin/ansible
  python version = 3.12.1 (main, Feb 21 2024, 10:25:11) [GCC 8.5.0 20210514 (Red Hat 8.5.0-21)] (/usr/bin/python3.12)
  jinja version = 3.1.2
  libyaml = True

community.sap_libs Version

[root@vcomprdsat001 community]# ansible-galaxy collection list

# /usr/share/ansible/collections/ansible_collections
Collection                  Version
--------------------------- -------
ansible.posix               1.5.4
community.general           8.6.0
community.sap_install       1.4.0
community.sap_libs          1.4.2
redhat.rhel_system_roles    1.23.0
redhat.satellite            4.0.0
redhat.satellite_operations 2.1.0

Configuration

$ ansible-config dump --only-changed

OS / Environment

RHEL 9

Steps to Reproduce

---

- hosts: '{{ ho | default([]) }}'

  tasks:
  - name: Simple select query
    become: true
    become_user: idhadm
    become_flags: '-i'
    community.sap_libs.sap_hdbsql:
      sid: "IDH"
      database: "SYSTEMDB"
      instance: "00"
      userstore: true
      user: "USER"
      host: "some.host:port"
      query: select user_name from users

Expected Results

I expected the List of users to be shown.

Actual Results

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named '_struct'
fatal: [vintdevhdb001.fdz.internal]: FAILED! => 
{
    "changed": false,
    "module_stderr": "Shared connection to som.host closed.\r\n",
    "module_stdout": "
        Traceback (most recent call last):\r\n File "/var/tmp/ansible-tmp-1725457957.175195-2959474-12846379217444/AnsiballZ_sap_hdbsql.py",
        line 107,in \r\n _ansiballz_main()\r\n File "/var/tmp/ansible-tmp-1725457957.175195-2959474-12846379217444/AnsiballZ_sap_hdbsql.py",
        line 24,in _ansiballz_main\r\n import base64\r\n File "/usr/sap/IDH/HDB00/exe/Python3/lib/python3.8/base64.py",
        line 10,in \r\n import struct\r\n File "/usr/sap/IDH/HDB00/exe/Python3/lib/python3.8/struct.py",
        line 13,in \r\n from _struct import *\r\nModuleNotFoundError: No module named '_struct'
        \r\n",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

But the file exists on the target:

[[email protected]] ~]# ls -l /usr/sap/IDH/HDB00/exe/Python3/lib/python3.8/struct.py
-r--r--r--. 1 idhadm sapsys 257 Jul 11 22:49 /usr/sap/IDH/HDB00/exe/Python3/lib/python3.8/struct.py

Code of Conduct

  • [X] I agree to follow the Ansible Code of Conduct

woreis avatar Sep 04 '24 14:09 woreis