1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

ctdb-daemon: Improve error messages when eventscript control is cancelled

Warn specifically about cancellation instead of printing a generic
error message.  Also pass back an error message for the tool - it
could just rely on the status but it already looks at the error
message.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2015-07-06 12:02:00 +10:00 committed by Amitay Isaacs
parent b71d18d2dc
commit 122a4fda72

View File

@ -910,14 +910,23 @@ struct eventscript_callback_state {
static void run_eventscripts_callback(struct ctdb_context *ctdb, int status,
void *private_data)
{
const char *errmsg = NULL;
struct eventscript_callback_state *state =
talloc_get_type(private_data, struct eventscript_callback_state);
if (status != 0) {
DEBUG(DEBUG_ERR,(__location__ " Failed to run eventscripts\n"));
if (status == -ECANCELED) {
DEBUG(DEBUG_WARNING,
(__location__ " Eventscript cancelled\n"));
errmsg = "cancelled";
} else {
DEBUG(DEBUG_ERR,
(__location__ " Failed to run eventscripts\n"));
}
}
ctdb_request_control_reply(ctdb, state->c, NULL, status, NULL);
ctdb_request_control_reply(ctdb, state->c, NULL, status, errmsg);
/* This will free the struct ctdb_event_script_state we are in! */
talloc_free(state);
return;