Skip to content

Commit

Permalink
check for AWS environment before running sudo
Browse files Browse the repository at this point in the history
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
  • Loading branch information
dims committed Jun 14, 2023
1 parent 7f650ac commit 89adbc6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions hack/make-rules/test-e2e-node.sh
Expand Up @@ -207,6 +207,8 @@ else
# Refresh sudo credentials if needed
if ping -c 1 -q metadata.google.internal &> /dev/null; then
echo 'Running on GCE, not asking for sudo credentials'
elif ping -c 1 -q 169.254.169.254 &> /dev/null; then
echo 'Running on AWS, not asking for sudo credentials'
elif sudo --non-interactive "$(which bash)" -c true 2> /dev/null; then
# if we can run bash without a password, it's a pretty safe bet that either
# we can run any command without a password, or that sudo credentials
Expand Down

0 comments on commit 89adbc6

Please sign in to comment.