aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcaoyuan <cao.yuan@99cloud.net>2016-09-13 23:40:01 +0800
committercaoyuan <cao.yuan@99cloud.net>2016-09-16 09:13:13 +0800
commitd48cc50e9e56fac2d6cad6cf13cf37746014441a (patch)
treef95287050e9463bd293062da14ea1c2baa2a36f1
parent0d28b311eb351ab93518dea4355316fa9fa50a27 (diff)
downloadkolla-d48cc50e9e56fac2d6cad6cf13cf37746014441a.tar.gz
kolla-d48cc50e9e56fac2d6cad6cf13cf37746014441a.zip
Use "type" to take place of "which" and update the output
When run tools/init-runonce without some client installed,it's retrun not friendly and confuse people,such as user does not install python-openstackclient, it will return "openstack not installed".This patch update it. Use "type" command to avoid "which" TrivialFix Change-Id: I53789a767b3a2727bf2cb848c2881272e313e14c
-rwxr-xr-xtools/init-runonce12
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/init-runonce b/tools/init-runonce
index ffd6dd87e..054386c68 100755
--- a/tools/init-runonce
+++ b/tools/init-runonce
@@ -12,10 +12,14 @@ unset LANGUAGE
LC_ALL=C
export LC_ALL
for i in curl nova neutron openstack; do
- if [[ ! $(which $i) ]]; then
- echo "$i not installed. Please install $i before proceeding"
- exit 1
- fi
+ if [[ ! $(type $i 2>/dev/null) ]]; then
+ if [ "$i" == 'curl' ]; then
+ echo "$i not installed. Please install $i before proceeding"
+ else
+ echo "python-${i}client not installed. Please install python-${i}client before proceeding"
+ fi
+ exit
+ fi
done
# Move to top level directory
REAL_PATH=$(python -c "import os,sys;print os.path.realpath('$0')")