Alon Bar-Lev has uploaded a new change for review. Change subject: packaging: respect engine.conf.d ......................................................................
packaging: respect engine.conf.d Change-Id: I56403a37142d7292f12b338d4dc34ffa7de933a2 Signed-off-by: Alon Bar-Lev <alon.bar...@gmail.com> --- M data-warehouse/history_etl/history_service/history_service.sh M packaging/ovirt-engine-dwh-setup.py 2 files changed, 47 insertions(+), 16 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-dwh refs/changes/85/12685/1 diff --git a/data-warehouse/history_etl/history_service/history_service.sh b/data-warehouse/history_etl/history_service/history_service.sh index cfd9c08..f10ba10 100755 --- a/data-warehouse/history_etl/history_service/history_service.sh +++ b/data-warehouse/history_etl/history_service/history_service.sh @@ -1,7 +1,11 @@ #!/bin/bash -x # -. /etc/ovirt-engine/engine.conf +ENGINE_DEFAULTS="${ENGINE_DEFAULTS:-/usr/share/ovirt-engine/conf/engine.conf.defaults}" +ENGINE_VARS="${ENGINE_VARS:-/etc/ovirt-engine/engine.conf}" +for f in "${ENGINE_DEFAULTS}" "${ENGINE_VARS}" $(find "${ENGINE_VARS}.d" -name '*.conf' | sort); do + [ -r "${f}" ] && . "${f}" +done LOGFILE="/var/log/ovirt-engine/ovirt-engine-dwhd.log" ETL_HOME=/usr/share/ovirt-engine-dwh/etl diff --git a/packaging/ovirt-engine-dwh-setup.py b/packaging/ovirt-engine-dwh-setup.py index 0642bdc..cb08e42 100755 --- a/packaging/ovirt-engine-dwh-setup.py +++ b/packaging/ovirt-engine-dwh-setup.py @@ -16,6 +16,7 @@ import os import time import traceback +import glob import common_utils as utils from decorators import transactionDisplay log_file = None @@ -26,7 +27,8 @@ 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/engine.conf" +FILE_ENGINE_CONF_DEFAULTS = "/usr/share/ovirt-engine/conf/engine.conf.defaults" +FILE_ENGINE_CONF = "/etc/ovirt-engine/engine.conf" DB_NAME = "ovirt_engine_history" DB_USER_NAME = "postgres" DB_PORT = "5432" @@ -153,24 +155,49 @@ hostFqdn = None port = None - if not os.path.exists(FILE_WEB_CONF): - raise Exception("Could not find %s" % FILE_WEB_CONF) + if not os.path.exists(FILE_ENGINE_CONF_DEFAULTS): + raise Exception("Could not find %s" % FILE_ENGINE_CONF_DEFAULTS) + engineConfigFiles = [ + FILE_ENGINE_CONF_DEFAULTS, + FILE_ENGINE_CONF, + ] + engineConfigDir = FILE_ENGINE_CONF + ".d" + if os.path.isdir(engineConfigDir): + additionalEngineConfigFiles = glob.glob(engineConfigDir + "/*.conf") + additionalEngineConfigFiles.sort() + engineConfigFiles.extend(additionalEngineConfigFiles) - logging.debug("reading %s", FILE_WEB_CONF) - file_handler = utils.TextConfigFileHandler(FILE_WEB_CONF) - file_handler.open() - proxyEnabled = file_handler.getParam("ENGINE_PROXY_ENABLED") + config = dict( + ENGINE_PROXY_ENABLED=None, + ENGINE_PROXY_HTTPS_PORT=None, + ENGINE_PROXY_HTTP_PORT=None, + ENGINE_HTTPS_ENABLED=None, + ENGINE_HTTPS_PORT=None, + ENGINE_HTTP_PORT=None, + ENGINE_FQDN=None, + ) + for f in engineConfigFiles: + logging.debug("reading %s", f) + file_handler = utils.TextConfigFileHandler(f) + file_handler.open() + + for k in config.keys(): + v = file_handler.getParam(k) + if v is not None: + config[k] = v + + proxyEnabled = config["ENGINE_PROXY_ENABLED"] if proxyEnabled != None and proxyEnabled.lower() in ["true", "t", "yes", "y", "1"]: if secure: - port = file_handler.getParam("ENGINE_PROXY_HTTPS_PORT") + port = config["ENGINE_PROXY_HTTPS_PORT"] else: - port = file_handler.getParam("ENGINE_PROXY_HTTP_PORT") - elif file_handler.getParam("ENGINE_HTTPS_ENABLED"): + port = config["ENGINE_PROXY_HTTP_PORT"] + elif config["ENGINE_HTTPS_ENABLED"]: if secure: - port = file_handler.getParam("ENGINE_HTTPS_PORT") + port = config["ENGINE_HTTPS_PORT"] else: - port = file_handler.getParam("ENGINE_HTTP_PORT") - hostFqdn = file_handler.getParam("ENGINE_FQDN") + port = config["ENGINE_HTTP_PORT"] + hostFqdn = config["ENGINE_FQDN"] file_handler.close() if port and secure: logging.debug("Secure web port is: %s", port) @@ -180,10 +207,10 @@ logging.debug("Host's FQDN: %s", hostFqdn) if not hostFqdn: - logging.error("Could not find the HOST FQDN from %s", FILE_WEB_CONF) + logging.error("Could not find the HOST FQDN from %s", engineConfigFiles) raise Exception("Cannot find host fqdn from configuration, please verify that ovirt-engine is configured") if not port: - logging.error("Could not find the web port from %s", FILE_WEB_CONF) + logging.error("Could not find the web port from %s", engineConfigFiles) raise Exception("Cannot find the web port from configuration, please verify that ovirt-engine is configured") return (protocol, hostFqdn, port) -- To view, visit http://gerrit.ovirt.org/12685 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I56403a37142d7292f12b338d4dc34ffa7de933a2 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-dwh Gerrit-Branch: master Gerrit-Owner: Alon Bar-Lev <alo...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches