Yedidyah Bar David has uploaded a new change for review. Change subject: packaging: setup: fix ugprade with remote db ......................................................................
packaging: setup: fix ugprade with remote db Change-Id: Ibd68ae47e3b1b21b9cb79e0c351706d166941c9a Bug-Url: https://bugzilla.redhat.com/1046676 Signed-off-by: Yedidyah Bar David <[email protected]> --- M packaging/legacy-setup/ovirt-engine-dwh-setup.py 1 file changed, 42 insertions(+), 37 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-dwh refs/changes/61/22961/1 diff --git a/packaging/legacy-setup/ovirt-engine-dwh-setup.py b/packaging/legacy-setup/ovirt-engine-dwh-setup.py index a931a95..d0c1c96 100755 --- a/packaging/legacy-setup/ovirt-engine-dwh-setup.py +++ b/packaging/legacy-setup/ovirt-engine-dwh-setup.py @@ -508,46 +508,51 @@ ) dbExists, owned, hasData, working_db_dict = getDBStatus(db_dict, PGPASS_TEMP) - if not utils.localHost(db_dict["host"]) and not hasData: - print 'Remote installation is selected.\n' - - dbExists, tmpowned, tmphasData = utils.dbExists(db_dict, PGPASS_TEMP) - if options['REMOTE_DB_USER'] is None: - while not dbExists: - ( - db_dict['username'], - db_dict['password'], - ) = getDbCredentials( - userdefault=db_dict['username'], - ) - if os.path.exists(PGPASS_TEMP): - os.remove(PGPASS_TEMP) - PGPASS_TEMP = utils.createTempPgpass(db_dict) - dbExists, tmpowned, tmphasData = utils.dbExists(db_dict, PGPASS_TEMP) - if not dbExists: - print 'Could not connect to remote database - please try again.\n' + if not utils.localHost(db_dict["host"]): + # remote + if hasData: + # upgrade + db_dict = working_db_dict else: - db_dict['username'] = options['REMOTE_DB_USER'] - db_dict['password'] = options['REMOTE_DB_PASSWORD'] + print 'Remote installation is selected.\n' - if os.path.exists(PGPASS_TEMP): - os.remove(PGPASS_TEMP) - PGPASS_TEMP = utils.createTempPgpass(db_dict) - dbExists, owned, hasData, working_db_dict = getDBStatus(db_dict, PGPASS_TEMP) - if not dbExists: - raise RuntimeError ( - ( - 'Remote installation failed. Please perform ' - '\tcreate role {role} with login ' - 'encrypted password {password};\n' - '\tcreate {db} owner {role}\n' - 'on the remote DB, verify it and rerun the setup.' - ).format( - role=db_dict['username'], - db=db_dict['dbname'], - password=db_dict['password'], + dbExists, tmpowned, tmphasData = utils.dbExists(db_dict, PGPASS_TEMP) + if options['REMOTE_DB_USER'] is None: + while not dbExists: + ( + db_dict['username'], + db_dict['password'], + ) = getDbCredentials( + userdefault=db_dict['username'], + ) + if os.path.exists(PGPASS_TEMP): + os.remove(PGPASS_TEMP) + PGPASS_TEMP = utils.createTempPgpass(db_dict) + dbExists, tmpowned, tmphasData = utils.dbExists(db_dict, PGPASS_TEMP) + if not dbExists: + print 'Could not connect to remote database - please try again.\n' + else: + db_dict['username'] = options['REMOTE_DB_USER'] + db_dict['password'] = options['REMOTE_DB_PASSWORD'] + + if os.path.exists(PGPASS_TEMP): + os.remove(PGPASS_TEMP) + PGPASS_TEMP = utils.createTempPgpass(db_dict) + dbExists, owned, hasData, working_db_dict = getDBStatus(db_dict, PGPASS_TEMP) + if not dbExists: + raise RuntimeError ( + ( + 'Remote installation failed. Please perform ' + '\tcreate role {role} with login ' + 'encrypted password {password};\n' + '\tcreate {db} owner {role}\n' + 'on the remote DB, verify it and rerun the setup.' + ).format( + role=db_dict['username'], + db=db_dict['dbname'], + password=db_dict['password'], + ) ) - ) if dbExists: try: -- To view, visit http://gerrit.ovirt.org/22961 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibd68ae47e3b1b21b9cb79e0c351706d166941c9a Gerrit-PatchSet: 1 Gerrit-Project: ovirt-dwh Gerrit-Branch: master Gerrit-Owner: Yedidyah Bar David <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
