Project

General

Profile

« Previous | Next » 

Revision e28614c0

Added by Dominic Cleal over 8 years ago

fixes #11170 - pass quoted args through foreman-rake

Use the special "$@" to correctly pass quoted arguments through
foreman-rake, through su and to the underlying rake command. Ensures
the JSON in this command is unharmed:

foreman-rake config -- -k trusted_puppetmaster_hosts -v '["foo.bar.com"]'

Also swallows the "--" which gets passed through on some versions of
rake.

View differences:

script/foreman-rake
cd ~foreman || die "Cannot change to foreman home directory"
[ -f Gemfile ] && BUNDLER_CMD="bundle exec"
CMD="$BUNDLER_CMD $RAKE_CMD $*"
CMD="$BUNDLER_CMD $RAKE_CMD"
if [ $USERNAME = foreman ]; then
RAILS_ENV=production $CMD
RAILS_ENV=production $CMD "$@"
else
su - foreman -s /bin/bash -c "RAILS_ENV=production $CMD"
su - foreman -s /bin/bash -c 'RAILS_ENV=production "$0" "$@"' -- $CMD "$@"
fi

Also available in: Unified diff