Skip to content

Commit b6328d9

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 2e9f9f1 commit b6328d9

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
@@ -211,7 +211,6 @@ int main (int argc, char *argv[])
211211
struct sigaction old_sigact_term;
212212
flux_msg_handler_t **handlers = NULL;
213213
const flux_conf_t *conf;
214-
const char *method;
215214
flux_error_t error;
216215

217216
setlocale (LC_ALL, "");
@@ -355,24 +354,23 @@ int main (int argc, char *argv[])
355354
init_attrs_starttime (ctx.attrs, ctx.starttime);
356355

357356
/* Execute broker network bootstrap.
358-
* Default method is pmi.
359-
* If [bootstrap] is defined in configuration, use static configuration.
360357
*/
361-
if (attr_get (ctx.attrs, "broker.boot-method", &method, NULL) < 0) {
358+
const char *boot_method;
359+
if (attr_get (ctx.attrs, "broker.boot-method", &boot_method, NULL) < 0) {
362360
if (flux_conf_unpack (conf, NULL, "{s:{}}", "bootstrap") == 0)
363-
method = "config";
361+
boot_method = "config";
364362
else
365-
method = NULL;
363+
boot_method = NULL;
366364
}
367-
if (!method || !streq (method, "config")) {
368-
if (boot_pmi (ctx.overlay, ctx.attrs) < 0) {
369-
log_msg ("bootstrap failed");
365+
if (boot_method && streq (boot_method, "config")) {
366+
if (boot_config (ctx.h, ctx.overlay, ctx.attrs) < 0) {
367+
log_msg ("boot-config failed");
370368
goto cleanup;
371369
}
372370
}
373371
else {
374-
if (boot_config (ctx.h, ctx.overlay, ctx.attrs) < 0) {
375-
log_msg ("bootstrap failed");
372+
if (boot_pmi (ctx.overlay, ctx.attrs) < 0) {
373+
log_msg ("boot-pmi failed");
376374
goto cleanup;
377375
}
378376
}

0 commit comments

Comments
 (0)