hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject hadoop git commit: HADOOP-13562. Change hadoop_subcommand_opts to use only uppercase
Date Tue, 30 Aug 2016 15:52:49 GMT
Repository: hadoop
Updated Branches:
  refs/heads/HADOOP-13341 ef55eb952 -> 1fd60c834


HADOOP-13562. Change hadoop_subcommand_opts to use only uppercase


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

Branch: refs/heads/HADOOP-13341
Commit: 1fd60c834edad2e44b356db93b62ac804752ebd5
Parents: ef55eb95
Author: Allen Wittenauer <aw@apache.org>
Authored: Tue Aug 30 08:52:41 2016 -0700
Committer: Allen Wittenauer <aw@apache.org>
Committed: Tue Aug 30 08:52:41 2016 -0700

----------------------------------------------------------------------
 .../src/main/bin/hadoop-functions.sh            | 31 +++++++-------------
 .../test/scripts/hadoop_subcommand_opts.bats    | 18 ++++--------
 2 files changed, 16 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/1fd60c83/hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh b/hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh
index dd82347..695fd41 100755
--- a/hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh
+++ b/hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh
@@ -2007,8 +2007,8 @@ function hadoop_subcommand_opts
 {
   declare program=$1
   declare command=$2
-  declare var
   declare uvar
+  declare depvar
   declare uprogram
   declare ucommand
 
@@ -2029,34 +2029,25 @@ function hadoop_subcommand_opts
     ucommand=${command^^}
   fi
 
-  # HDFS_namenode_OPTS
-  # HADOOP_distcp_OPTS
-  # MAPRED_distcp_OPTS
-  # YARN_sharedcachemanger_OPTS
-  # ...
-  var="${uprogram}_${command}_OPTS"
+  uvar="${uprogram}_${ucommand}_OPTS"
 
   # Let's handle all of the deprecation cases early
-  # HADOOP_NAMENODE_OPTS -> HDFS_namenode_OPTS
-  # YARN_RESOURCEMANAGER_OPTS -> YARN_resourcemanager_OPTS
+  # HADOOP_NAMENODE_OPTS -> HDFS_NAMENODE_OPTS
 
-  uvar="${uprogram}_${ucommand}_OPTS"
-  if [[ -n ${!uvar} ]]; then
-    hadoop_deprecate_envvar "${uvar}" "${var}"
-  fi
+  depvar="HADOOP_${ucommand}_OPTS"
 
-  uvar="HADOOP_${ucommand}_OPTS"
-  if [[ -n ${!uvar} ]]; then
-    hadoop_deprecate_envvar "${uvar}" "${var}"
+  if [[ "${depvar}" != "${uvar}" ]]; then
+    if [[ -n "${!depvar}" ]]; then
+      hadoop_deprecate_envvar "${depvar}" "${uvar}"
+    fi
   fi
 
-  if [[ -n ${!var} ]]; then
-    hadoop_debug "Appending ${!var} onto HADOOP_OPTS"
-    HADOOP_OPTS="${HADOOP_OPTS} ${!var}"
+  if [[ -n ${!uvar} ]]; then
+    hadoop_debug "Appending ${!uvar} onto HADOOP_OPTS"
+    HADOOP_OPTS="${HADOOP_OPTS} ${!uvar}"
     return 0
   fi
 }
-
 ## @description  Add custom (program)_(command)_SECURE_EXTRA_OPTS to HADOOP_OPTS.
 ## @description  This *does not* handle the pre-3.x deprecated cases
 ## @audience     public

http://git-wip-us.apache.org/repos/asf/hadoop/blob/1fd60c83/hadoop-common-project/hadoop-common/src/test/scripts/hadoop_subcommand_opts.bats
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/scripts/hadoop_subcommand_opts.bats
b/hadoop-common-project/hadoop-common/src/test/scripts/hadoop_subcommand_opts.bats
index 1fbf343..0010a58 100644
--- a/hadoop-common-project/hadoop-common/src/test/scripts/hadoop_subcommand_opts.bats
+++ b/hadoop-common-project/hadoop-common/src/test/scripts/hadoop_subcommand_opts.bats
@@ -29,7 +29,7 @@ load hadoop-functions_test_helper
 
 @test "hadoop_subcommand_opts (hadoop simple exist)" {
   HADOOP_OPTS="x"
-  HADOOP_test_OPTS="y"
+  HADOOP_TEST_OPTS="y"
   hadoop_subcommand_opts hadoop test
   echo "${HADOOP_OPTS}"
   [ "${HADOOP_OPTS}" = "x y" ]
@@ -37,7 +37,7 @@ load hadoop-functions_test_helper
 
 @test "hadoop_subcommand_opts (hadoop complex exist)" {
   HADOOP_OPTS="x"
-  HADOOP_test_OPTS="y z"
+  HADOOP_TEST_OPTS="y z"
   hadoop_subcommand_opts hadoop test
   echo "${HADOOP_OPTS}"
   [ "${HADOOP_OPTS}" = "x y z" ]
@@ -45,7 +45,7 @@ load hadoop-functions_test_helper
 
 @test "hadoop_subcommand_opts (hdfs simple exist)" {
   HADOOP_OPTS="x"
-  HDFS_test_OPTS="y"
+  HDFS_TEST_OPTS="y"
   hadoop_subcommand_opts hdfs test
   echo "${HADOOP_OPTS}"
   [ "${HADOOP_OPTS}" = "x y" ]
@@ -53,24 +53,16 @@ load hadoop-functions_test_helper
 
 @test "hadoop_subcommand_opts (yarn simple exist)" {
   HADOOP_OPTS="x"
-  YARN_test_OPTS="y"
+  YARN_TEST_OPTS="y"
   hadoop_subcommand_opts yarn test
   echo "${HADOOP_OPTS}"
   [ "${HADOOP_OPTS}" = "x y" ]
 }
 
-@test "hadoop_subcommand_opts (deprecation case #1)" {
+@test "hadoop_subcommand_opts (deprecation case)" {
   HADOOP_OPTS="x"
   HADOOP_NAMENODE_OPTS="y"
   hadoop_subcommand_opts hdfs namenode
   echo "${HADOOP_OPTS}"
   [ "${HADOOP_OPTS}" = "x y" ]
 }
-
-@test "hadoop_subcommand_opts (deprecation case #2)" {
-  HADOOP_OPTS="x"
-  YARN_RESOURCEMANAGER_OPTS="y"
-  hadoop_subcommand_opts yarn resourcemanager
-  echo "${HADOOP_OPTS}"
-  [ "${HADOOP_OPTS}" = "x y" ]
-}
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message