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

sap_hdbsql - Except errors

Open crysaki opened this issue 7 months ago • 2 comments

Summary

While using the sap_hdbsql module to execute some SQL statements on a HANA database I've thought everything worked fine since the module return "changed": true but it isn't.

SAPs hdbsql cli tool returns "rc": 0 and writes the "authentication failed" to stderr.

It would be nice to have the module checking the return of hdbsql cli tool to except possible errors instead of just taking the returncode and always returns canged if RC equals 0.

Issue Type

Feature Idea

Component Name

sap_hdbsql

Additional Information

changed: [hostname] => {
    "changed": true,
    "invocation": {
        "module_args": {
            "autocommit": true,
            "bin_path": null,
            "database": "SYSTEMDB",
            "encrypted": false,
            "filepath": [
                "/tmp/hana_execute_sql.sql"
            ],
            "host": null,
            "instance": "XX",
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "query": null,
            "sid": "XXX",
            "user": "SYSTEM",
            "userstore": false
        }
    },
    "query_result": [
        []
    ],
    "rc": 0,
    "stderr_lines": [
        "* 10: authentication failed: Detailed info for this error can be found with correlation ID '96519A42F1619C48BA4F678D1EBC199C' SQLSTATE: 28000",
        "* 10: authentication failed: Detailed info for this error can be found with correlation ID 'B93DB11E00279B49B8511BB2119EB4E0' SQLSTATE: 28000",
        "* 10: authentication failed: Detailed info for this error can be found with correlation ID 'CE7D4CF91FCF694FAC2D23257E04830A' SQLSTATE: 28000"
    ]
}

Code of Conduct

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

crysaki avatar Apr 17 '25 06:04 crysaki