Skip to content

Commit

Permalink
Fix: crmadmin: return error if DC is not elected #2902 #3606
Browse files Browse the repository at this point in the history
If the DC is not yet elected, the crmadmin will return an error.
(This change complements #3606).
  • Loading branch information
Aleksei Burlakov committed Nov 2, 2024
1 parent 26f9591 commit aac55a2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 1 addition & 2 deletions lib/pacemaker/pcmk_cluster_queries.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,7 @@ designated_controller_event_cb(pcmk_ipc_api_t *controld_api,
}

reply = (const pcmk_controld_api_reply_t *) event_data;
out->message(out, "dc", reply->host_from);
data->rc = pcmk_rc_ok;
data->rc = out->message(out, "dc", reply->host_from);
}

/*!
Expand Down
8 changes: 6 additions & 2 deletions lib/pacemaker/pcmk_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -887,9 +887,13 @@ dc(pcmk__output_t *out, va_list args)
{
const char *dc = va_arg(args, const char *);

return out->info(out, "Designated Controller is: %s",
int rc = out->info(out, "Designated Controller is: %s",
pcmk__s(dc, "not yet elected"));
}
if (dc)
return rc;
else
return pcmk_rc_undetermined;
}

PCMK__OUTPUT_ARGS("dc", "const char *")
static int
Expand Down

0 comments on commit aac55a2

Please sign in to comment.