2020-06-01 20:01:26 +00:00
|
|
|
run_remote() {
|
2020-08-21 14:33:56 +00:00
|
|
|
requestedcmd="'$*'"
|
2020-08-21 21:03:12 +00:00
|
|
|
echo
|
|
|
|
echo '---------------------------------------------------------------------------'
|
2020-08-21 20:39:37 +00:00
|
|
|
echo Running $requestedcmd from https://$mgr/confluent-public/os/$profile/scripts/
|
2020-08-21 21:42:02 +00:00
|
|
|
tmpdir=$(mktemp -d)
|
|
|
|
echo Executing in $tmpdir
|
|
|
|
cd $tmpdir
|
2020-08-21 21:07:02 +00:00
|
|
|
curl -f -sS https://$mgr/confluent-public/os/$profile/scripts/$1 > $1
|
2020-08-21 21:42:02 +00:00
|
|
|
if [ $? != 0 ]; then echo $requestedcmd failed to download; return 1; fi
|
2020-06-01 20:01:26 +00:00
|
|
|
chmod +x $1
|
2020-07-15 19:22:27 +00:00
|
|
|
cmd=$1
|
|
|
|
shift
|
2020-07-13 21:08:38 +00:00
|
|
|
./$cmd $*
|
2020-08-21 21:42:02 +00:00
|
|
|
retcode=$?
|
|
|
|
echo "$requestedcmd exited with code $retcode"
|
|
|
|
cd - > /dev/null
|
|
|
|
return $retcode
|
2020-06-01 20:01:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
run_remote_python() {
|
2020-08-21 21:03:12 +00:00
|
|
|
echo
|
|
|
|
echo '---------------------------------------------------------------------------'
|
|
|
|
echo Running python script "'$*'" from https://$mgr/confluent-public/os/$profile/scripts/
|
2020-08-21 21:42:02 +00:00
|
|
|
tmpdir=$(mktemp -d)
|
|
|
|
echo Executing in $tmpdir
|
|
|
|
cd $tmpdir
|
2020-08-21 21:07:02 +00:00
|
|
|
curl -f -sS https://$mgr/confluent-public/os/$profile/scripts/$1 > $1
|
2020-08-21 21:42:02 +00:00
|
|
|
if [ $? != 0 ]; then echo "'$*'" failed to download; return 1; fi
|
2020-07-13 21:08:38 +00:00
|
|
|
python3 $*
|
2020-08-21 21:42:02 +00:00
|
|
|
retcode=$?
|
|
|
|
echo "'$*' exited with code $retcode"
|
|
|
|
cd - > /dev/null
|
|
|
|
return $retcode
|
2020-06-01 20:01:26 +00:00
|
|
|
}
|