Skip to content

Commit

Permalink
confd: skip lldpd and avahi hostname reload during bootstrap
Browse files Browse the repository at this point in the history
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
  • Loading branch information
troglobit committed Jul 31, 2023
1 parent 9c0cdf0 commit 73f7cc0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/confd/src/confd/ietf-interfaces.c
Original file line number Diff line number Diff line change
Expand Up @@ -1063,8 +1063,10 @@ static int ifchange(sr_session_ctx_t *session, uint32_t sub_id, const char *modu
case SR_EV_CHANGE:
break;
case SR_EV_ABORT:
DEBUG("Calling dagger abort ...");
return dagger_abandon(&confd->netdag);
case SR_EV_DONE:
DEBUG("Calling dagger evolve ...");
return dagger_evolve_or_abandon(&confd->netdag);
default:
return SR_ERR_OK;
Expand Down Expand Up @@ -1095,7 +1097,9 @@ static int ifchange(sr_session_ctx_t *session, uint32_t sub_id, const char *modu
lydx_get_cattr(cif, "name")))
break;

DEBUG("Generating configuration for iface %s ...", lydx_get_cattr(dif, "name"));
err = netdag_gen_iface(&confd->netdag, dif, cif);
DEBUG("Generating configuration done, err %d ...", err);
if (err)
break;
}
Expand Down
11 changes: 10 additions & 1 deletion src/confd/src/confd/ietf-system.c
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,10 @@ static int change_hostname(sr_session_ctx_t *session, uint32_t sub_id, const cha
goto err;
}

/* skip in bootstrap, lldpd and avahi have not started yet */
if (systemf("runlevel >/dev/null 2>&1"))
goto err;

/* Inform any running lldpd and avahi of the change ... */
systemf("lldpcli configure system hostname %s", nm);
systemf("avahi-set-host-name %s", nm);
Expand All @@ -977,10 +981,15 @@ static int change_hostname(sr_session_ctx_t *session, uint32_t sub_id, const cha
return err;
}

DEBUG("Saving files ...");
err = err ? : aug_save(confd->aug);
if (sys_reload_services())
DEBUG("Reloading services ...");
if (sys_reload_services()) {
DEBUG("Failed reloading services!");
return SR_ERR_SYS;
}

DEBUG("Reloaded services OK.");
return SR_ERR_OK;
}

Expand Down

0 comments on commit 73f7cc0

Please sign in to comment.