Skip to content

Commit

Permalink
adding STDERR to the error pop up
Browse files Browse the repository at this point in the history
  • Loading branch information
doddo committed Dec 1, 2014
1 parent 041a127 commit 863e4cc
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lib/foreman_hooks/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,13 @@ def render_hook_json

def exec_hook(*args)
logger.debug "Running hook: #{args.join(' ')}"
success = if defined? Bundler && Bundler.responds_to(:with_clean_env)
Bundler.with_clean_env { exec_hook_int(render_hook_json, *args) }
else
exec_hook_int(render_hook_json, *args)
end.success?

success, output = if defined? Bundler && Bundler.responds_to(:with_clean_env)
Bundler.with_clean_env { exec_hook_int(render_hook_json, *args) }
else
exec_hook_int(render_hook_json, *args)
end
# Raising here causes Foreman Orchestration to correctly show error bubble in GUI
raise ForemanHooks::Error.new "Hook failure running `#{args.join(' ')}`: #{$?}" unless success
raise ForemanHooks::Error.new "Hook failure running `#{args.join(' ')}`: #{$?} #{output}" unless success
success
end

Expand All @@ -49,6 +48,6 @@ def exec_hook_int(stdin_data, *args)
[output, $?]
end
logger.debug "Hook output: #{output}" if output && !output.empty?
status
[status.success?, output]
end
end

0 comments on commit 863e4cc

Please sign in to comment.