[
https://issues.apache.org/jira/browse/NIFI-3294?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15867118#comment-15867118
]
ASF GitHub Bot commented on NIFI-3294:
--------------------------------------
Github user ijokarumawak commented on the issue:
https://github.com/apache/nifi/pull/1405
I was testing this PR using Amazon Linux.
Checking if I can refer ${NIFI_HOME} environmental value via Attribute
Expression Language, before and after applying the patch. I set run.as =
'nifi', and execute `bin/nifi.sh start` by root user.
```properties
# conf/bootstrap.conf
run.as=nifi
```
NiFi flow is simple as: `GenerateFlowFile` using dynamic attribute as
`nifi.home` = `${NIFI_HOME}`, also I added `lang` = `${LANG}` to make sure that
it can refer OS env values via VariableRegistry.
## Result: Without this PR
```properties
nifi.home=(Empty string)
lang=en_US.UTF-8
```
NIFI_HOME was not retrieved as expected.
## Result: With this PR
```properties
nifi.home=/mnt
lang=en_US.UTF-8
```
Although NIFI_HOME was retrieved, the value was not the expected one. It
should be `/mnt/nifi-1.2.0-SNAPSHOT` but it was just `/mnt`.
I also found that without `run.as` property, nifi.sh doesn't work with this
PR. It seems Command argument is not passed properly to RunNiFi:
```bash
[root@ip-172-31-20-144 nifi-1.2.0-SNAPSHOT-root]# ./bin/nifi.sh status
Java home: /usr/lib/jvm/jre
NiFi home: /mnt/nifi-1.2.0-SNAPSHOT-root
Bootstrap Config File: /mnt/nifi-1.2.0-SNAPSHOT-root/conf/bootstrap.conf
Usage:
java org.apache.nifi.bootstrap.RunNiFi [<-verbose>] <command> [options]
Valid commands include: ...
```
I will keep investigating what's going on but would like to share current
status. Please let me know if you noticed something.
Thanks!
> NiFi will ignore nifi-env properties when running as another user
> -----------------------------------------------------------------
>
> Key: NIFI-3294
> URL: https://issues.apache.org/jira/browse/NIFI-3294
> Project: Apache NiFi
> Issue Type: Bug
> Components: Configuration
> Affects Versions: 1.0.0, 0.7.0, 0.7.1, 1.1.1, 1.0.1
> Environment: All non-Windows, non-Cygwin OSes
> Reporter: Aldrin Piri
> Assignee: Aldrin Piri
> Fix For: 0.8.0, 1.2.0
>
>
> nifi-env is a script that allows setting of certain properties external to
> the core run scripts. However, when sudo is used, the resulting
> subshell/child process is a separate environment that does not have the
> needed information that was established in nifi-env. This needs to be
> incorporated into the run command such that those properties are preserved.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)