Yaniv Dary has uploaded a new change for review. Change subject: packaging: fixed setup failure on missing file (#850330) ......................................................................
packaging: fixed setup failure on missing file (#850330) getHostParams was broken since a config file was removed. Reimplemented getHostParams to fetch this data from another source. https://bugzilla.redhat.com/850330 Change-Id: Ic3166c233dfd29a715b0d5ed80e4ff59d23b40ae Signed-off-by: Yaniv Dary <[email protected]> --- M packaging/common_utils.py M packaging/ovirt-engine-dwh-setup.py 2 files changed, 33 insertions(+), 29 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-dwh refs/changes/92/7392/1 diff --git a/packaging/common_utils.py b/packaging/common_utils.py index d091d05..0469534 100755 --- a/packaging/common_utils.py +++ b/packaging/common_utils.py @@ -129,6 +129,15 @@ fd.write(line) fd.close() + def getParam(self, param): + value = None + for line in self.data: + if not re.match("\s*#", line): + found = re.match("\s*%s\s*\%s\s*(.+)$" % (param, self.sep), line) + if found: + value = found.group(1) + return value + def editParam(self, param, value): changed = False for i, line in enumerate(self.data[:]): diff --git a/packaging/ovirt-engine-dwh-setup.py b/packaging/ovirt-engine-dwh-setup.py index fb2f2cb..c0a94b1 100755 --- a/packaging/ovirt-engine-dwh-setup.py +++ b/packaging/ovirt-engine-dwh-setup.py @@ -26,7 +26,7 @@ EXEC_CREATE_DB="%s/ovirt-engine-history-db-install.sh" % PATH_DB_SCRIPTS EXEC_UPGRADE_DB="upgrade.sh" FILE_DB_CONN = "/etc/ovirt-engine/ovirt-engine-dwh/Default.properties" -FILE_WEB_CONF = "/etc/ovirt-engine/web-conf.js" +FILE_WEB_CONF = "/etc/sysconfig/ovirt-engine" FILE_PG_PASS="/root/.pgpass" DB_USER_NAME = "postgres" DB_PORT = "5432" @@ -134,41 +134,36 @@ def getHostParams(secure=False): """ - get hostname & secured port from /etc/ovirt-engine/web-conf.js + get hostname & secured port from /etc/sysconfig/ovirt-engine """ - pattern = "var\shttp_port\s\=\s\"(\d+)\"" - if secure: - pattern = "var\shttps_port\s\=\s\"(\d+)\"" + hostFqdn = None + port = None - logging.debug("looking for configuration from %s", FILE_WEB_CONF) if not os.path.exists(FILE_WEB_CONF): raise Exception("Could not find %s" % FILE_WEB_CONF) logging.debug("reading %s", FILE_WEB_CONF) - fileObj = open(FILE_WEB_CONF, "r") - hostFqdn = None - port = None - - logging.debug("Itterating over file") - for line in fileObj.readlines(): - # var host_fqdn = "vm-18-12.eng.lab.tlv.redhat.com"; - line = line.strip() - found = re.search("var\shost_fqdn\s\=\s\"(\S+)\"", line) - if found: - hostFqdn = found.group(1) - logging.debug("host fqdn is: %s", hostFqdn) - # var http/https_port = "9443"; - found = re.search(pattern, line) - if found: - port = found.group(1) - if secure: - logging.debug("Secure web port is: %s", port) - else: - logging.debug("Web port is: %s", port) - - - fileObj.close() + file_handler = utils.TextConfigFileHandler(FILE_WEB_CONF) + file_handler.open() + if file_handler.getParam("ENGINE_PROXY_ENABLED"): + if secure: + port = file_handler.getParam("ENGINE_PROXY_HTTPS_PORT") + else: + port = file_handler.getParam("ENGINE_PROXY_HTTP_PORT") + elif file_handler.getParam("ENGINE_HTTPS_ENABLED"): + if secure: + port = file_handler.getParam("ENGINE_HTTPS_PORT") + else: + port = file_handler.getParam("ENGINE_HTTP_PORT") + hostFqdn = file_handler.getParam("ENGINE_FQDN") + file_handler.close() + if port and secure: + logging.debug("Secure web port is: %s", port) + elif port and not secure: + logging.debug("Web port is: %s", port) + if hostFqdn: + logging.debug("Host's FQDN: %s", hostFqdn) if not hostFqdn: logging.error("Could not find the HOST FQDN from %s", FILE_WEB_CONF) -- To view, visit http://gerrit.ovirt.org/7392 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic3166c233dfd29a715b0d5ed80e4ff59d23b40ae Gerrit-PatchSet: 1 Gerrit-Project: ovirt-dwh Gerrit-Branch: master Gerrit-Owner: Yaniv Dary <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
