-
Notifications
You must be signed in to change notification settings - Fork 40.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix validate-cluster.sh to work on Mac. #7147
Conversation
This should fix issue #7139. |
LGTM. Thanks for the quick fix! |
SED=gsed | ||
fi | ||
if ! ("$SED" --version 2>&1 | grep -q GNU); then | ||
echo "!!! GNU sed is required. If on OS X, use 'brew install gnu-sed'." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This really can't operate with BSD sed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I'm asking because the user is deep into cluster creation at this point, and you just bombed out.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason, it works with the BSD sed in Yosemite. But seems to fail on Maverick (OS X 10.9). Rather than keep fighting it, this works for all... :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're going to force this, please move it to https://github.com/GoogleCloudPlatform/kubernetes/blob/master/cluster/gce/util.sh#L30
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum, that is a better idea, though not sure if I want to do this check for everyone... Bombing out at the end also sounds bad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, --posix
on Linux agrees with Mavericks:
$ cluster/kubectl.sh get cs | sed --posix -n 's/^\([[:alnum:][:punct:]]\+\)\s\+\([[:alnum:][:punct:]]\+\)\s\+.*/\2/p'
current-context: "artful-fortress-786_e2e-test-zml"
Running: cluster/../cluster/gce/../../cluster/../_output/dockerized/bin/linux/amd64/kubectl get cs
$
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got an alternative regex here: https://github.com/fabioy/kubernetes/blob/validate.fix.2/cluster/validate-cluster.sh
Just need confirmation it works on the various platforms.
Updated this with the final, non-GNU checking, simple regex version. Could you do one final verify on your Mac and then merge if it works? Thank you. |
|
Fix validate-cluster.sh to work on Mac.
This should enable it to work on OS X Mavericks and Yosemite.