You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by lfrancke <gi...@git.apache.org> on 2018/09/04 13:31:54 UTC

[GitHub] nifi pull request #2985: NIFI-5573 Allow overriding of nifi-env.sh

GitHub user lfrancke opened a pull request:

    https://github.com/apache/nifi/pull/2985

    NIFI-5573 Allow overriding of nifi-env.sh

    Thank you for submitting a contribution to Apache NiFi.
    
    In order to streamline the review of the contribution we ask you
    to ensure the following steps have been taken:
    
    ### For all changes:
    - [x] Is there a JIRA ticket associated with this PR? Is it referenced 
         in the commit message?
    
    - [x] Does your PR title start with NIFI-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
    
    - [x] Has your PR been rebased against the latest commit within the target branch (typically master)?
    
    - [x] Is your initial contribution a single, squashed commit?
    
    ### For code changes:
    - [ ] Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder?
    - [ ] Have you written or updated unit tests to verify your changes?
    - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? 
    - [ ] If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly?
    - [ ] If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly?
    - [ ] If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties?
    
    ### For documentation related changes:
    - [ ] Have you ensured that format looks appropriate for the output in which it is rendered?
    
    ### Note:
    Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/lfrancke/nifi NIFI-5573

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/nifi/pull/2985.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2985
    
----
commit 2d88cef42002824f8815c4aa5dbef6c62cf30185
Author: Lars Francke <la...@...>
Date:   2018-09-04T13:30:42Z

    NIFI-5573 Allow overriding of nifi-env.sh

----


---

[GitHub] nifi pull request #2985: NIFI-5573 Allow overriding of nifi-env.sh

