Selaa lähdekoodia

AMBARI-13140. Ambari QE Deploy Test: ambari-server failed to start with SQLA due to invalid credentials.(vbrodetskyi)

Vitaly Brodetskyi 10 vuotta sitten
vanhempi
commit
535e752a66

+ 3 - 3
ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py

@@ -117,7 +117,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
@@ -189,8 +189,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:

+ 13 - 0
ambari-server/src/test/python/TestAmbariServer.py

@@ -6472,6 +6472,19 @@ class TestAmbariServer(TestCase):
     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")