Alex Lourie has uploaded a new change for review. Change subject: packaging: setup: run readonly user creation with non-empty user ......................................................................
packaging: setup: run readonly user creation with non-empty user Change-Id: I0478d8adb098f0c6e7999b16f75ee68377a6665a Bug-Url: https://bugzilla.redhat.com/1008562 Signed-off-by: Alex Lourie <alou...@redhat.com> --- M packaging/common_utils.py M packaging/ovirt-engine-dwh-setup.py 2 files changed, 14 insertions(+), 4 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-dwh refs/changes/47/19747/1 diff --git a/packaging/common_utils.py b/packaging/common_utils.py index 2bdfa2e..bf39680 100755 --- a/packaging/common_utils.py +++ b/packaging/common_utils.py @@ -260,7 +260,7 @@ def delParams(self, paramsDict): pass -def askQuestion(question=None, yesNo=False, options='', default=''): +def askQuestion(question, yesNo=False, options='', default=''): ''' provides an interface that prompts the user to answer "yes/no" to a given question @@ -603,6 +603,12 @@ @transactionDisplay('Creating read-only user') def createReadOnlyUser(database, user, password, secured): + if ( + user is None or + user is '' + ): + raise RuntimeError('Empty username provided!') + # Check whether we can create DB: global DB_ADMIN canCreateDb = False diff --git a/packaging/ovirt-engine-dwh-setup.py b/packaging/ovirt-engine-dwh-setup.py index 4b64078..ff452d0 100755 --- a/packaging/ovirt-engine-dwh-setup.py +++ b/packaging/ovirt-engine-dwh-setup.py @@ -340,6 +340,8 @@ utils.stopEtl() setVersion() + readUserCreated = False + errMsg = '' # Create/Upgrade DB if utils.localHost(db_dict['host']): @@ -348,8 +350,6 @@ # Handle postgres configuration for the read-only user # on local installations only - readUserCreated = False - errMsg = '' if db_dict['readonly'] is None: # Ask user how would the user be created createReadUser = utils.askYesNo( @@ -440,7 +440,11 @@ createDbSchema(db_dict) - if utils.localHost(db_dict["host"]): + if ( + utils.localHost(db_dict["host"]) and + readonly_user is not None and + readonly_user is not '' + ): # Create read only readUserCreated, errMsg = utils.createReadOnlyUser( db_dict['dbname'], -- To view, visit http://gerrit.ovirt.org/19747 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0478d8adb098f0c6e7999b16f75ee68377a6665a 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