Skip to content

Commit

Permalink
angi: saphana-common-lib: improve code-style following PR 144 (which …
Browse files Browse the repository at this point in the history
…was against classic)
  • Loading branch information
fmherschel committed May 6, 2024
1 parent 2e46348 commit 7176260
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ra/saphana-common-lib
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,8 @@ function HANA_CALL() {
local cmd=""
local pre_script=""
local output=""
local suErr=""
local cmdErr=""
while [ $# -gt 0 ]; do
case "$1" in
--timeout ) timeOut=$2; shift;;
Expand Down Expand Up @@ -490,9 +492,9 @@ function HANA_CALL() {
output=$(timeout --foreground -s 9 "$timeOut" su - "${sid}adm" -c "($pre_script; timeout -s 9 $timeOut $cmd > $cmd_out_log) >& $cmd_err_log" 2>"$su_err_log"); rc="$?"
;;
esac
output=$(if [ -f "$cmd_out_log" ]; then cat "$cmd_out_log"; rm -f "$cmd_out_log"; fi)
suErr=$(if [ -f "$su_err_log" ]; then cat "$su_err_log"; rm -f "$su_err_log"; else echo "NA"; fi)
cmdErr=$(if [ -f "$cmd_err_log" ]; then cat "$cmd_err_log"; rm -f "$cmd_err_log"; else echo "NA"; fi)
if [[ -f "$cmd_out_log" ]]; then output=$(<$cmd_out_log); rm -f "$cmd_out_log"; fi
if [[ -f "$su_err_log" ]]; then suErr=$(<$su_err_log); rm -f "$su_err_log"; else suErr='NA'; fi
if [[ -f "$cmd_err_log" ]]; then cmdErr=$(<$cmd_err_log); rm -f "$cmd_err_log"; else cmdErr='NA'; fi
super_ocf_log debug "DBG: RA ==== action HANA_CALL (cmd is '$cmd', rc is '$rc', stderr from su is '$suErr', stderr from cmd is '$cmdErr') ===="
# on rc=1 - retry to improve the behavior in AD environments
# fh 20230127 deactivate this part. rc=1 could also be the valid rc of the called command
Expand Down

0 comments on commit 7176260

Please sign in to comment.