Yedidyah Bar David has uploaded a new change for review.

Change subject: packaging: setup: Display a note for db credentials
......................................................................

packaging: setup: Display a note for db credentials

Allow making getCredentials display a note prior to asking for
credentials.

Change-Id: I4053b5426b1fcb64fda2697ad4310f4044b13d98
Bug-Url: https://bugzilla.redhat.com/1159789
Signed-off-by: Yedidyah Bar David <[email protected]>
---
M packaging/setup/ovirt_engine_setup/engine_common/database.py
1 file changed, 40 insertions(+), 24 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/39/35039/1

diff --git a/packaging/setup/ovirt_engine_setup/engine_common/database.py 
b/packaging/setup/ovirt_engine_setup/engine_common/database.py
index 7ac4b3d..11d15a9 100644
--- a/packaging/setup/ovirt_engine_setup/engine_common/database.py
+++ b/packaging/setup/ovirt_engine_setup/engine_common/database.py
@@ -622,7 +622,9 @@
         name,
         queryprefix,
         defaultdbenvkeys,
-        show_create_msg=False
+        show_create_msg=False,
+        note=None,
+        credsfile=None,
     ):
         interactive = None in (
             self.environment[self._dbenvkeys['host']],
@@ -632,30 +634,44 @@
             self.environment[self._dbenvkeys['password']],
         )
 
-        if interactive and show_create_msg:
-            self.dialog.note(
-                text=_(
-                    "\n"
-                    "ATTENTION\n"
-                    "\n"
-                    "Manual action required.\n"
-                    "Please create database for ovirt-engine use. "
-                    "Use the following commands as an example:\n"
-                    "\n"
-                    "create role {user} with login encrypted password '{user}'"
-                    ";\n"
-                    "create database {database} owner {user}\n"
-                    " template template0\n"
-                    " encoding 'UTF8' lc_collate 'en_US.UTF-8'\n"
-                    " lc_ctype 'en_US.UTF-8';\n"
-                    "\n"
-                    "Make sure that database can be accessed remotely.\n"
-                    "\n"
+        if interactive:
+            if note is None and credsfile:
+                note = _(
+                    "\nPlease provide the following credentials for the "
+                    "{name} database.\nThey should be found on the {name} "
+                    "server in '{credsfile}'.\n\n"
                 ).format(
-                    user=defaultdbenvkeys['user'],
-                    database=defaultdbenvkeys['database'],
-                ),
-            )
+                    name=name,
+                    credsfile=credsfile,
+                )
+
+            if note:
+                self.dialog.note(text=note)
+
+            if show_create_msg:
+                self.dialog.note(
+                    text=_(
+                        "\n"
+                        "ATTENTION\n"
+                        "\n"
+                        "Manual action required.\n"
+                        "Please create database for ovirt-engine use. "
+                        "Use the following commands as an example:\n"
+                        "\n"
+                        "create role {user} with login encrypted password "
+                        "'{user}';\n"
+                        "create database {database} owner {user}\n"
+                        " template template0\n"
+                        " encoding 'UTF8' lc_collate 'en_US.UTF-8'\n"
+                        " lc_ctype 'en_US.UTF-8';\n"
+                        "\n"
+                        "Make sure that database can be accessed remotely.\n"
+                        "\n"
+                    ).format(
+                        user=defaultdbenvkeys['user'],
+                        database=defaultdbenvkeys['database'],
+                    ),
+                )
 
         connectionValid = False
         while not connectionValid:


-- 
To view, visit http://gerrit.ovirt.org/35039
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4053b5426b1fcb64fda2697ad4310f4044b13d98
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Yedidyah Bar David <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to