Skip to content

Commit

Permalink
Rework ACTION EXEC to embed the command in the action verb.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonhattan committed Sep 8, 2015
1 parent 2efb3e1 commit b071dd5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
8 changes: 6 additions & 2 deletions lib/puppet/parser/functions/monit_validate_tests.rb
Expand Up @@ -77,8 +77,12 @@ module Puppet::Parser::Functions
unless TEST_ACTIONS.include? test['action']
raise Puppet::ParseError, exception_prefix + "invalid action '#{test['action']}'"
else
if test['action'] == 'EXEC' and not test.key? 'exec'
raise Puppet::ParseError, exception_prefix + "missing command for exec action"
if test['action'] == 'EXEC'
unless test.key? 'exec'
raise Puppet::ParseError, exception_prefix + "missing command for exec action"
else
test['action'] = "EXEC \"#{test['exec']}\""
end
end
end
end
Expand Down
7 changes: 2 additions & 5 deletions templates/check/common.erb
Expand Up @@ -17,9 +17,6 @@
<%- if test.key? 'tolerance' -%>
FOR <%= test['tolerance'] %>
<%- end -%>
THEN <%= test['action'] -%>
<%- if test.key? 'exec' -%>
"<%= test['exec'] %>"
<%- end -%>
<%- end %>
THEN <%= test['action'] %>
<%- end -%>

1 comment on commit b071dd5

@derjohn
Copy link
Contributor

@derjohn derjohn commented on b071dd5 Sep 8, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, so the erb is still clean and correctly indented.

Please sign in to comment.