Hello Yedidyah Bar David,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/23046
to review the following change.
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/ovirt-engine-dwh-setup.py
1 file changed, 43 insertions(+), 37 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-dwh refs/changes/46/23046/1
diff --git a/packaging/ovirt-engine-dwh-setup.py
b/packaging/ovirt-engine-dwh-setup.py
index 6a76c4a..ead50ea 100755
--- a/packaging/ovirt-engine-dwh-setup.py
+++ b/packaging/ovirt-engine-dwh-setup.py
@@ -513,46 +513,52 @@
)
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['username'] = working_db_dict['username']
+ db_dict['password'] = working_db_dict['password']
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/23046
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibd68ae47e3b1b21b9cb79e0c351706d166941c9a
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-dwh
Gerrit-Branch: ovirt-3.3
Gerrit-Owner: Yaniv Dary <[email protected]>
Gerrit-Reviewer: Yedidyah Bar David <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches