Skip to content

Commit

Permalink
ADS-1703
Browse files Browse the repository at this point in the history
  • Loading branch information
Asmoday committed Jul 3, 2024
1 parent 77705e8 commit 242d54c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
5 changes: 0 additions & 5 deletions nifi-registry/nifi-registry-assembly/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,6 @@
<groupId>org.apache.nifi.registry</groupId>
<artifactId>nifi-registry-properties-loader</artifactId>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>3.0.1-b06</version>
</dependency>
</dependencies>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,23 @@ run() {
run_nifi_registry_cmd="'${JAVA}' -cp '${BOOTSTRAP_CLASSPATH}' -Xms12m -Xmx24m ${BOOTSTRAP_DIR_PARAMS} org.apache.nifi.registry.bootstrap.RunNiFiRegistry $@"

if [ -n "${run_as_user}" ]; then
preserve_environment=$(grep '^\s*preserve.environment' "${BOOTSTRAP_CONF}" | cut -d'=' -f2 | tr '[:upper:]' '[:lower:]')
use_su=$(grep '^\s*use.su' "${BOOTSTRAP_CONF}" | cut -d'=' -f2 | tr '[:upper:]' '[:lower:]')

if [ "$use_su" = "true" ]; then
SUDO="/bin/su"
if [ "$preserve_environment" = "true" ]; then
echo "The use.su option is not supported with preserve.environment enabled for compatibility reasons. Exiting."
exit 1
fi
else
SUDO="sudo -u"
if [ "$preserve_environment" = "true" ]; then
SUDO="sudo -E -u"
fi
fi
# Provide SCRIPT_DIR and execute nifi-env for the run.as user command
run_nifi_registry_cmd="sudo -u ${run_as_user} sh -c \"SCRIPT_DIR='${SCRIPT_DIR}' && . '${SCRIPT_DIR}/nifi-registry-env.sh' && ${run_nifi_registry_cmd}\""
run_nifi_registry_cmd="${SUDO} ${run_as_user} -s /bin/sh -c \"SCRIPT_DIR='${SCRIPT_DIR}' && . '${SCRIPT_DIR}/nifi-registry-env.sh' && ${run_nifi_registry_cmd}\""
fi

if [ "$1" = "run" ]; then
Expand Down

0 comments on commit 242d54c

Please sign in to comment.