diff --git a/agent/azure.c b/agent/azure.c index 604433f..4746247 100644 --- a/agent/azure.c +++ b/agent/azure.c @@ -653,17 +653,27 @@ azure_getovfenv(struct system_config *sc) int mount = 0, ret = -1, fd = -1; FILE *fp; - /* try to mount the cdrom */ - if (shell("mount", "-r", sc->sc_cdrom, "/mnt", NULL) == 0) { + /* Silently try to mount the cdrom */ + fd = disable_output(sc, STDERR_FILENO); + ret = shell("mount", "-r", sc->sc_cdrom, "/mnt", NULL); + enable_output(sc, STDERR_FILENO, fd); + fd = -1; + + if (ret == 0) { log_debug("%s: mounted %s", __func__, sc->sc_cdrom); mount = 1; } + ret = -1; if (xml_init(&xml) != 0) { log_debug("%s: xml", __func__); goto done; } - xml_parse(&xml, "/mnt/ovf-env.xml"); + + /* Fallback to and older ovf-env.xml file */ + if (xml_parse(&xml, "/mnt/ovf-env.xml") == -1 && + xml_parse(&xml, sc->sc_ovfenv) == -1) + goto done; /* unmount if we mounted the cdrom before */ if (mount && shell("umount", "/mnt", NULL) == 0) { diff --git a/agent/xml.c b/agent/xml.c index 7a29f8d..c971562 100644 --- a/agent/xml.c +++ b/agent/xml.c @@ -341,8 +341,10 @@ xml_parse(struct xml *env, const char *file) void *xml; ssize_t len; - if ((fd = open(file, O_RDONLY)) == -1) - fatal("open %s", file); + if ((fd = open(file, O_RDONLY)) == -1) { + log_debug("%s: open %s", __func__, file); + return (-1); + } do { if ((xml = XML_GetBuffer(parser, BUFSIZ)) == NULL)