Change the condition of success or failure of notifying

This patch fixed so that failure messages of notifying are output
when the retuen value of notifying is not 0.
With this fix, the success message is output only when the return
value of notifying is 0, and when the other return value, the
failure message is output.
And, this patch also fixed the problem of return value conditions
other than when notifying.

Change-Id: Ic72cf7226b226a045f5154ba91e2e9758e2cc9db
Closes-Bug: #1676338
This commit is contained in:
Kengo Takahara 2017-03-29 16:11:52 +09:00
parent 2cd33fa3ee
commit 7e8c8558b4
2 changed files with 13 additions and 11 deletions

View File

@ -792,11 +792,11 @@ send_notification () {
RESP=`openstack ${AUTH_INFO} notification create ${TYPE} ${P_HOST} "${TIME}" "${PAYLOAD}"`
result=$?
if [ $result -eq 1 ]; then
log_info "$1 info : Failed to send a notification. [exit-code: $result]"
if [ $result -eq 0 ]; then
log_info "$1 info : Succeeded in sending a notification."
log_info "$1 info : $RESP"
else
log_info "$1 info : Succeeded in sending a notification."
log_info "$1 info : Failed to send a notification. [exit-code: $result]"
log_info "$1 info : $RESP"
fi
@ -835,8 +835,9 @@ do
# Check whether HB line is normal.
check_hb_line
if [ $? -ne 0 ]; then
case $? in
ret=$?
if [ $ret -ne 0 ]; then
case $ret in
1)
sleep $STONITH_WAIT
;;
@ -853,8 +854,9 @@ do
# cluster stack of corosync.
if ! is_pacemaker_remote ; then
check_hb_status
if [ $? -ne 0 ]; then
case $? in
ret=$?
if [ $ret -ne 0 ]; then
case $ret in
1)
script_finalize 0
;;

View File

@ -293,13 +293,13 @@ send_notification () {
RESP=`openstack ${AUTH_INFO} notification create ${TYPE} ${P_HOST} "${TIME}" "${PAYLOAD}"`
result=$?
if [ $result -eq 1 ]; then
if [ $result -eq 0 ]; then
log_info "info : Succeeded in sending a notification."
log_info "info : $RESP"
else
log_info "info : Failed to send a notification. [exit-code: $result]"
log_info "info : $RESP"
MASAKARI_API_SEND_FAIL_FLG="on"
else
log_info "info : Succeeded in sending a notification."
log_info "info : $RESP"
fi
return