Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export HOSTNAME environment variable #26262

Merged
merged 1 commit into from
Aug 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions distribution/src/main/resources/bin/elasticsearch-env
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ fi
# check the Java version
"$JAVA" -cp "$ES_CLASSPATH" org.elasticsearch.tools.JavaVersionChecker

export HOSTNAME=$HOSTNAME

${source.path.env}

if [ -z "$ES_PATH_CONF" ]; then
Expand Down
2 changes: 2 additions & 0 deletions distribution/src/main/resources/bin/elasticsearch-env.bat
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ if not "%JAVA_OPTS%" == "" (
rem check the Java version
%JAVA% -cp "%ES_CLASSPATH%" "org.elasticsearch.tools.JavaVersionChecker" || exit /b 1

set HOSTNAME=%COMPUTERNAME%

if "%ES_PATH_CONF%" == "" (
set ES_PATH_CONF=!ES_HOME!\config
)
Original file line number Diff line number Diff line change
Expand Up @@ -450,3 +450,15 @@ fi
@test "[$GROUP] test umask" {
install_jvm_example $(readlink -m jvm-example-*.zip) 0077
}

@test "[$GROUP] hostname" {
local temp=`mktemp -d`
cp "$ESCONFIG"/elasticsearch.yml "$temp"
echo 'node.name: ${HOSTNAME}' >> "$ESCONFIG"/elasticsearch.yml
start_elasticsearch_service
wait_for_elasticsearch_status
[ "$(curl -XGET localhost:9200/_cat/nodes?h=name)" == "$HOSTNAME" ]
stop_elasticsearch_service
cp "$temp"/elasticsearch.yml "$ESCONFIG"/elasticsearch.yml
rm -rf "$temp"
}