Try to get endpoint from "dhcp-server-identifier"

This commit is contained in:
Reyk Floeter 2018-01-10 15:10:58 +01:00
commit ee473a4bd6
5 changed files with 74 additions and 64 deletions

View file

@ -34,7 +34,8 @@ static int openstack_fetch(struct system_config *);
int
openstack(struct system_config *sc)
{
if ((sc->sc_endpoint = strdup("169.254.169.254")) == NULL) {
if ((dhcp_getendpoint(sc) == -1) &&
(sc->sc_endpoint = strdup(DEFAULT_ENDPOINT)) == NULL) {
log_warnx("failed to set defaults");
return (-1);
}
@ -88,10 +89,8 @@ openstack_fetch(struct system_config *sc)
free(str);
}
/* userdata */
if ((sc->sc_userdata =
metadata(sc, "/openstack/latest/user-data", TEXT)) == NULL)
goto fail;
/* userdata (optional) */
sc->sc_userdata = metadata(sc, "/openstack/latest/user_data", TEXT);
ret = 0;
fail: