Alex Lourie has uploaded a new change for review. Change subject: packaging: setup: getting vdc options value by quering DB directly ......................................................................
packaging: setup: getting vdc options value by quering DB directly This new implementation uses direct DB query for vdc options instead of engine-config usage. Change-Id: I77dbeaeececd3158d013ee01439ad89e7e46ab82 Signed-off-by: Alex Lourie <alou...@redhat.com> --- M packaging/common_utils.py M packaging/ovirt-engine-dwh-setup.py 2 files changed, 19 insertions(+), 16 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-dwh refs/changes/45/18745/1 diff --git a/packaging/common_utils.py b/packaging/common_utils.py index 26dca97..50bb810 100755 --- a/packaging/common_utils.py +++ b/packaging/common_utils.py @@ -127,24 +127,23 @@ return maskedStr -def getVDCOption(key): +def getVDCOption(key, db_dict, temp_pgpass): """ Get option_value from vdc_options per given key """ - cmd = [ - FILE_ENGINE_CONFIG_BIN, - "-g", - key, - "--cver=general", - "-p", - "/usr/share/ovirt-engine/conf/engine-config-install.properties", - ] - logging.debug("getting vdc option %s" % key) + sqlQuery = ''' + select option_value from vdc_options + where option_name like 'MinimalETLVersion' + ''' + out, rc = parseRemoteSqlCommand( + db_dict=db_dict, + sqlQuery=sqlQuery, + failOnError=True, + envDict={'ENGINE_PGPASS': temp_pgpass} + ) + logging.debug("Value of %s is %s" % (key, out[0]['option_value'])) - output, rc = execCmd(cmdList=cmd, failOnError=True, msg="Error: failed fetching configuration field %s" % key) - logging.debug("Value of %s is %s" % (key, output)) - - return output.rstrip() + return out[0]['option_value'] def _getColoredText (text, color): ''' gets text string and color diff --git a/packaging/ovirt-engine-dwh-setup.py b/packaging/ovirt-engine-dwh-setup.py index 56d1e84..eb95cab 100755 --- a/packaging/ovirt-engine-dwh-setup.py +++ b/packaging/ovirt-engine-dwh-setup.py @@ -257,6 +257,7 @@ logging.debug("starting main()") db_dict = getDbDictFromOptions() + PGPASS_TEMP = utils.createTempPgpass(db_dict) for dwh_path in ( DIR_DWH_CONFIG, DIR_DATABASE_DWH_CONFIG @@ -278,7 +279,11 @@ ) # Get minimal supported version from oVirt Engine - minimalVersion = utils.getVDCOption("MinimalETLVersion") + minimalVersion = utils.getVDCOption( + key="MinimalETLVersion", + db_dict=db_dict, + temp_pgpass=PGPASS_TEMP, + ) currentVersion = utils.getAppVersion(DWH_PACKAGE_NAME) if not isVersionSupported(minimalVersion, currentVersion): print "Minimal supported version (%s) is higher then installed version (%s), please update the %s package" % (minimalVersion, currentVersion, DWH_PACKAGE_NAME) @@ -296,7 +301,6 @@ setVersion() # Create/Upgrade DB - PGPASS_TEMP = utils.createTempPgpass(db_dict) if utils.localHost(db_dict['host']): pg_updated = utils.configHbaIdent() if dbExists(db_dict): -- To view, visit http://gerrit.ovirt.org/18745 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I77dbeaeececd3158d013ee01439ad89e7e46ab82 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-dwh Gerrit-Branch: master Gerrit-Owner: Alex Lourie <alou...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches