Use the command parameter if it's defined alongside the source parameter #255
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously if command and source parameters were both specified, the value of command was in fact ignored. This is not desired when the command might need additional preamble or arguments to function.
Specifically my use case is to install a Ruby-based handler, but due to running CentOS/RHEL 6.x with Ruby 1.8.7 and not wanting to pollute the embedded Ruby installed and used by Sensu I have it working using a Ruby installed as part of the RHEL Software Collections. So my actual command should be:
env -u GEM_PATH scl enable ruby193 /etc/sensu/handlers/myshinyhandler.rb
(Annoyingly, I found I need to clear $GEM_PATH otherwise my separate SCL Ruby uses the gems from the embedded Ruby and it still doesn't work)
However when I define my handler like so:
The resulting
myshinyhandler.json
config file just has/etc/sensu/handlers/myshinyhandler.rb
for the command.This PR just uses the value of command if it's defined alongside source, otherwise behave as before and set it to the concatenation of the install path and the base filename of the handler.