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

Update pleaserun and system-install #6660

Closed
wants to merge 1 commit into from
Closed
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: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ gem "rack-test", :require => "rack/test", :group => :development
gem "flores", "~> 0.0.6", :group => :development
gem "term-ansicolor", "~> 1.3.2", :group => :development
gem "docker-api", "1.31.0", :group => :development
gem "pleaserun", "~>0.0.27"
gem "pleaserun", "~>0.0.28"
gem "logstash-input-heartbeat"
gem "logstash-codec-collectd"
gem "logstash-output-xmpp"
Expand Down
30 changes: 26 additions & 4 deletions bin/system-install
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ unset CDPATH
setup

if [ -z "$1" ]; then
[ -r ${LOGSTASH_HOME}/config/startup.options ] && . ${LOGSTASH_HOME}/config/startup.options
[ -r /etc/logstash/startup.options ] && . /etc/logstash/startup.options
if [ -r /etc/logstash/startup.options ]; then
OPTIONS_PATH=/etc/logstash/startup.options
elif [ -r ${LOGSTASH_HOME}/config/startup.options ]; then
OPTIONS_PATH=${LOGSTASH_HOME}/config/startup.options
fi
elif [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
echo "Usage: system-install [OPTIONSFILE] [STARTUPTYPE] [VERSION]"
echo
Expand All @@ -29,7 +32,7 @@ elif [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
else
if [ -r $1 ]; then
echo "Using provided startup.options file: ${1}"
. $1
OPTIONS_PATH=$1
else
echo "$1 is not a file path"
echo "To manually specify a startup style, put the path to startup.options as the "
Expand All @@ -38,6 +41,24 @@ else
fi
fi

# Read in the env vars in the selected startup.options file...
. ${OPTIONS_PATH}

old_IFS=$IFS
IFS=$'\n'
lines=($(grep -v ^# ${OPTIONS_PATH} | tr -d '"' | grep -v '^LS_OPTS=' | grep \= | grep -v '\=$' | grep -v '\=\"\"$'))
IFS=$old_IFS

ENV_VAR_ARGS=()

for line in ${lines[@]}; do
var=$(echo $line | awk -F\= '{print $1}')
if [ "x${!var}" != "x" ]; then
ENV_VAR_ARGS+=('--environment-variables')
ENV_VAR_ARGS+=("${var}=${!var}")
fi
done

# bin/logstash-plugin is a short lived ruby script thus we can use aggressive "faster starting JRuby options"
# see https://github.com/jruby/jruby/wiki/Improving-startup-time
export JRUBY_OPTS="$JRUBY_OPTS -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-noverify -X-C -Xcompile.invokedynamic=false"
Expand All @@ -61,9 +82,10 @@ if [[ $3 ]]; then
opts+=($3)
fi

allopts=("${ENV_VAR_ARGS[@]}" "${opts[@]}")
program="$(cd `dirname $0`/..; pwd)/bin/logstash"

$(ruby_exec "${LOGSTASH_HOME}/lib/systeminstall/pleasewrap.rb" "${opts[@]}" ${program} ${LS_OPTS})
$(ruby_exec "${LOGSTASH_HOME}/lib/systeminstall/pleasewrap.rb" "${allopts[@]}" ${program} ${LS_OPTS})
exit_code=$?

if [ $exit_code -ne 0 ]; then
Expand Down