Author: jing9 Date: Thu Feb 20 18:34:24 2014 New Revision: 1570295 URL: http://svn.apache.org/r1570295 Log: HADOOP-10348. Deprecate hadoop.ssl.configuration in branch-2, and remove it in trunk. Contributed by Haohui Mai.
Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSUtil.java hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestHttpPolicy.java Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java?rev=1570295&r1=1570294&r2=1570295&view=diff ============================================================================== --- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java (original) +++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java Thu Feb 20 18:34:24 2014 @@ -377,8 +377,6 @@ public class DFSConfigKeys extends Commo public static final int DFS_NAMENODE_SERVICE_HANDLER_COUNT_DEFAULT = 10; public static final String DFS_SUPPORT_APPEND_KEY = "dfs.support.append"; public static final boolean DFS_SUPPORT_APPEND_DEFAULT = true; - public static final String DFS_HTTPS_ENABLE_KEY = "dfs.https.enable"; - public static final boolean DFS_HTTPS_ENABLE_DEFAULT = false; public static final String DFS_HTTP_POLICY_KEY = "dfs.http.policy"; public static final String DFS_HTTP_POLICY_DEFAULT = HttpConfig.Policy.HTTP_ONLY.name(); public static final String DFS_DEFAULT_CHUNK_VIEW_SIZE_KEY = "dfs.default.chunk.view.size"; Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSUtil.java URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSUtil.java?rev=1570295&r1=1570294&r2=1570295&view=diff ============================================================================== --- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSUtil.java (original) +++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSUtil.java Thu Feb 20 18:34:24 2014 @@ -1553,44 +1553,11 @@ public class DFSUtil { } /** - * Get http policy. Http Policy is chosen as follows: - * <ol> - * <li>If hadoop.ssl.enabled is set, http endpoints are not started. Only - * https endpoints are started on configured https ports</li> - * <li>This configuration is overridden by dfs.https.enable configuration, if - * it is set to true. In that case, both http and https endpoints are stared.</li> - * <li>All the above configurations are overridden by dfs.http.policy - * configuration. With this configuration you can set http-only, https-only - * and http-and-https endpoints.</li> - * </ol> - * See hdfs-default.xml documentation for more details on each of the above - * configuration settings. + * Get http policy. */ public static HttpConfig.Policy getHttpPolicy(Configuration conf) { - String policyStr = conf.get(DFSConfigKeys.DFS_HTTP_POLICY_KEY); - if (policyStr == null) { - boolean https = conf.getBoolean(DFSConfigKeys.DFS_HTTPS_ENABLE_KEY, - DFSConfigKeys.DFS_HTTPS_ENABLE_DEFAULT); - - boolean hadoopSsl = conf.getBoolean( - CommonConfigurationKeys.HADOOP_SSL_ENABLED_KEY, - CommonConfigurationKeys.HADOOP_SSL_ENABLED_DEFAULT); - - if (hadoopSsl) { - LOG.warn(CommonConfigurationKeys.HADOOP_SSL_ENABLED_KEY - + " is deprecated. Please use " + DFSConfigKeys.DFS_HTTP_POLICY_KEY - + "."); - } - if (https) { - LOG.warn(DFSConfigKeys.DFS_HTTPS_ENABLE_KEY - + " is deprecated. Please use " + DFSConfigKeys.DFS_HTTP_POLICY_KEY - + "."); - } - - return (hadoopSsl || https) ? HttpConfig.Policy.HTTP_AND_HTTPS - : HttpConfig.Policy.HTTP_ONLY; - } - + String policyStr = conf.get(DFSConfigKeys.DFS_HTTP_POLICY_KEY, + DFSConfigKeys.DFS_HTTP_POLICY_DEFAULT); HttpConfig.Policy policy = HttpConfig.Policy.fromString(policyStr); if (policy == null) { throw new HadoopIllegalArgumentException("Unregonized value '" Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestHttpPolicy.java URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestHttpPolicy.java?rev=1570295&r1=1570294&r2=1570295&view=diff ============================================================================== --- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestHttpPolicy.java (original) +++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestHttpPolicy.java Thu Feb 20 18:34:24 2014 @@ -17,12 +17,8 @@ */ package org.apache.hadoop.hdfs; -import static org.apache.hadoop.http.HttpConfig.Policy.HTTP_AND_HTTPS; -import static org.apache.hadoop.http.HttpConfig.Policy.HTTP_ONLY; - import org.apache.hadoop.HadoopIllegalArgumentException; import org.apache.hadoop.conf.Configuration; -import org.junit.Assert; import org.junit.Test; public final class TestHttpPolicy { @@ -33,22 +29,4 @@ public final class TestHttpPolicy { conf.set(DFSConfigKeys.DFS_HTTP_POLICY_KEY, "invalid"); DFSUtil.getHttpPolicy(conf); } - - @Test - public void testDeprecatedConfiguration() { - Configuration conf = new Configuration(false); - Assert.assertSame(HTTP_ONLY, DFSUtil.getHttpPolicy(conf)); - - conf.setBoolean(DFSConfigKeys.DFS_HTTPS_ENABLE_KEY, true); - Assert.assertSame(HTTP_AND_HTTPS, DFSUtil.getHttpPolicy(conf)); - - conf = new Configuration(false); - conf.setBoolean(DFSConfigKeys.HADOOP_SSL_ENABLED_KEY, true); - Assert.assertSame(HTTP_AND_HTTPS, DFSUtil.getHttpPolicy(conf)); - - conf = new Configuration(false); - conf.set(DFSConfigKeys.DFS_HTTP_POLICY_KEY, HTTP_ONLY.name()); - conf.setBoolean(DFSConfigKeys.DFS_HTTPS_ENABLE_KEY, true); - Assert.assertSame(HTTP_ONLY, DFSUtil.getHttpPolicy(conf)); - } }