Repository: ambari Updated Branches: refs/heads/branch-2.1.2 12a65e6c5 -> e68bb1a79
AMBARI-13140. Ambari QE Deploy Test: ambari-server failed to start with SQLA due to invalid credentials.(vbrodetskyi) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e68bb1a7 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e68bb1a7 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e68bb1a7 Branch: refs/heads/branch-2.1.2 Commit: e68bb1a793dbd76313ebb7c361aac1a90eb13a55 Parents: 12a65e6 Author: Vitaly Brodetskyi <vbrodets...@hortonworks.com> Authored: Fri Sep 18 18:21:41 2015 +0300 Committer: Vitaly Brodetskyi <vbrodets...@hortonworks.com> Committed: Fri Sep 18 18:21:41 2015 +0300 ---------------------------------------------------------------------- .../main/python/ambari_server/dbConfiguration_linux.py | 6 +++--- ambari-server/src/test/python/TestAmbariServer.py | 13 +++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/e68bb1a7/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py b/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py index 53dba23..fc568bf7 100644 --- a/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py +++ b/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py @@ -114,7 +114,7 @@ class LinuxDBMSConfig(DBMSConfig): "followed by alphanumeric or _ or - characters", False ) - self.database_password = LinuxDBMSConfig._configure_database_password(True) + self.database_password = LinuxDBMSConfig._configure_database_password(True, self.database_password) self._display_db_properties() return True @@ -186,8 +186,8 @@ class LinuxDBMSConfig(DBMSConfig): return None @staticmethod - def _configure_database_password(showDefault=True): - passwordDefault = DEFAULT_PASSWORD + def _configure_database_password(showDefault=True, defaultPassword=DEFAULT_PASSWORD): + passwordDefault = defaultPassword if showDefault: passwordPrompt = 'Enter Database Password (' + passwordDefault + '): ' else: http://git-wip-us.apache.org/repos/asf/ambari/blob/e68bb1a7/ambari-server/src/test/python/TestAmbariServer.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/TestAmbariServer.py b/ambari-server/src/test/python/TestAmbariServer.py index addfce3..06b6331 100644 --- a/ambari-server/src/test/python/TestAmbariServer.py +++ b/ambari-server/src/test/python/TestAmbariServer.py @@ -5272,6 +5272,19 @@ MIIFHjCCAwYCCQDpHKOBI+Lt0zANBgkqhkiG9w0BAQUFADBRMQswCQYDVQQGEwJV pass + @not_for_platform(PLATFORM_WINDOWS) + def test_configure_database_password_silent(self): + + out = StringIO.StringIO() + sys.stdout = out + + set_silent(True) + result = LinuxDBMSConfig._configure_database_password(True, "CustomDefaultPasswd") + self.assertEquals("CustomDefaultPasswd", result) + + sys.stdout = sys.__stdout__ + pass + @patch("os.path.exists") @patch("ambari_server.setupSecurity.get_is_secure") @patch("ambari_server.setupSecurity.get_is_persisted")