[ 
https://issues.apache.org/jira/browse/HADOOP-11460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14297424#comment-14297424
 ] 

Allen Wittenauer commented on HADOOP-11460:
-------------------------------------------

I think I found it. Also, I think since the old vars are deprecated, we 
shouldn't populate them.  It will encourage folks to stop using them in new 
code... and given this is trunk, I think that's ok.  Oh, and this uses quotes 
because YARN_OPT. :(

{code}
function hadoop_deprecate_envvar
{
  local oldvar=$1
  local newvar=$2
  local oldval=${!oldvar}
  local newval=${!newvar}

  if [[ -n "${oldval}" ]]; then
    hadoop_error "WARNING: ${oldvar} has been replaced by ${newvar}. Using 
value of ${oldvar}."
    # shellcheck disable=SC2086
    eval ${newvar}=\"${oldval}\"

    # shellcheck disable=SC2086
    newval=${oldval}

    # shellcheck disable=SC2086
    eval ${newvar}=\"${newval}\"
  fi
}
{code}

> Deprecate shell vars
> --------------------
>
>                 Key: HADOOP-11460
>                 URL: https://issues.apache.org/jira/browse/HADOOP-11460
>             Project: Hadoop Common
>          Issue Type: New Feature
>          Components: scripts
>    Affects Versions: 3.0.0
>            Reporter: Allen Wittenauer
>            Assignee: John Smith
>              Labels: scripts, shell
>         Attachments: HADOOP-11460-00.patch, HADOOP-11460-01.patch, 
> HADOOP-11460-02.patch, HADOOP-11460-03.patch
>
>
> It is a very common shell pattern in 3.x to effectively replace sub-project 
> specific vars with generics.  We should have a function that does this 
> replacement and provides a warning to the end user that the old shell var is 
> deprecated.  Additionally, we should use this shell function to deprecate the 
> shell vars that are holdovers already.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to