From 7d8bc0f11c2e1f58da73710e7925f456d011ec0c Mon Sep 17 00:00:00 2001 From: stm85 Date: Mon, 29 Apr 2024 08:17:37 +0200 Subject: [PATCH] add -E option to filepath command (#42) * add -E option to filepath command -E Specifies the if HDBSQL returns an error. Values are: OKAY = 0, ERROR = 1, USAGE = 2, SQLERROR = 3, and VAR = 4. if -E is not set when using-I option the sql will not fail on first error and still continue running the sql commands inside the file. If the last command is successfully, the whole run is market as successfully * Create 0044-hdbsql_sqlfile_faile_on_first_error.yaml * Update 0044-hdbsql_sqlfile_faile_on_first_error.yaml * Update and rename 0044-hdbsql_sqlfile_faile_on_first_error.yaml to 0044-hdbsql_sqlfile_fail_on_first_error.yaml --------- Co-authored-by: Rainer Leber <39616583+rainerleber@users.noreply.github.com> --- .../fragments/0044-hdbsql_sqlfile_fail_on_first_error.yaml | 2 ++ plugins/modules/sap_hdbsql.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/0044-hdbsql_sqlfile_fail_on_first_error.yaml diff --git a/changelogs/fragments/0044-hdbsql_sqlfile_fail_on_first_error.yaml b/changelogs/fragments/0044-hdbsql_sqlfile_fail_on_first_error.yaml new file mode 100644 index 0000000..da4b8cd --- /dev/null +++ b/changelogs/fragments/0044-hdbsql_sqlfile_fail_on_first_error.yaml @@ -0,0 +1,2 @@ +minor_changes: + - Add -E 3 Option to hdbsql run, if filepaht is selected, to fail on first sql error diff --git a/plugins/modules/sap_hdbsql.py b/plugins/modules/sap_hdbsql.py index 994db70..68b4f29 100644 --- a/plugins/modules/sap_hdbsql.py +++ b/plugins/modules/sap_hdbsql.py @@ -223,7 +223,7 @@ def main(): command.extend(['-x', '-i', instance, '-u', user, '-p', password]) if filepath is not None: - command.extend(['-I']) + command.extend(['-E 3', '-I']) for p in filepath: # makes a command like hdbsql -i 01 -u SYSTEM -p secret123# -I /tmp/HANA_CPU_UtilizationPerCore_2.00.020+.txt, # iterates through files and append the output to var out.