You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ma...@apache.org on 2013/08/22 07:52:03 UTC

git commit: AMBARI-2975. ambari-server setup -j cannot update java.home. (Vladimir Tkhir via mahadev)

Updated Branches:
  refs/heads/trunk d649f57e2 -> d8afa8672


AMBARI-2975. ambari-server setup -j cannot update java.home. (Vladimir Tkhir via mahadev)


Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/d8afa867
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/d8afa867
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/d8afa867

Branch: refs/heads/trunk
Commit: d8afa86728ed0f8e91067b6ff969bcad0440d1a4
Parents: d649f57
Author: Mahadev Konar <ma...@apache.org>
Authored: Wed Aug 21 22:51:50 2013 -0700
Committer: Mahadev Konar <ma...@apache.org>
Committed: Wed Aug 21 22:51:50 2013 -0700

----------------------------------------------------------------------
 ambari-server/src/main/python/ambari-server.py    | 2 +-
 ambari-server/src/test/python/TestAmbaryServer.py | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d8afa867/ambari-server/src/main/python/ambari-server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari-server.py b/ambari-server/src/main/python/ambari-server.py
index 6a59b11..99a341b 100755
--- a/ambari-server/src/main/python/ambari-server.py
+++ b/ambari-server/src/main/python/ambari-server.py
@@ -1522,7 +1522,7 @@ def download_jdk(args):
     raise FatalException(-1, err)
   conf_file = properties.fileName
   ok = False
-  if get_JAVA_HOME():
+  if get_JAVA_HOME() and not args.java_home:
     pass # do nothing
   elif args.java_home and os.path.exists(args.java_home):
     print_warning_msg("JAVA_HOME " + args.java_home

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d8afa867/ambari-server/src/test/python/TestAmbaryServer.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/TestAmbaryServer.py b/ambari-server/src/test/python/TestAmbaryServer.py
index 74c1166..4786ca0 100644
--- a/ambari-server/src/test/python/TestAmbaryServer.py
+++ b/ambari-server/src/test/python/TestAmbaryServer.py
@@ -1582,6 +1582,15 @@ MIIFHjCCAwYCCQDpHKOBI+Lt0zANBgkqhkiG9w0BAQUFADBRMQswCQYDVQQGEwJV
       rcode = ambari_server.download_jdk(args)
       self.assertTrue(download_jce_policy_mock.called)
 
+    # Test case: Update JAVA_HOME location using command: ambari-server setup -j %NEW_LOCATION%
+    write_property_mock.reset_mock()
+    args.java_home = "somewhere"
+    path_existsMock.return_value = True
+    path_existsMock.side_effect = None
+    get_JAVA_HOME_mock.return_value = True
+    install_jce_manualy_mock.return_value = 0
+    rcode = ambari_server.download_jdk(args)
+    self.assertTrue(write_property_mock.called)
 
 
   @patch.object(ambari_server, "run_os_command")