Explorar el Código

AMBARI-3479. During ambari-server setup-security (jaas/https) default value should be visible to users(Artem Baranchuk via odiachenko)

Oleksandr Diachenko hace 11 años
padre
commit
3571423f61

+ 1 - 1
ambari-server/src/main/python/ambari-server.py

@@ -3652,7 +3652,7 @@ def setup_ambari_krb5_jaas():
     print 'Setting up Ambari kerberos JAAS configuration to access ' +\
           'secured Hadoop daemons...'
     principal = get_validated_string_input('Enter ambari server\'s kerberos '
-                  'principal name: ', 'ambari@EXAMPLE.COM', '.*', '', False,
+                  'principal name (ambari@EXAMPLE.COM): ', 'ambari@EXAMPLE.COM', '.*', '', False,
                   False)
     keytab = get_validated_string_input('Enter keytab path for ambari '
                   'server\'s kerberos principal: ',

+ 15 - 1
ambari-server/src/test/python/TestAmbariServer.py

@@ -264,8 +264,22 @@ class TestAmbariServer(TestCase):
   def test_setup_ambari_krb5_jaas(self, exists_mock, search_mock,
                                   get_validated_string_input_mock,
                                   fileinput_mock, re_sub_mock):
-    exists_mock.return_value = True
+
     search_mock.return_value = 'filepath'
+    exists_mock.return_value = False
+
+    # Negative case
+    try:
+      ambari_server.setup_ambari_krb5_jaas()
+      self.fail("Should throw exception")
+    except NonFatalException as fe:
+      # Expected
+      self.assertTrue("No jaas config file found at location" in fe.reason)
+      pass
+
+    # Positive case
+    exists_mock.reset_mock()
+    exists_mock.return_value = True
     get_validated_string_input_mock.side_effect = ['aaa@aaa.cnn',
                                                    'pathtokeytab']