You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by dm...@apache.org on 2015/03/20 11:57:19 UTC

ambari git commit: AMBARI-10133. Deprecate JDKs, Remove support for unsupported JDKs (dlysnichenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk 77f223215 -> b3666a3ed


AMBARI-10133. Deprecate JDKs, Remove support for unsupported JDKs (dlysnichenko)


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

Branch: refs/heads/trunk
Commit: b3666a3ed4902f0a9981b60689ba11d6fb7b1acc
Parents: 77f2232
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Fri Mar 20 12:56:30 2015 +0200
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Fri Mar 20 12:56:30 2015 +0200

----------------------------------------------------------------------
 ambari-server/conf/unix/ambari.properties       | 11 ++------
 .../python/ambari_server/serverConfiguration.py | 27 +++++---------------
 .../main/python/ambari_server/serverSetup.py    | 18 +++++--------
 .../src/test/python/TestAmbariServer.py         | 10 +-------
 4 files changed, 17 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b3666a3e/ambari-server/conf/unix/ambari.properties
----------------------------------------------------------------------
diff --git a/ambari-server/conf/unix/ambari.properties b/ambari-server/conf/unix/ambari.properties
index 25a4081..44aea5c 100644
--- a/ambari-server/conf/unix/ambari.properties
+++ b/ambari-server/conf/unix/ambari.properties
@@ -23,15 +23,8 @@ resources.dir = /var/lib/ambari-server/resources
 shared.resources.dir = /usr/lib/ambari-server/lib/ambari_commons/resources
 custom.action.definitions = /var/lib/ambari-server/resources/custom_action_definitions
 
-java.releases=jdk1.8,jdk1.7,jdk1.6
-jdk1.6.desc=Oracle JDK 1.6
-jdk1.6.url=http://public-repo-1.hortonworks.com/ARTIFACTS/jdk-6u31-linux-x64.bin
-jdk1.6.dest-file=jdk-6u31-linux-x64.bin
-jdk1.6.jcpol-url=http://public-repo-1.hortonworks.com/ARTIFACTS/jce_policy-6.zip
-jdk1.6.jcpol-file=jce_policy-6.zip
-jdk1.6.home=/usr/jdk64/
-jdk1.6.re=Creating (jdk.*)/jre
-jdk1.7.desc=Oracle JDK 1.7
+java.releases=jdk1.8,jdk1.7
+jdk1.7.desc=Oracle JDK 1.7 (deprecated)
 jdk1.7.url=http://public-repo-1.hortonworks.com/ARTIFACTS/jdk-7u67-linux-x64.tar.gz
 jdk1.7.dest-file=jdk-7u67-linux-x64.tar.gz
 jdk1.7.jcpol-url=http://public-repo-1.hortonworks.com/ARTIFACTS/UnlimitedJCEPolicyJDK7.zip

http://git-wip-us.apache.org/repos/asf/ambari/blob/b3666a3e/ambari-server/src/main/python/ambari_server/serverConfiguration.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari_server/serverConfiguration.py b/ambari-server/src/main/python/ambari_server/serverConfiguration.py
index b8f6641..c8eebbf 100644
--- a/ambari-server/src/main/python/ambari_server/serverConfiguration.py
+++ b/ambari-server/src/main/python/ambari_server/serverConfiguration.py
@@ -80,12 +80,6 @@ JAVA_HOME_PROPERTY = "java.home"
 JDK_NAME_PROPERTY = "jdk.name"
 JCE_NAME_PROPERTY = "jce.name"
 
-DEFAULT_JDK16_LOCATION = "/usr/jdk64/jdk1.6.0_31"
-JDK_NAMES = ["jdk-8u40-linux-x64.tar.gz", "jdk-7u67-linux-x64.tar.gz", "jdk-6u31-linux-x64.bin"]
-
-#JCE Policy files
-JCE_POLICY_FILENAMES = ["jce_policy-8.zip", "UnlimitedJCEPolicyJDK7.zip", "jce_policy-6.zip"]
-
 # JDBC
 JDBC_PATTERNS = {"oracle": "*ojdbc*.jar", "mysql": "*mysql*.jar"}
 
@@ -796,10 +790,10 @@ def update_ambari_properties():
     new_properties.load(open(conf_file))
 
     for prop_key, prop_value in old_properties.getPropertyDict().items():
-      if ("agent.fqdn.service.url" == prop_key):
-        #BUG-7179 what is agent.fqdn property in ambari.props?
+      if "agent.fqdn.service.url" == prop_key:
+        # BUG-7179 what is agent.fqdn property in ambari.props?
         new_properties.process_pair(GET_FQDN_SERVICE_URL, prop_value)
-      elif ("server.os_type" == prop_key):
+      elif "server.os_type" == prop_key:
         new_properties.process_pair(OS_TYPE_PROPERTY, OS_FAMILY + OS_VERSION)
       else:
         new_properties.process_pair(prop_key, prop_value)
@@ -807,17 +801,10 @@ def update_ambari_properties():
     # Adding custom user name property if it is absent
     # In previous versions without custom user support server was started as
     # "root" anyway so it's a reasonable default
-    if not NR_USER_PROPERTY in new_properties.keys():
+    if NR_USER_PROPERTY not in new_properties.keys():
       new_properties.process_pair(NR_USER_PROPERTY, "root")
 
-    isJDK16Installed = new_properties.get_property(JAVA_HOME_PROPERTY) == DEFAULT_JDK16_LOCATION
-    if not JDK_NAME_PROPERTY in new_properties.keys() and isJDK16Installed:
-      new_properties.process_pair(JDK_NAME_PROPERTY, JDK_NAMES[2])
-
-    if not JCE_NAME_PROPERTY in new_properties.keys() and isJDK16Installed:
-      new_properties.process_pair(JCE_NAME_PROPERTY, JCE_POLICY_FILENAMES[2])
-
-    if not OS_FAMILY_PROPERTY in new_properties.keys():
+    if OS_FAMILY_PROPERTY not in new_properties.keys():
       new_properties.process_pair(OS_FAMILY_PROPERTY, OS_FAMILY + OS_VERSION)
 
     new_properties.store(open(conf_file, 'w'))
@@ -827,8 +814,8 @@ def update_ambari_properties():
     return -1
 
   timestamp = datetime.datetime.now()
-  format = '%Y%m%d%H%M%S'
-  os.rename(prev_conf_file, prev_conf_file + '.' + timestamp.strftime(format))
+  fmt = '%Y%m%d%H%M%S'
+  os.rename(prev_conf_file, prev_conf_file + '.' + timestamp.strftime(fmt))
 
   return 0
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/b3666a3e/ambari-server/src/main/python/ambari_server/serverSetup.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari_server/serverSetup.py b/ambari-server/src/main/python/ambari_server/serverSetup.py
index 1701f09..408d9b8 100644
--- a/ambari-server/src/main/python/ambari_server/serverSetup.py
+++ b/ambari-server/src/main/python/ambari_server/serverSetup.py
@@ -520,7 +520,7 @@ class JDKSetup(object):
     jdk_choice_prompt += self.JDK_CUSTOM_CHOICE_PROMPT.format(n_config, jdk_num)
     jdk_valid_choices = self.JDK_VALID_CHOICES.format(jdk_choices, n_config)
 
-    return (jdks, jdk_choice_prompt, jdk_valid_choices, n_config - 1)
+    return jdks, jdk_choice_prompt, jdk_valid_choices, n_config - 1
 
   def _download_jdk(self, jdk_url, dest_file):
     jdk_download_fail_msg = " Failed to download JDK: {0}. Please check that the " \
@@ -641,11 +641,11 @@ class JDKSetupLinux(JDKSetup):
   def __init__(self):
     super(JDKSetupLinux, self).__init__()
     self.JDK_DEFAULT_CONFIGS = [
-      JDKRelease("jdk6.31", "Oracle JDK 1.6",
-                 "http://public-repo-1.hortonworks.com/ARTIFACTS/jdk-6u31-linux-x64.bin", "jdk-6u31-linux-x64.bin",
-                 "http://public-repo-1.hortonworks.com/ARTIFACTS/jce_policy-6.zip", "jce_policy-6.zip",
-                 "/usr/jdk64/jdk1.6.0_31",
-                 "Creating (jdk.*)/jre")
+      JDKRelease("jdk1.8", "Oracle JDK 1.8",
+                 "http://public-repo-1.hortonworks.com/ARTIFACTS/jdk-8u40-linux-x64.tar.gz", "jdk-8u40-linux-x64.tar.gz",
+                 "http://public-repo-1.hortonworks.com/ARTIFACTS/jce_policy-8.zip", "jce_policy-8.zip",
+                 "/usr/jdk64/jdk1.8.0_40",
+                 "(jdk.*)/jre")
     ]
 
     self.jdks = self.JDK_DEFAULT_CONFIGS
@@ -655,7 +655,6 @@ class JDKSetupLinux(JDKSetup):
 
     self.CREATE_JDK_DIR_CMD = "/bin/mkdir -p {0}"
     self.CHMOD_JDK_DIR_CMD = "chmod a+x {0}"
-    self.MAKE_FILE_EXECUTABLE_CMD = "chmod a+x {0}"
 
     # use --no-same-owner when running as root to prevent uucp as the user (AMBARI-6478)
     self.UNTAR_JDK_ARCHIVE = "tar --no-same-owner -xvf {0}"
@@ -670,10 +669,7 @@ class JDKSetupLinux(JDKSetup):
     os.chdir(jdk_inst_dir)
 
     try:
-      if java_inst_file.endswith(".bin"):
-        retcode, out, err = run_os_command(self.MAKE_FILE_EXECUTABLE_CMD.format(java_inst_file))
-        retcode, out, err = run_os_command(java_inst_file + ' -noregister')
-      elif java_inst_file.endswith(".gz"):
+      if java_inst_file.endswith(".gz"):
         retcode, out, err = run_os_command(self.UNTAR_JDK_ARCHIVE.format(java_inst_file))
       else:
         err = "JDK installation failed.Unknown file extension."

http://git-wip-us.apache.org/repos/asf/ambari/blob/b3666a3e/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 088ce8b..35cd5a5 100644
--- a/ambari-server/src/test/python/TestAmbariServer.py
+++ b/ambari-server/src/test/python/TestAmbariServer.py
@@ -2166,7 +2166,7 @@ MIIFHjCCAwYCCQDpHKOBI+Lt0zANBgkqhkiG9w0BAQUFADBRMQswCQYDVQQGEwJV
     path_existsMock.side_effect = [True, False, True, False]
     path_isfileMock.return_value = False
     args.jdk_location = None
-    run_os_command_mock.return_value = (0, "Creating jdk1/jre" , None)
+    run_os_command_mock.return_value = (0, "Creating jdk1/jre", None)
     statResult = MagicMock()
     statResult.st_size = 32000
     statMock.return_value = statResult
@@ -4560,8 +4560,6 @@ MIIFHjCCAwYCCQDpHKOBI+Lt0zANBgkqhkiG9w0BAQUFADBRMQswCQYDVQQGEwJV
                   "agent.fqdn.service.url=URL\n"]
 
     NEW_PROPERTY = 'some_new_property=some_value\n'
-    JDK_NAME_PROPERTY = 'jdk.name=jdk-6u31-linux-x64.bin\n'
-    JCE_NAME_PROPERTY = 'jce.name=jce_policy-6.zip\n'
     CHANGED_VALUE_PROPERTY = 'server.jdbc.database_name=should_not_overwrite_value\n'
 
     get_conf_dir_mock.return_value = '/etc/ambari-server/conf'
@@ -4606,12 +4604,6 @@ MIIFHjCCAwYCCQDpHKOBI+Lt0zANBgkqhkiG9w0BAQUFADBRMQswCQYDVQQGEwJV
     if not NEW_PROPERTY in ambari_properties_content:
       self.fail()
 
-    if not JDK_NAME_PROPERTY in ambari_properties_content:
-      self.fail()
-
-    if not JCE_NAME_PROPERTY in ambari_properties_content:
-      self.fail()
-
     if CHANGED_VALUE_PROPERTY in ambari_properties_content:
       self.fail()