From 59e739a1439d6f74bf18e507947fb27b5627b1f0 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 21 Aug 2020 17:42:02 -0400 Subject: [PATCH] Further tweaks to postscript library functions --- .../el7/profiles/default/scripts/functions | 22 ++++++++++++++----- .../el8/profiles/default/scripts/functions | 22 ++++++++++++++----- .../profiles/default/scripts/functions | 22 ++++++++++++++----- .../rhvh4/profiles/default/scripts/functions | 22 ++++++++++++++----- .../suse15/profiles/hpc/scripts/functions | 22 ++++++++++++++----- 5 files changed, 80 insertions(+), 30 deletions(-) diff --git a/confluent_osdeploy/el7/profiles/default/scripts/functions b/confluent_osdeploy/el7/profiles/default/scripts/functions index 0f315999..5d6189e6 100644 --- a/confluent_osdeploy/el7/profiles/default/scripts/functions +++ b/confluent_osdeploy/el7/profiles/default/scripts/functions @@ -3,8 +3,11 @@ run_remote() { echo echo '---------------------------------------------------------------------------' echo Running $requestedcmd from https://$mgr/confluent-public/os/$profile/scripts/ - cd $(mktemp -d) + tmpdir=$(mktemp -d) + echo Executing in $tmpdir + cd $tmpdir curl -f -sS https://$mgr/confluent-public/os/$profile/scripts/$1 > $1 + if [ $? != 0 ]; then echo $requestedcmd failed to download; return 1; fi chmod +x $1 cmd=$1 if [ -x /usr/bin/chcon ]; then @@ -12,17 +15,24 @@ run_remote() { fi shift ./$cmd $* - echo "$requestedcmd exited with code $?" - cd - + retcode=$? + echo "$requestedcmd exited with code $retcode" + cd - > /dev/null + return $retcode } run_remote_python() { echo echo '---------------------------------------------------------------------------' echo Running python script "'$*'" from https://$mgr/confluent-public/os/$profile/scripts/ - cd $(mktemp -d) + tmpdir=$(mktemp -d) + echo Executing in $tmpdir + cd $tmpdir curl -f -sS https://$mgr/confluent-public/os/$profile/scripts/$1 > $1 + if [ $? != 0 ]; then echo "'$*'" failed to download; return 1; fi /usr/libexec/platform-python $* - echo "'$*' exited with code $?" - cd - + retcode=$? + echo "'$*' exited with code $retcode" + cd - > /dev/null + return $retcode } diff --git a/confluent_osdeploy/el8/profiles/default/scripts/functions b/confluent_osdeploy/el8/profiles/default/scripts/functions index 0f315999..5d6189e6 100644 --- a/confluent_osdeploy/el8/profiles/default/scripts/functions +++ b/confluent_osdeploy/el8/profiles/default/scripts/functions @@ -3,8 +3,11 @@ run_remote() { echo echo '---------------------------------------------------------------------------' echo Running $requestedcmd from https://$mgr/confluent-public/os/$profile/scripts/ - cd $(mktemp -d) + tmpdir=$(mktemp -d) + echo Executing in $tmpdir + cd $tmpdir curl -f -sS https://$mgr/confluent-public/os/$profile/scripts/$1 > $1 + if [ $? != 0 ]; then echo $requestedcmd failed to download; return 1; fi chmod +x $1 cmd=$1 if [ -x /usr/bin/chcon ]; then @@ -12,17 +15,24 @@ run_remote() { fi shift ./$cmd $* - echo "$requestedcmd exited with code $?" - cd - + retcode=$? + echo "$requestedcmd exited with code $retcode" + cd - > /dev/null + return $retcode } run_remote_python() { echo echo '---------------------------------------------------------------------------' echo Running python script "'$*'" from https://$mgr/confluent-public/os/$profile/scripts/ - cd $(mktemp -d) + tmpdir=$(mktemp -d) + echo Executing in $tmpdir + cd $tmpdir curl -f -sS https://$mgr/confluent-public/os/$profile/scripts/$1 > $1 + if [ $? != 0 ]; then echo "'$*'" failed to download; return 1; fi /usr/libexec/platform-python $* - echo "'$*' exited with code $?" - cd - + retcode=$? + echo "'$*' exited with code $retcode" + cd - > /dev/null + return $retcode } diff --git a/confluent_osdeploy/genesis/profiles/default/scripts/functions b/confluent_osdeploy/genesis/profiles/default/scripts/functions index 0f315999..5d6189e6 100644 --- a/confluent_osdeploy/genesis/profiles/default/scripts/functions +++ b/confluent_osdeploy/genesis/profiles/default/scripts/functions @@ -3,8 +3,11 @@ run_remote() { echo echo '---------------------------------------------------------------------------' echo Running $requestedcmd from https://$mgr/confluent-public/os/$profile/scripts/ - cd $(mktemp -d) + tmpdir=$(mktemp -d) + echo Executing in $tmpdir + cd $tmpdir curl -f -sS https://$mgr/confluent-public/os/$profile/scripts/$1 > $1 + if [ $? != 0 ]; then echo $requestedcmd failed to download; return 1; fi chmod +x $1 cmd=$1 if [ -x /usr/bin/chcon ]; then @@ -12,17 +15,24 @@ run_remote() { fi shift ./$cmd $* - echo "$requestedcmd exited with code $?" - cd - + retcode=$? + echo "$requestedcmd exited with code $retcode" + cd - > /dev/null + return $retcode } run_remote_python() { echo echo '---------------------------------------------------------------------------' echo Running python script "'$*'" from https://$mgr/confluent-public/os/$profile/scripts/ - cd $(mktemp -d) + tmpdir=$(mktemp -d) + echo Executing in $tmpdir + cd $tmpdir curl -f -sS https://$mgr/confluent-public/os/$profile/scripts/$1 > $1 + if [ $? != 0 ]; then echo "'$*'" failed to download; return 1; fi /usr/libexec/platform-python $* - echo "'$*' exited with code $?" - cd - + retcode=$? + echo "'$*' exited with code $retcode" + cd - > /dev/null + return $retcode } diff --git a/confluent_osdeploy/rhvh4/profiles/default/scripts/functions b/confluent_osdeploy/rhvh4/profiles/default/scripts/functions index 0f315999..5d6189e6 100644 --- a/confluent_osdeploy/rhvh4/profiles/default/scripts/functions +++ b/confluent_osdeploy/rhvh4/profiles/default/scripts/functions @@ -3,8 +3,11 @@ run_remote() { echo echo '---------------------------------------------------------------------------' echo Running $requestedcmd from https://$mgr/confluent-public/os/$profile/scripts/ - cd $(mktemp -d) + tmpdir=$(mktemp -d) + echo Executing in $tmpdir + cd $tmpdir curl -f -sS https://$mgr/confluent-public/os/$profile/scripts/$1 > $1 + if [ $? != 0 ]; then echo $requestedcmd failed to download; return 1; fi chmod +x $1 cmd=$1 if [ -x /usr/bin/chcon ]; then @@ -12,17 +15,24 @@ run_remote() { fi shift ./$cmd $* - echo "$requestedcmd exited with code $?" - cd - + retcode=$? + echo "$requestedcmd exited with code $retcode" + cd - > /dev/null + return $retcode } run_remote_python() { echo echo '---------------------------------------------------------------------------' echo Running python script "'$*'" from https://$mgr/confluent-public/os/$profile/scripts/ - cd $(mktemp -d) + tmpdir=$(mktemp -d) + echo Executing in $tmpdir + cd $tmpdir curl -f -sS https://$mgr/confluent-public/os/$profile/scripts/$1 > $1 + if [ $? != 0 ]; then echo "'$*'" failed to download; return 1; fi /usr/libexec/platform-python $* - echo "'$*' exited with code $?" - cd - + retcode=$? + echo "'$*' exited with code $retcode" + cd - > /dev/null + return $retcode } diff --git a/confluent_osdeploy/suse15/profiles/hpc/scripts/functions b/confluent_osdeploy/suse15/profiles/hpc/scripts/functions index 97df7cec..42e5c79a 100644 --- a/confluent_osdeploy/suse15/profiles/hpc/scripts/functions +++ b/confluent_osdeploy/suse15/profiles/hpc/scripts/functions @@ -3,23 +3,33 @@ run_remote() { echo echo '---------------------------------------------------------------------------' echo Running $requestedcmd from https://$mgr/confluent-public/os/$profile/scripts/ - cd $(mktemp -d) + tmpdir=$(mktemp -d) + echo Executing in $tmpdir + cd $tmpdir curl -f -sS https://$mgr/confluent-public/os/$profile/scripts/$1 > $1 + if [ $? != 0 ]; then echo $requestedcmd failed to download; return 1; fi chmod +x $1 cmd=$1 shift ./$cmd $* - echo "$requestedcmd exited with code $?" - cd - + retcode=$? + echo "$requestedcmd exited with code $retcode" + cd - > /dev/null + return $retcode } run_remote_python() { echo echo '---------------------------------------------------------------------------' echo Running python script "'$*'" from https://$mgr/confluent-public/os/$profile/scripts/ - cd $(mktemp -d) + tmpdir=$(mktemp -d) + echo Executing in $tmpdir + cd $tmpdir curl -f -sS https://$mgr/confluent-public/os/$profile/scripts/$1 > $1 + if [ $? != 0 ]; then echo "'$*'" failed to download; return 1; fi python3 $* - echo "'$*' exited with code $?" - cd - + retcode=$? + echo "'$*' exited with code $retcode" + cd - > /dev/null + return $retcode }