瀏覽代碼

AMBARI-4912. Trying to run ambari-server setup with -j fails.(vbrodetskyi)

Vitaly Brodetskyi 11 年之前
父節點
當前提交
ac56341dce
共有 2 個文件被更改,包括 11 次插入19 次删除
  1. 0 9
      ambari-server/src/main/python/ambari-server.py
  2. 11 10
      ambari-server/src/test/python/TestAmbariServer.py

+ 0 - 9
ambari-server/src/main/python/ambari-server.py

@@ -1674,15 +1674,6 @@ def download_jdk(args):
       err = "Path to java home " + args.java_home + " does not exists"
       raise FatalException(1, err)
 
-    jce_policy_paths = []
-    for jce_file in JCE_POLICY_FILENAMES:
-      jce_policy_path = os.path.join(properties[RESOURCES_DIR_PROPERTY], jce_file)
-      if os.path.exists(jce_policy_path):
-        jce_policy_paths.append(jce_policy_path)
-    if len(jce_policy_paths) > 0:
-      err = "Command failed to execute. Please remove or move " + str(jce_policy_paths).strip('[]') + " and retry again"
-      raise FatalException(1, err)
-
     print_warning_msg("JAVA_HOME " + args.java_home + " must be valid on ALL hosts")
     print_warning_msg(jcePolicyWarn)
     write_property(JAVA_HOME_PROPERTY, args.java_home)

+ 11 - 10
ambari-server/src/test/python/TestAmbariServer.py

@@ -1943,22 +1943,23 @@ MIIFHjCCAwYCCQDpHKOBI+Lt0zANBgkqhkiG9w0BAQUFADBRMQswCQYDVQQGEwJV
 
     # Test case: Negative test case JAVA_HOME location should not be updated if -j option is supplied and
     # jce_policy file already exists in resources dir.
-    write_property_mock.reset_mock()
-    args.java_home = "somewhere"
-    path_existsMock.side_effect = None
-    path_existsMock.return_value = True
-    get_JAVA_HOME_mock.return_value = True
-    try:
-      ambari_server.download_jdk(args)
-      self.fail("Should throw exception")
-    except FatalException as fe:
+    #write_property_mock.reset_mock()
+    #args.java_home = "somewhere"
+    #path_existsMock.side_effect = None
+    #path_existsMock.return_value = True
+    #get_JAVA_HOME_mock.return_value = True
+    #try:
+    #  ambari_server.download_jdk(args)
+    #  self.fail("Should throw exception")
+    #except FatalException as fe:
       # Expected
-      self.assertFalse(write_property_mock.called)
+    #  self.assertFalse(write_property_mock.called)
     # Test case: Setup ambari-server first time, Custom JDK selected, JDK exists
     args.java_home = None
     args.jdk_location = None
     write_property_mock.reset_mock()
     remove_property_mock.reset_mock()
+    path_existsMock.side_effect = None
     path_existsMock.return_value = True
     get_validated_string_input_mock.return_value = "3"
     get_JAVA_HOME_mock.return_value = False