use stderr for error echo message

Some echo message contain error or warning message which better be contain in
stderr. And futher more some error message already contain in stderr, but for
error message reader, the following information for that echo should be
contained as well.

Change-Id: I2aac631df19829218d446150c91cf6d50aa5e7e7
This commit is contained in:
ricolin 2015-11-27 09:23:13 +08:00 committed by Rico Lin
parent b445f42ff0
commit bb9d34c33f
4 changed files with 12 additions and 12 deletions

View File

@ -152,7 +152,7 @@ then
exit 0 exit 0
;; ;;
*) *)
echo "Invalid response." echo "Invalid response." >&2
exit 1 exit 1
esac esac
fi fi
@ -177,7 +177,7 @@ then
exit 0 exit 0
;; ;;
*) *)
echo "Invalid response." echo "Invalid response." >&2
exit 1 exit 1
esac esac
fi fi
@ -208,14 +208,14 @@ then
if [ "${MYSQL_ROOT_PW}" = "${PW2}" ] ; then if [ "${MYSQL_ROOT_PW}" = "${PW2}" ] ; then
PW_MATCH=1 PW_MATCH=1
else else
echo "Passwords did not match." echo "Passwords did not match." >&2
fi fi
done done
fi fi
echo "UPDATE mysql.user SET password = password('${MYSQL_ROOT_PW}') WHERE user = 'root'; DELETE FROM mysql.user WHERE user = ''; flush privileges;" | mysql -u root echo "UPDATE mysql.user SET password = password('${MYSQL_ROOT_PW}') WHERE user = 'root'; DELETE FROM mysql.user WHERE user = ''; flush privileges;" | mysql -u root
if ! [ $? -eq 0 ] ; then if ! [ $? -eq 0 ] ; then
echo "Failed to set password for 'root' MySQL user." echo "Failed to set password for 'root' MySQL user." >&2
exit 1 exit 1
fi fi
elif [ ! "${MYSQL_ROOT_PW+defined}" ] ; then elif [ ! "${MYSQL_ROOT_PW+defined}" ] ; then
@ -235,7 +235,7 @@ fi
echo "SELECT 1;" | mysql -u root ${MYSQL_ROOT_PW_ARG} > /dev/null echo "SELECT 1;" | mysql -u root ${MYSQL_ROOT_PW_ARG} > /dev/null
if ! [ $? -eq 0 ] if ! [ $? -eq 0 ]
then then
echo "Failed to connect to the MySQL server. Please check your root user credentials." echo "Failed to connect to the MySQL server. Please check your root user credentials." >&2
exit 1 exit 1
fi fi
echo "Verified connectivity to MySQL." echo "Verified connectivity to MySQL."
@ -292,7 +292,7 @@ rm $log_conf
echo "SELECT * FROM migrate_version;" | mysql -u heat --password=${MYSQL_HEAT_PW} heat > /dev/null echo "SELECT * FROM migrate_version;" | mysql -u heat --password=${MYSQL_HEAT_PW} heat > /dev/null
if ! [ $? -eq 0 ] if ! [ $? -eq 0 ]
then then
echo "Final sanity check failed." echo "Final sanity check failed." >&2
exit 1 exit 1
fi fi

View File

@ -122,7 +122,7 @@ get_user() {
if [ -n "$user_id" ]; then if [ -n "$user_id" ]; then
echo "Found existing $username user" >&2 echo "Found existing $username user" >&2
echo $user_id echo $user_id >&2
else else
echo "Creating $username user..." >&2 echo "Creating $username user..." >&2
get_id openstack user create $username \ get_id openstack user create $username \
@ -249,8 +249,8 @@ keystone_setup() {
fi fi
if [[ "$SERVICE_HOST" == "localhost" ]]; then if [[ "$SERVICE_HOST" == "localhost" ]]; then
echo "Warning: Endpoints will be registered as localhost, but this usually won't work." echo "Warning: Endpoints will be registered as localhost, but this usually won't work." >&2
echo "Set SERVICE_HOST to a publicly accessible hostname/IP instead." echo "Set SERVICE_HOST to a publicly accessible hostname/IP instead." >&2
fi fi
echo ADMIN_ROLE $ADMIN_ROLE echo ADMIN_ROLE $ADMIN_ROLE

View File

@ -23,7 +23,7 @@ cleanup() {
set +o errexit set +o errexit
echo "*********************************************************************" echo "*********************************************************************"
echo "ERROR: Abort $0" echo "ERROR: Abort $0" >&2
echo "*********************************************************************" echo "*********************************************************************"
# Kill ourselves to signal any calling process # Kill ourselves to signal any calling process

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
if [ $EUID -ne 0 ]; then if [ $EUID -ne 0 ]; then
echo "This script must be run as root." echo "This script must be run as root." >&2
exit exit
fi fi
@ -18,4 +18,4 @@ if [ $have_pip -eq 1 ]; then
fi fi
echo "pip-python not found. install package (probably python-pip) or run echo "pip-python not found. install package (probably python-pip) or run
'easy_install pip', then rerun $0"; 'easy_install pip', then rerun $0" >&2;