From f33ed9b4d9c0c285ac2e24efcc893582949ebedd Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 15 Oct 2021 12:16:48 -0400 Subject: [PATCH] Cleanup after script execution Leave cleaner tmp directories when functions are ran. --- .../el7/profiles/default/scripts/functions | 19 ++++++++++++------- .../profiles/default/scripts/functions | 19 ++++++++++++------- .../el8/profiles/default/scripts/functions | 19 ++++++++++++------- .../profiles/default/scripts/functions | 19 ++++++++++++------- .../profiles/default/scripts/functions | 19 ++++++++++++------- .../suse15/profiles/hpc/scripts/functions | 19 ++++++++++++------- .../profiles/default/scripts/functions | 19 ++++++++++++------- 7 files changed, 84 insertions(+), 49 deletions(-) diff --git a/confluent_osdeploy/el7/profiles/default/scripts/functions b/confluent_osdeploy/el7/profiles/default/scripts/functions index b1364bd0..c52c3b3f 100644 --- a/confluent_osdeploy/el7/profiles/default/scripts/functions +++ b/confluent_osdeploy/el7/profiles/default/scripts/functions @@ -63,7 +63,7 @@ fetch_remote() { } source_remote_parts() { - confluentscripttmpdir=$(mktemp -d) + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) apiclient=/opt/confluent/bin/apiclient if [ -f /etc/confluent/apiclient ]; then apiclient=/etc/confluent/apiclient @@ -72,11 +72,12 @@ source_remote_parts() { for script in $scriptlist; do source_remote $1/$script done + rm -rf $confluentscripttmpdir unset confluentscripttmpdir } run_remote_parts() { - confluentscripttmpdir=$(mktemp -d) + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) apiclient=/opt/confluent/bin/apiclient if [ -f /etc/confluent/apiclient ]; then apiclient=/etc/confluent/apiclient @@ -85,6 +86,7 @@ run_remote_parts() { for script in $scriptlist; do run_remote $1/$script done + rm -rf $confluentscripttmpdir unset confluentscripttmpdir } @@ -94,7 +96,7 @@ source_remote() { echo '---------------------------------------------------------------------------' echo Sourcing $1 from https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/ if [ -z "$confluentscripttmpdir" ]; then - confluentscripttmpdir=$(mktemp -d) + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) fi echo Sourcing from $confluentscripttmpdir cd $confluentscripttmpdir @@ -105,6 +107,7 @@ source_remote() { shift source ./$cmd cd - > /dev/null + rm -rf $confluentscripttmpdir return $retcode } @@ -115,7 +118,7 @@ run_remote() { echo '---------------------------------------------------------------------------' echo Running $requestedcmd from https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/ if [ -z "$confluentscripttmpdir" ]; then - confluentscripttmpdir=$(mktemp -d) + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) fi echo Executing in $confluentscripttmpdir cd $confluentscripttmpdir @@ -133,6 +136,7 @@ run_remote() { echo "$requestedcmd exited with code $retcode" fi cd - > /dev/null + rm -rf $confluentscripttmpdir return $retcode } @@ -144,9 +148,9 @@ run_remote_python() { fi echo '---------------------------------------------------------------------------' echo Running python script "'$*'" from https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/ - tmpdir=$(mktemp -d) - echo Executing in $tmpdir - cd $tmpdir + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) + echo Executing in $confluentscripttmpdir + cd $confluentscripttmpdir mkdir -p $(dirname $1) curl -f -sS $curlargs https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/$1 > $1 if [ $? != 0 ]; then echo "'$*'" failed to download; return 1; fi @@ -154,6 +158,7 @@ run_remote_python() { retcode=$? echo "'$*' exited with code $retcode" cd - > /dev/null + rm -rf $confluentscripttmpdir return $retcode } diff --git a/confluent_osdeploy/el8-diskless/profiles/default/scripts/functions b/confluent_osdeploy/el8-diskless/profiles/default/scripts/functions index b1364bd0..c52c3b3f 100644 --- a/confluent_osdeploy/el8-diskless/profiles/default/scripts/functions +++ b/confluent_osdeploy/el8-diskless/profiles/default/scripts/functions @@ -63,7 +63,7 @@ fetch_remote() { } source_remote_parts() { - confluentscripttmpdir=$(mktemp -d) + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) apiclient=/opt/confluent/bin/apiclient if [ -f /etc/confluent/apiclient ]; then apiclient=/etc/confluent/apiclient @@ -72,11 +72,12 @@ source_remote_parts() { for script in $scriptlist; do source_remote $1/$script done + rm -rf $confluentscripttmpdir unset confluentscripttmpdir } run_remote_parts() { - confluentscripttmpdir=$(mktemp -d) + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) apiclient=/opt/confluent/bin/apiclient if [ -f /etc/confluent/apiclient ]; then apiclient=/etc/confluent/apiclient @@ -85,6 +86,7 @@ run_remote_parts() { for script in $scriptlist; do run_remote $1/$script done + rm -rf $confluentscripttmpdir unset confluentscripttmpdir } @@ -94,7 +96,7 @@ source_remote() { echo '---------------------------------------------------------------------------' echo Sourcing $1 from https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/ if [ -z "$confluentscripttmpdir" ]; then - confluentscripttmpdir=$(mktemp -d) + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) fi echo Sourcing from $confluentscripttmpdir cd $confluentscripttmpdir @@ -105,6 +107,7 @@ source_remote() { shift source ./$cmd cd - > /dev/null + rm -rf $confluentscripttmpdir return $retcode } @@ -115,7 +118,7 @@ run_remote() { echo '---------------------------------------------------------------------------' echo Running $requestedcmd from https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/ if [ -z "$confluentscripttmpdir" ]; then - confluentscripttmpdir=$(mktemp -d) + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) fi echo Executing in $confluentscripttmpdir cd $confluentscripttmpdir @@ -133,6 +136,7 @@ run_remote() { echo "$requestedcmd exited with code $retcode" fi cd - > /dev/null + rm -rf $confluentscripttmpdir return $retcode } @@ -144,9 +148,9 @@ run_remote_python() { fi echo '---------------------------------------------------------------------------' echo Running python script "'$*'" from https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/ - tmpdir=$(mktemp -d) - echo Executing in $tmpdir - cd $tmpdir + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) + echo Executing in $confluentscripttmpdir + cd $confluentscripttmpdir mkdir -p $(dirname $1) curl -f -sS $curlargs https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/$1 > $1 if [ $? != 0 ]; then echo "'$*'" failed to download; return 1; fi @@ -154,6 +158,7 @@ run_remote_python() { retcode=$? echo "'$*' exited with code $retcode" cd - > /dev/null + rm -rf $confluentscripttmpdir return $retcode } diff --git a/confluent_osdeploy/el8/profiles/default/scripts/functions b/confluent_osdeploy/el8/profiles/default/scripts/functions index b1364bd0..c52c3b3f 100644 --- a/confluent_osdeploy/el8/profiles/default/scripts/functions +++ b/confluent_osdeploy/el8/profiles/default/scripts/functions @@ -63,7 +63,7 @@ fetch_remote() { } source_remote_parts() { - confluentscripttmpdir=$(mktemp -d) + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) apiclient=/opt/confluent/bin/apiclient if [ -f /etc/confluent/apiclient ]; then apiclient=/etc/confluent/apiclient @@ -72,11 +72,12 @@ source_remote_parts() { for script in $scriptlist; do source_remote $1/$script done + rm -rf $confluentscripttmpdir unset confluentscripttmpdir } run_remote_parts() { - confluentscripttmpdir=$(mktemp -d) + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) apiclient=/opt/confluent/bin/apiclient if [ -f /etc/confluent/apiclient ]; then apiclient=/etc/confluent/apiclient @@ -85,6 +86,7 @@ run_remote_parts() { for script in $scriptlist; do run_remote $1/$script done + rm -rf $confluentscripttmpdir unset confluentscripttmpdir } @@ -94,7 +96,7 @@ source_remote() { echo '---------------------------------------------------------------------------' echo Sourcing $1 from https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/ if [ -z "$confluentscripttmpdir" ]; then - confluentscripttmpdir=$(mktemp -d) + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) fi echo Sourcing from $confluentscripttmpdir cd $confluentscripttmpdir @@ -105,6 +107,7 @@ source_remote() { shift source ./$cmd cd - > /dev/null + rm -rf $confluentscripttmpdir return $retcode } @@ -115,7 +118,7 @@ run_remote() { echo '---------------------------------------------------------------------------' echo Running $requestedcmd from https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/ if [ -z "$confluentscripttmpdir" ]; then - confluentscripttmpdir=$(mktemp -d) + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) fi echo Executing in $confluentscripttmpdir cd $confluentscripttmpdir @@ -133,6 +136,7 @@ run_remote() { echo "$requestedcmd exited with code $retcode" fi cd - > /dev/null + rm -rf $confluentscripttmpdir return $retcode } @@ -144,9 +148,9 @@ run_remote_python() { fi echo '---------------------------------------------------------------------------' echo Running python script "'$*'" from https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/ - tmpdir=$(mktemp -d) - echo Executing in $tmpdir - cd $tmpdir + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) + echo Executing in $confluentscripttmpdir + cd $confluentscripttmpdir mkdir -p $(dirname $1) curl -f -sS $curlargs https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/$1 > $1 if [ $? != 0 ]; then echo "'$*'" failed to download; return 1; fi @@ -154,6 +158,7 @@ run_remote_python() { retcode=$? echo "'$*' exited with code $retcode" cd - > /dev/null + rm -rf $confluentscripttmpdir return $retcode } diff --git a/confluent_osdeploy/genesis/profiles/default/scripts/functions b/confluent_osdeploy/genesis/profiles/default/scripts/functions index b1364bd0..c52c3b3f 100644 --- a/confluent_osdeploy/genesis/profiles/default/scripts/functions +++ b/confluent_osdeploy/genesis/profiles/default/scripts/functions @@ -63,7 +63,7 @@ fetch_remote() { } source_remote_parts() { - confluentscripttmpdir=$(mktemp -d) + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) apiclient=/opt/confluent/bin/apiclient if [ -f /etc/confluent/apiclient ]; then apiclient=/etc/confluent/apiclient @@ -72,11 +72,12 @@ source_remote_parts() { for script in $scriptlist; do source_remote $1/$script done + rm -rf $confluentscripttmpdir unset confluentscripttmpdir } run_remote_parts() { - confluentscripttmpdir=$(mktemp -d) + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) apiclient=/opt/confluent/bin/apiclient if [ -f /etc/confluent/apiclient ]; then apiclient=/etc/confluent/apiclient @@ -85,6 +86,7 @@ run_remote_parts() { for script in $scriptlist; do run_remote $1/$script done + rm -rf $confluentscripttmpdir unset confluentscripttmpdir } @@ -94,7 +96,7 @@ source_remote() { echo '---------------------------------------------------------------------------' echo Sourcing $1 from https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/ if [ -z "$confluentscripttmpdir" ]; then - confluentscripttmpdir=$(mktemp -d) + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) fi echo Sourcing from $confluentscripttmpdir cd $confluentscripttmpdir @@ -105,6 +107,7 @@ source_remote() { shift source ./$cmd cd - > /dev/null + rm -rf $confluentscripttmpdir return $retcode } @@ -115,7 +118,7 @@ run_remote() { echo '---------------------------------------------------------------------------' echo Running $requestedcmd from https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/ if [ -z "$confluentscripttmpdir" ]; then - confluentscripttmpdir=$(mktemp -d) + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) fi echo Executing in $confluentscripttmpdir cd $confluentscripttmpdir @@ -133,6 +136,7 @@ run_remote() { echo "$requestedcmd exited with code $retcode" fi cd - > /dev/null + rm -rf $confluentscripttmpdir return $retcode } @@ -144,9 +148,9 @@ run_remote_python() { fi echo '---------------------------------------------------------------------------' echo Running python script "'$*'" from https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/ - tmpdir=$(mktemp -d) - echo Executing in $tmpdir - cd $tmpdir + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) + echo Executing in $confluentscripttmpdir + cd $confluentscripttmpdir mkdir -p $(dirname $1) curl -f -sS $curlargs https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/$1 > $1 if [ $? != 0 ]; then echo "'$*'" failed to download; return 1; fi @@ -154,6 +158,7 @@ run_remote_python() { retcode=$? echo "'$*' exited with code $retcode" cd - > /dev/null + rm -rf $confluentscripttmpdir return $retcode } diff --git a/confluent_osdeploy/suse15-diskless/profiles/default/scripts/functions b/confluent_osdeploy/suse15-diskless/profiles/default/scripts/functions index b1364bd0..c52c3b3f 100644 --- a/confluent_osdeploy/suse15-diskless/profiles/default/scripts/functions +++ b/confluent_osdeploy/suse15-diskless/profiles/default/scripts/functions @@ -63,7 +63,7 @@ fetch_remote() { } source_remote_parts() { - confluentscripttmpdir=$(mktemp -d) + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) apiclient=/opt/confluent/bin/apiclient if [ -f /etc/confluent/apiclient ]; then apiclient=/etc/confluent/apiclient @@ -72,11 +72,12 @@ source_remote_parts() { for script in $scriptlist; do source_remote $1/$script done + rm -rf $confluentscripttmpdir unset confluentscripttmpdir } run_remote_parts() { - confluentscripttmpdir=$(mktemp -d) + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) apiclient=/opt/confluent/bin/apiclient if [ -f /etc/confluent/apiclient ]; then apiclient=/etc/confluent/apiclient @@ -85,6 +86,7 @@ run_remote_parts() { for script in $scriptlist; do run_remote $1/$script done + rm -rf $confluentscripttmpdir unset confluentscripttmpdir } @@ -94,7 +96,7 @@ source_remote() { echo '---------------------------------------------------------------------------' echo Sourcing $1 from https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/ if [ -z "$confluentscripttmpdir" ]; then - confluentscripttmpdir=$(mktemp -d) + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) fi echo Sourcing from $confluentscripttmpdir cd $confluentscripttmpdir @@ -105,6 +107,7 @@ source_remote() { shift source ./$cmd cd - > /dev/null + rm -rf $confluentscripttmpdir return $retcode } @@ -115,7 +118,7 @@ run_remote() { echo '---------------------------------------------------------------------------' echo Running $requestedcmd from https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/ if [ -z "$confluentscripttmpdir" ]; then - confluentscripttmpdir=$(mktemp -d) + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) fi echo Executing in $confluentscripttmpdir cd $confluentscripttmpdir @@ -133,6 +136,7 @@ run_remote() { echo "$requestedcmd exited with code $retcode" fi cd - > /dev/null + rm -rf $confluentscripttmpdir return $retcode } @@ -144,9 +148,9 @@ run_remote_python() { fi echo '---------------------------------------------------------------------------' echo Running python script "'$*'" from https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/ - tmpdir=$(mktemp -d) - echo Executing in $tmpdir - cd $tmpdir + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) + echo Executing in $confluentscripttmpdir + cd $confluentscripttmpdir mkdir -p $(dirname $1) curl -f -sS $curlargs https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/$1 > $1 if [ $? != 0 ]; then echo "'$*'" failed to download; return 1; fi @@ -154,6 +158,7 @@ run_remote_python() { retcode=$? echo "'$*' exited with code $retcode" cd - > /dev/null + rm -rf $confluentscripttmpdir return $retcode } diff --git a/confluent_osdeploy/suse15/profiles/hpc/scripts/functions b/confluent_osdeploy/suse15/profiles/hpc/scripts/functions index b1364bd0..c52c3b3f 100644 --- a/confluent_osdeploy/suse15/profiles/hpc/scripts/functions +++ b/confluent_osdeploy/suse15/profiles/hpc/scripts/functions @@ -63,7 +63,7 @@ fetch_remote() { } source_remote_parts() { - confluentscripttmpdir=$(mktemp -d) + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) apiclient=/opt/confluent/bin/apiclient if [ -f /etc/confluent/apiclient ]; then apiclient=/etc/confluent/apiclient @@ -72,11 +72,12 @@ source_remote_parts() { for script in $scriptlist; do source_remote $1/$script done + rm -rf $confluentscripttmpdir unset confluentscripttmpdir } run_remote_parts() { - confluentscripttmpdir=$(mktemp -d) + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) apiclient=/opt/confluent/bin/apiclient if [ -f /etc/confluent/apiclient ]; then apiclient=/etc/confluent/apiclient @@ -85,6 +86,7 @@ run_remote_parts() { for script in $scriptlist; do run_remote $1/$script done + rm -rf $confluentscripttmpdir unset confluentscripttmpdir } @@ -94,7 +96,7 @@ source_remote() { echo '---------------------------------------------------------------------------' echo Sourcing $1 from https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/ if [ -z "$confluentscripttmpdir" ]; then - confluentscripttmpdir=$(mktemp -d) + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) fi echo Sourcing from $confluentscripttmpdir cd $confluentscripttmpdir @@ -105,6 +107,7 @@ source_remote() { shift source ./$cmd cd - > /dev/null + rm -rf $confluentscripttmpdir return $retcode } @@ -115,7 +118,7 @@ run_remote() { echo '---------------------------------------------------------------------------' echo Running $requestedcmd from https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/ if [ -z "$confluentscripttmpdir" ]; then - confluentscripttmpdir=$(mktemp -d) + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) fi echo Executing in $confluentscripttmpdir cd $confluentscripttmpdir @@ -133,6 +136,7 @@ run_remote() { echo "$requestedcmd exited with code $retcode" fi cd - > /dev/null + rm -rf $confluentscripttmpdir return $retcode } @@ -144,9 +148,9 @@ run_remote_python() { fi echo '---------------------------------------------------------------------------' echo Running python script "'$*'" from https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/ - tmpdir=$(mktemp -d) - echo Executing in $tmpdir - cd $tmpdir + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) + echo Executing in $confluentscripttmpdir + cd $confluentscripttmpdir mkdir -p $(dirname $1) curl -f -sS $curlargs https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/$1 > $1 if [ $? != 0 ]; then echo "'$*'" failed to download; return 1; fi @@ -154,6 +158,7 @@ run_remote_python() { retcode=$? echo "'$*' exited with code $retcode" cd - > /dev/null + rm -rf $confluentscripttmpdir return $retcode } diff --git a/confluent_osdeploy/ubuntu20.04/profiles/default/scripts/functions b/confluent_osdeploy/ubuntu20.04/profiles/default/scripts/functions index b1364bd0..c52c3b3f 100644 --- a/confluent_osdeploy/ubuntu20.04/profiles/default/scripts/functions +++ b/confluent_osdeploy/ubuntu20.04/profiles/default/scripts/functions @@ -63,7 +63,7 @@ fetch_remote() { } source_remote_parts() { - confluentscripttmpdir=$(mktemp -d) + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) apiclient=/opt/confluent/bin/apiclient if [ -f /etc/confluent/apiclient ]; then apiclient=/etc/confluent/apiclient @@ -72,11 +72,12 @@ source_remote_parts() { for script in $scriptlist; do source_remote $1/$script done + rm -rf $confluentscripttmpdir unset confluentscripttmpdir } run_remote_parts() { - confluentscripttmpdir=$(mktemp -d) + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) apiclient=/opt/confluent/bin/apiclient if [ -f /etc/confluent/apiclient ]; then apiclient=/etc/confluent/apiclient @@ -85,6 +86,7 @@ run_remote_parts() { for script in $scriptlist; do run_remote $1/$script done + rm -rf $confluentscripttmpdir unset confluentscripttmpdir } @@ -94,7 +96,7 @@ source_remote() { echo '---------------------------------------------------------------------------' echo Sourcing $1 from https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/ if [ -z "$confluentscripttmpdir" ]; then - confluentscripttmpdir=$(mktemp -d) + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) fi echo Sourcing from $confluentscripttmpdir cd $confluentscripttmpdir @@ -105,6 +107,7 @@ source_remote() { shift source ./$cmd cd - > /dev/null + rm -rf $confluentscripttmpdir return $retcode } @@ -115,7 +118,7 @@ run_remote() { echo '---------------------------------------------------------------------------' echo Running $requestedcmd from https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/ if [ -z "$confluentscripttmpdir" ]; then - confluentscripttmpdir=$(mktemp -d) + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) fi echo Executing in $confluentscripttmpdir cd $confluentscripttmpdir @@ -133,6 +136,7 @@ run_remote() { echo "$requestedcmd exited with code $retcode" fi cd - > /dev/null + rm -rf $confluentscripttmpdir return $retcode } @@ -144,9 +148,9 @@ run_remote_python() { fi echo '---------------------------------------------------------------------------' echo Running python script "'$*'" from https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/ - tmpdir=$(mktemp -d) - echo Executing in $tmpdir - cd $tmpdir + confluentscripttmpdir=$(mktemp -d confluentscripts.XXXXXXXXX) + echo Executing in $confluentscripttmpdir + cd $confluentscripttmpdir mkdir -p $(dirname $1) curl -f -sS $curlargs https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/$1 > $1 if [ $? != 0 ]; then echo "'$*'" failed to download; return 1; fi @@ -154,6 +158,7 @@ run_remote_python() { retcode=$? echo "'$*' exited with code $retcode" cd - > /dev/null + rm -rf $confluentscripttmpdir return $retcode }