From 36d244f0843e83e8c14a2ccd309a94715c93b57c Mon Sep 17 00:00:00 2001 From: Matthew Wong Date: Tue, 11 Apr 2017 14:19:30 -0400 Subject: [PATCH] Fix etcd semver validation by using 'sort -V' --- hack/lib/etcd.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hack/lib/etcd.sh b/hack/lib/etcd.sh index 5d55fd441e..4bfa16612d 100755 --- a/hack/lib/etcd.sh +++ b/hack/lib/etcd.sh @@ -36,12 +36,12 @@ kube::etcd::validate() { # validate installed version is at least equal to minimum version=$(etcd --version | tail -n +1 | head -n 1 | cut -d " " -f 3) - if [[ "${version}" < "${ETCD_VERSION}" ]]; then + if [[ "`echo -e "${version}\n${ETCD_VERSION}" | sort -rV | head -n 1`" != "$version" ]]; then export PATH=$KUBE_ROOT/third_party/etcd:$PATH hash etcd echo $PATH version=$(etcd --version | head -n 1 | cut -d " " -f 3) - if [[ "${version}" < "${ETCD_VERSION}" ]]; then + if [[ "`echo -e "${version}\n${ETCD_VERSION}" | sort -rV | head -n 1`" != "$version" ]]; then kube::log::usage "etcd version ${ETCD_VERSION} or greater required." kube::log::info "You can use 'hack/install-etcd.sh' to install a copy in third_party/." exit 1