diff options
author | Martin Schwenke <martin@meltin.net> | 2011-08-31 15:38:55 +1000 |
---|---|---|
committer | Martin Schwenke <martin@meltin.net> | 2011-08-31 15:38:55 +1000 |
commit | 54a67a8e1cf33d11b146ddaab12831cae642769c (patch) | |
tree | 6889a1e99e7a77d079bd87d3fc0fc7fe9fd16fb5 | |
parent | 91d5edee80fd103827b12c867081ad8573aaef22 (diff) | |
parent | 205c7c7663210abee37521edb2742cf6be54b11e (diff) | |
download | samba-54a67a8e1cf33d11b146ddaab12831cae642769c.tar.gz samba-54a67a8e1cf33d11b146ddaab12831cae642769c.tar.xz samba-54a67a8e1cf33d11b146ddaab12831cae642769c.zip |
Merge branch 'eventscripts' into tests
(This used to be ctdb commit 1c9dadf02ca649e3f09d9edd778bf13e001aa849)
-rwxr-xr-x | ctdb/config/functions | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/ctdb/config/functions b/ctdb/config/functions index 307b212f64..5ca7d8e693 100755 --- a/ctdb/config/functions +++ b/ctdb/config/functions @@ -1056,9 +1056,37 @@ ctdb_reconfigure_try_lock () ctdb_replay_monitor_status () { echo "Replaying previous status for this script due to reconfigure..." - ctdb scriptstatus -Y | \ - grep -q -F ":${script_name}:0:OK:" - exit $? + # Leading colon (':') is missing in some versions... + _out=$(ctdb scriptstatus -Y | grep -E "^:?monitor:${script_name}:") + # Output looks like this: + # :monitor:60.nfs:1:ERROR:1314764004.030861:1314764004.035514:foo bar: + # This is the cheapest way of getting fields in the middle. + set -- $(IFS=":" ; echo $_out) + _code="$3" + _status="$4" + # The error output field can include colons so we'll try to + # preserve them. The weak checking at the beginning tries to make + # this work for both broken (no leading ':') and fixed output. + _out="${_out%:}" + _err_out="${_out#*monitor:${script_name}:*:*:*:*:}" + case "$_status" in + OK) : ;; # Do nothing special. + TIMEDOUT) + # Recast this as an error, since we can't exit with the + # correct negative number. + _code=1 + _err_out="[Replay of TIMEDOUT scriptstatus - note incorrect return code.] ${_err_out}" + ;; + DISABLED) + # Recast this as an OK, since we can't exit with the + # correct negative number. + _code=0 + _err_out="[Replay of DISABLED scriptstatus - note incorrect return code.] ${_err_out}" + ;; + *) : ;; # Must be ERROR, do nothing special. + esac + echo "$_err_out" + exit $_code } ctdb_service_check_reconfigure () |