Posted by lfrancke <gi...@git.apache.org>.
Github user lfrancke commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2985#discussion_r216626331
  
    --- Diff: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/bin/nifi-env.sh ---
    @@ -16,16 +16,38 @@
     #    limitations under the License.
     #
     
    +# By default this file will unconditionally override whatever environment variables you have set
    +# and set them to defaults defined here.
    +# If you want to define your own versions outside of this script please set the environment variable
    +# NIFI_OVERRIDE_NIFIENV to "true". That will then use whatever variables you used outside of
    +# this script.
    +
     # The java implementation to use.
     #export JAVA_HOME=/usr/java/jdk1.8.0/
     
    -export NIFI_HOME=$(cd "${SCRIPT_DIR}" && cd .. && pwd)
    +setOrDefault() {
    +  declare envvar="$1" default="$2"
    +
    +  local res="$envvar"
    +  if [ -z "$envvar" ] || [ "$NIFI_OVERRIDE_NIFIENV" != "true" ]
    --- End diff --
    
    Sorry @pepov ! No worries at all. I'm on vacation and won't be back for another week. I'll get to it then. Your comments make sense. I just haven't gotten around to look at them in detail.


---

[GitHub] nifi pull request #2985: NIFI-5573 Allow overriding of nifi-env.sh

Posted by pepov <gi...@git.apache.org>.
Github user pepov commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2985#discussion_r214952384
  
    --- Diff: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/bin/nifi-env.sh ---
    @@ -16,16 +16,38 @@
     #    limitations under the License.
     #
     
    +# By default this file will unconditionally override whatever environment variables you have set
    +# and set them to defaults defined here.
    +# If you want to define your own versions outside of this script please set the environment variable
    +# NIFI_OVERRIDE_NIFIENV to "true". That will then use whatever variables you used outside of
    +# this script.
    +
     # The java implementation to use.
     #export JAVA_HOME=/usr/java/jdk1.8.0/
     
    -export NIFI_HOME=$(cd "${SCRIPT_DIR}" && cd .. && pwd)
    +setOrDefault() {
    +  declare envvar="$1" default="$2"
    +
    +  local res="$envvar"
    +  if [ -z "$envvar" ] || [ "$NIFI_OVERRIDE_NIFIENV" != "true" ]
    --- End diff --
    
    Also it would cause problems with variables that has a meaning when set to an empty string, because that would be changed to the default value. 
    
    For posix shell we could use `(: "${somevar?}")` to check for the variable beeing set, but I beleive that should be done before calling the `setOrDefault` method.
    
    I'm not sure we have to be that careful, but at least if there is a good option to cover that use case we should do it.


---

[GitHub] nifi pull request #2985: NIFI-5573 Allow overriding of nifi-env.sh

Posted by pepov <gi...@git.apache.org>.
Github user pepov commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2985#discussion_r216244697
  
    --- Diff: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/bin/nifi-env.sh ---
    @@ -16,16 +16,38 @@
     #    limitations under the License.
     #
     
    +# By default this file will unconditionally override whatever environment variables you have set
    +# and set them to defaults defined here.
    +# If you want to define your own versions outside of this script please set the environment variable
    +# NIFI_OVERRIDE_NIFIENV to "true". That will then use whatever variables you used outside of
    +# this script.
    +
     # The java implementation to use.
     #export JAVA_HOME=/usr/java/jdk1.8.0/
     
    -export NIFI_HOME=$(cd "${SCRIPT_DIR}" && cd .. && pwd)
    +setOrDefault() {
    +  declare envvar="$1" default="$2"
    +
    +  local res="$envvar"
    +  if [ -z "$envvar" ] || [ "$NIFI_OVERRIDE_NIFIENV" != "true" ]
    --- End diff --
    
    Didn't mean to block this. I recommend showing a warning message (probably to stderr) when setting a default value for a variable.


---

[GitHub] nifi pull request #2985: NIFI-5573 Allow overriding of nifi-env.sh

Posted by pepov <gi...@git.apache.org>.
Github user pepov commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2985#discussion_r216688824
  
    --- Diff: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/bin/nifi-env.sh ---
    @@ -16,16 +16,38 @@
     #    limitations under the License.
     #
     
    +# By default this file will unconditionally override whatever environment variables you have set
    +# and set them to defaults defined here.
    +# If you want to define your own versions outside of this script please set the environment variable
    +# NIFI_OVERRIDE_NIFIENV to "true". That will then use whatever variables you used outside of
    +# this script.
    +
     # The java implementation to use.
     #export JAVA_HOME=/usr/java/jdk1.8.0/
     
    -export NIFI_HOME=$(cd "${SCRIPT_DIR}" && cd .. && pwd)
    +setOrDefault() {
    +  declare envvar="$1" default="$2"
    +
    +  local res="$envvar"
    +  if [ -z "$envvar" ] || [ "$NIFI_OVERRIDE_NIFIENV" != "true" ]
    --- End diff --
    
    okey, thanks for checking in!


---

[GitHub] nifi pull request #2985: NIFI-5573 Allow overriding of nifi-env.sh

Posted by pepov <gi...@git.apache.org>.
Github user pepov commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2985#discussion_r214943927
  
    --- Diff: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/bin/nifi-env.sh ---
    @@ -16,16 +16,38 @@
     #    limitations under the License.
     #
     
    +# By default this file will unconditionally override whatever environment variables you have set
    +# and set them to defaults defined here.
    +# If you want to define your own versions outside of this script please set the environment variable
    +# NIFI_OVERRIDE_NIFIENV to "true". That will then use whatever variables you used outside of
    +# this script.
    +
     # The java implementation to use.
     #export JAVA_HOME=/usr/java/jdk1.8.0/
     
    -export NIFI_HOME=$(cd "${SCRIPT_DIR}" && cd .. && pwd)
    +setOrDefault() {
    +  declare envvar="$1" default="$2"
    +
    +  local res="$envvar"
    +  if [ -z "$envvar" ] || [ "$NIFI_OVERRIDE_NIFIENV" != "true" ]
    --- End diff --
    
    this is a bit hard to read, i recommend to negate:
    ```
    if [ "$NIFI_OVERRIDE_NIFIENV" = "true" ] && [ -n "$envvar" ]; then
      ...
    ```


---

[GitHub] nifi issue #2985: NIFI-5573 Allow overriding of nifi-env.sh

Posted by lfrancke <gi...@git.apache.org>.
Github user lfrancke commented on the issue:

    https://github.com/apache/nifi/pull/2985
  
    The errors seem unrelated. It complains about a timeout but one of the jobs succeeded.


---