On Tue, 2019-07-23 at 08:17 +0200, Ulrich Windl wrote: > Hi! > > As suggested I'm considering to replace all "ocf_log err ..." > preceeding an error exit code with "ocf_exit_reason ..." in my OCF > RA. > However I have a question: Is it OK to call ocf_exit_reason more than > once before actually exiting? I assume the last message being used > will be the one displayed as reason then.
Correct. (I had to check -- ocf_exit_reason will print the message to stderr and log it, and pacemaker will parse stderr for the last occurrence.) > My RA code checks multiple parameters, logging each error (not > stopping at the first error if possible), like this: > > ... > if [ ! -x $isredir_bin ]; then > ocf_log err "$me: missing $isredir_bin" > result=$OCF_ERR_INSTALLED > fi > if [ "X${tag//[^-A-Za-z0-9._]/}" != "X${tag}" ]; then > ocf_log err "$me: invalid value $tag for \"tag\"" > result=$OCF_ERR_ARGS > fi > if [ "X${backlog//[^0-9]/}" != "X${backlog}" ]; then > ocf_log err "$me: invalid value $backlog for \"backlog\"" > result=$OCF_ERR_ARGS > fi > if [ -z "$dest_tsap" ]; then > ocf_log err "$me: missing value for \"dest\"" > result=$OCF_ERR_ARGS > elif [ "X${dest_tsap//[^-A-Za-z0-9._\\/]/}" != "X${dest_tsap}" ]; > then > ocf_log err "$me: invalid value $dest_tsap for \"dest\"" > result=$OCF_ERR_ARGS > fi > ... > > Regards, > Ulrich > > > _______________________________________________ > Manage your subscription: > https://lists.clusterlabs.org/mailman/listinfo/users > > ClusterLabs home: https://www.clusterlabs.org/ -- Ken Gaillot <kgail...@redhat.com> _______________________________________________ Manage your subscription: https://lists.clusterlabs.org/mailman/listinfo/users ClusterLabs home: https://www.clusterlabs.org/