When checking files, it shouldn't exit when getting an non-zero results.
However, the scripts set -e at the begining.
In order to continue the following steps when the file doesn't exists, replace
all "return 0" or "return 1" to be "echo 0/1".
Change-Id: I28ea81d52182d4dc5db56d47abbfbc1761f17d81
Signed-off-by: xudan <xudan16@huawei.com>
check_file_exists() {
if [[ -f $1 ]]; then
check_file_exists() {
if [[ -f $1 ]]; then
}
change_cred_file_cacert_path() {
}
change_cred_file_cacert_path() {
- check_file_exists ${CACERT}
- if [[ $? == 0 ]]; then
+ exists=`check_file_exists ${CACERT}`
+ if [[ $exists == 0 ]]; then
echo "INFO: set ${INSTALLER_TYPE} openstack cacert file to be ${CACERT}"
if [[ ${INSTALLER_TYPE} == "compass" ]]; then
echo "export OS_CACERT=${CACERT}" >> ${OPENRC}
echo "INFO: set ${INSTALLER_TYPE} openstack cacert file to be ${CACERT}"
if [[ ${INSTALLER_TYPE} == "compass" ]]; then
echo "export OS_CACERT=${CACERT}" >> ${OPENRC}
}
change_cred_file_ext_net() {
}
change_cred_file_ext_net() {
- check_file_exists ${OPENRC}
- if [[ $? == 0 ]]; then
+ exists=`check_file_exists ${OPENRC}`
+ if [[ $exists == 0 ]]; then
echo "export EXTERNAL_NETWORK=${EXTERNAL_NETWORK}" >> ${OPENRC}
else
echo "ERROR: cannot find file $OPENRC. Please check if it is existing."
echo "export EXTERNAL_NETWORK=${EXTERNAL_NETWORK}" >> ${OPENRC}
else
echo "ERROR: cannot find file $OPENRC. Please check if it is existing."
- check_file_exists ${OPENRC}
- if [[ $? == 0 ]]; then
+ exists=`check_file_exists ${OPENRC}`
+ if [[ $exists == 0 ]]; then
echo "INFO: original openstack credentials file is"
cat $OPENRC
echo "INFO: change cacert file path in credentials file"
echo "INFO: original openstack credentials file is"
cat $OPENRC
echo "INFO: change cacert file path in credentials file"