abort vsh rework

Signed-off-by: Ava Hahn <a.hahn@f5.com>
This commit is contained in:
Ava Hahn 2025-01-21 15:03:43 -08:00
parent b47476bd69
commit 1ed551b70b
2 changed files with 15 additions and 36 deletions

36
util.sh
View file

@ -1,36 +0,0 @@
#!/bin/bash
dirn=$(dirname "$0")
source $dirn/common.sh
source $dirn/virt.sh
source $dirn/nginx.sh
# this file exists to provide logic that requires functionality from one or
# more modules in the rest of the code. It can be sourced directly.
function vsh() {
if ! turn_on_vm_and_wait $1; then
exit 1
fi
sshpass -p $PASSP \
ssh -o PreferredAuthentications=password \
-o StrictHostKeyChecking=no \
$USERN@$(get_vm_ip $1) \
"cat > /tmp/u.sh <<EOF
$(typeset WHT)
$(typeset END)
$(typeset -f log)
$(typeset -f num_jobs)
$(typeset -f build_nginx)
$(typeset -f build_otel)
$(typeset -f test_nginx)
$(typeset -f test_otel)
$(typeset -f clean_nginx)
$(typeset -f clean_otel)
EOF
bash"
turn_off_vm $1
}

15
virt.sh
View file

@ -157,3 +157,18 @@ function vm_cmd() {
-o StrictHostKeyChecking=no \ -o StrictHostKeyChecking=no \
$USERN@$(get_vm_ip $1) "$2" $USERN@$(get_vm_ip $1) "$2"
} }
function vsh() {
# takes care of error cases
if ! turn_on_vm_and_wait $1; then
exit 1
fi
get_vm_ip $1
sshpass -p $PASSP \
ssh -o PreferredAuthentications=password \
-o StrictHostKeyChecking=no \
$USERN@$ret
turn_off_vm $1
}