Skip to content

Commit a35d796

Browse files
author
Aleksei Burlakov
committed
Fix: crmadmin: return error if DC is not elected #2902 #3606
If the DC is not yet elected, the crmadmin will return an error. (This change accomplishes #3606).
1 parent 26f9591 commit a35d796

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

lib/pacemaker/pcmk_cluster_queries.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,7 @@ designated_controller_event_cb(pcmk_ipc_api_t *controld_api,
234234
}
235235

236236
reply = (const pcmk_controld_api_reply_t *) event_data;
237-
out->message(out, "dc", reply->host_from);
238-
data->rc = pcmk_rc_ok;
237+
data->rc = out->message(out, "dc", reply->host_from);
239238
}
240239

241240
/*!

lib/pacemaker/pcmk_output.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -887,9 +887,13 @@ dc(pcmk__output_t *out, va_list args)
887887
{
888888
const char *dc = va_arg(args, const char *);
889889

890-
return out->info(out, "Designated Controller is: %s",
890+
int rc = out->info(out, "Designated Controller is: %s",
891891
pcmk__s(dc, "not yet elected"));
892-
}
892+
if (dc)
893+
return rc;
894+
else
895+
return pcmk_rc_undetermined;
896+
}
893897

894898
PCMK__OUTPUT_ARGS("dc", "const char *")
895899
static int

0 commit comments

Comments
 (0)