Skip to content

Commit 80536ca

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 ba3c3be commit 80536ca

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
@@ -200,7 +200,6 @@ int main (int argc, char *argv[])
200200
struct sigaction old_sigact_term;
201201
flux_msg_handler_t **handlers = NULL;
202202
const flux_conf_t *conf;
203-
const char *method;
204203
flux_error_t error;
205204

206205
memset (&ctx, 0, sizeof (ctx));
@@ -340,24 +339,23 @@ int main (int argc, char *argv[])
340339
init_attrs_starttime (ctx.attrs, ctx.starttime);
341340

342341
/* Execute broker network bootstrap.
343-
* Default method is pmi.
344-
* If [bootstrap] is defined in configuration, use static configuration.
345342
*/
346-
if (attr_get (ctx.attrs, "broker.boot-method", &method, NULL) < 0) {
343+
const char *boot_method;
344+
if (attr_get (ctx.attrs, "broker.boot-method", &boot_method, NULL) < 0) {
347345
if (flux_conf_unpack (conf, NULL, "{s:{}}", "bootstrap") == 0)
348-
method = "config";
346+
boot_method = "config";
349347
else
350-
method = NULL;
348+
boot_method = NULL;
351349
}
352-
if (!method || !streq (method, "config")) {
353-
if (boot_pmi (ctx.overlay, ctx.attrs) < 0) {
354-
log_msg ("bootstrap failed");
350+
if (boot_method && streq (boot_method, "config")) {
351+
if (boot_config (ctx.h, ctx.overlay, ctx.attrs) < 0) {
352+
log_msg ("boot-config failed");
355353
goto cleanup;
356354
}
357355
}
358356
else {
359-
if (boot_config (ctx.h, ctx.overlay, ctx.attrs) < 0) {
360-
log_msg ("bootstrap failed");
357+
if (boot_pmi (ctx.overlay, ctx.attrs) < 0) {
358+
log_msg ("boot-pmi failed");
361359
goto cleanup;
362360
}
363361
}

0 commit comments

Comments
 (0)