Alin-Bogdan Zirbo
Alin-Bogdan Zirbo

Reputation: 29

skip Helm uninstall interactive request

i want to automate a bit helm install/uninstall but during helm uninstall command it will become user interactiv asking:

Do you want to continue to delete suite-helm? (yY|nN):

Is any flag or way to skip this part? Thanks in advance

Upvotes: 0

Views: 204

Answers (2)

Alin-Bogdan Zirbo
Alin-Bogdan Zirbo

Reputation: 29

finaly i found a way using expect and here it is: expect -c ' spawn ./helm_remove.sh; expect (yY|nN); send "y\n"; interact'

into sh file i will have helm uninstall suite-helm -n suite-helm and some other commands to remove pvs deployment...

Upvotes: 1

Josh Beauregard
Josh Beauregard

Reputation: 2749

You would have to wrap in a shell script or function.

Something like (just spitballing here, not even syntax checking)

helm-delete() {

helm status $1

echo "Do you want to continue to delete suite-helm? (yY|nN):"
read -rs -k 1 ans

    case "${ans}" in
    y|Y|$'\n')
        printf "Yes\n"

          helm delete %1
        ;;

    *)  # This is the default
        printf "No\n"
            return 0

    esac
}

Upvotes: 0

Related Questions