[rabbitmq-discuss] [PATCH 04 of 10] OCF resource agent: on error, exit, don't return
Florian Haas
florian.haas at linbit.com
Tue May 11 18:09:41 BST 2010
# HG changeset patch
# User Florian Haas <florian.haas at linbit.com>
# Date 1273593909 -7200
# Node ID f0a7e4621b20a35c6cf20b2393d7d6b3f02fbc7b
# Parent 62ca42a0d9e9ee39a7c4348795693c1a71af269b
OCF resource agent: on error, exit, don't return
When they encounter an error condition, OCF RAs can simply exit. No
need to return from the relevant functions.
diff -r 62ca42a0d9e9 -r f0a7e4621b20 packaging/common/rabbitmq-server.ocf
--- a/packaging/common/rabbitmq-server.ocf Tue May 11 17:50:42 2010 +0200
+++ b/packaging/common/rabbitmq-server.ocf Tue May 11 18:05:09 2010 +0200
@@ -204,34 +204,34 @@
rabbit_validate_partial() {
if [ ! -x $RABBITMQ_MULTI ]; then
ocf_log err "rabbitmq-server multi $RABBITMQ_MULTI does not exist or is not executable";
- return $OCF_ERR_ARGS;
+ exit $OCF_ERR_ARGS;
fi
if [ ! -x $RABBITMQ_CTL ]; then
ocf_log err "rabbitmq-server ctl $RABBITMQ_CTL does not exist or is not executable";
- return $OCF_ERR_ARGS;
+ exit $OCF_ERR_ARGS;
fi
}
rabbit_validate_full() {
if [ ! -z $RABBITMQ_CLUSTER_CONFIG_FILE ] && [ ! -e $RABBITMQ_CLUSTER_CONFIG_FILE ]; then
ocf_log err "rabbitmq-server cluster_config_file $RABBITMQ_CLUSTER_CONFIG_FILE does not exist or is not a file";
- return $OCF_ERR_ARGS;
+ exit $OCF_ERR_ARGS;
fi
if [ ! -z $RABBITMQ_CONFIG_FILE ] && [ ! -e $RABBITMQ_CONFIG_FILE ]; then
ocf_log err "rabbitmq-server config_file $RABBITMQ_CONFIG_FILE does not exist or is not a file";
- return $OCF_ERR_ARGS;
+ exit $OCF_ERR_ARGS;
fi
if [ ! -z $RABBITMQ_LOG_BASE ] && [ ! -d $RABBITMQ_LOG_BASE ]; then
ocf_log err "rabbitmq-server log_base $RABBITMQ_LOG_BASE does not exist or is not a directory";
- return $OCF_ERR_ARGS;
+ exit $OCF_ERR_ARGS;
fi
if [ ! -z $RABBITMQ_MNESIA_BASE ] && [ ! -d $RABBITMQ_MNESIA_BASE ]; then
ocf_log err "rabbitmq-server mnesia_base $RABBITMQ_MNESIA_BASE does not exist or is not a directory";
- return $OCF_ERR_ARGS;
+ exit $OCF_ERR_ARGS;
fi
rabbit_validate_partial
@@ -252,7 +252,7 @@
;;
*)
ocf_log err "Unexpected return from rabbitmqctl $NODENAME_ARG status: $rc"
- return $OCF_ERR_GENERIC
+ exit $OCF_ERR_GENERIC
esac
}
@@ -285,7 +285,7 @@
elif [ "$rc" != $OCF_NOT_RUNNING ]; then
ocf_log info "rabbitmq-server start failed: $rc"
- return $OCF_ERR_GENERIC
+ exit $OCF_ERR_GENERIC
fi
sleep 2
done
@@ -320,7 +320,7 @@
break
elif [ "$rc" != $OCF_SUCCESS ]; then
ocf_log info "rabbitmq-server stop failed: $rc"
- return $OCF_ERR_GENERIC
+ exit $OCF_ERR_GENERIC
fi
sleep 2
done
@@ -345,9 +345,9 @@
esac
if ocf_is_probe; then
- rabbit_validate_partial || exit
+ rabbit_validate_partial
else
- rabbit_validate_full || exit
+ rabbit_validate_full
fi
case $__OCF_ACTION in
More information about the rabbitmq-discuss
mailing list