Fix broken test in vagrant boostrap script

The file path was not properly passed to the '-x' test which caused it
to always return true.

This commit simplifies the test for existing command by relying only on
the exit code of `type` rather than checking that the file path is
executable.

Change-Id: Iaf47d92ff9fd1ef34d8d7492c08ec24d2b8a9536
Closes-Bug: #1635341
This commit is contained in:
Martin André 2016-10-20 18:11:26 +02:00
parent 4003763cbe
commit 193a8190ce
1 changed files with 3 additions and 3 deletions

View File

@ -24,13 +24,13 @@ REGISTRY=${REGISTRY_URL}:${REGISTRY_PORT}
ADMIN_PROTOCOL="http"
function _ensure_lsb_release {
if [[ -x $(type lsb_release 2>/dev/null) ]]; then
if type lsb_release >/dev/null 2>&1; then
return
fi
if [[ -x $(type apt-get 2>/dev/null) ]]; then
if type apt-get >/dev/null 2>&1; then
apt-get -y install lsb-release
elif [[ -x $(type yum 2>/dev/null) ]]; then
elif type yum >/dev/null 2>&1; then
yum -y install redhat-lsb-core
fi
}