Skip to content

Commit 3d7e60e

Browse files
committed
broker: refactor bootstrap block
Problem: the code block that selects which boot method to use is not very clear. Simplify code block so that the default path is clear and adding a boot method won't increase complexity.
1 parent 89d7a8d commit 3d7e60e

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/broker/broker.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ int main (int argc, char *argv[])
224224
struct sigaction old_sigact_term;
225225
flux_msg_handler_t **handlers = NULL;
226226
const flux_conf_t *conf;
227-
const char *method;
228227
flux_error_t error;
229228

230229
setlocale (LC_ALL, "");
@@ -363,24 +362,23 @@ int main (int argc, char *argv[])
363362
init_attrs_starttime (ctx.attrs, ctx.starttime);
364363

365364
/* Execute broker network bootstrap.
366-
* Default method is pmi.
367-
* If [bootstrap] is defined in configuration, use static configuration.
368365
*/
369-
if (attr_get (ctx.attrs, "broker.boot-method", &method, NULL) < 0) {
366+
const char *boot_method;
367+
if (attr_get (ctx.attrs, "broker.boot-method", &boot_method, NULL) < 0) {
370368
if (flux_conf_unpack (conf, NULL, "{s:{}}", "bootstrap") == 0)
371-
method = "config";
369+
boot_method = "config";
372370
else
373-
method = NULL;
371+
boot_method = NULL;
374372
}
375-
if (!method || !streq (method, "config")) {
376-
if (boot_pmi (ctx.overlay, ctx.attrs) < 0) {
377-
log_msg ("bootstrap failed");
373+
if (boot_method && streq (boot_method, "config")) {
374+
if (boot_config (ctx.h, ctx.overlay, ctx.attrs) < 0) {
375+
log_msg ("boot-config failed");
378376
goto cleanup;
379377
}
380378
}
381379
else {
382-
if (boot_config (ctx.h, ctx.overlay, ctx.attrs) < 0) {
383-
log_msg ("bootstrap failed");
380+
if (boot_pmi (ctx.overlay, ctx.attrs) < 0) {
381+
log_msg ("boot-pmi failed");
384382
goto cleanup;
385383
}
386384
}

0 commit comments

Comments
 (0)