Project

General

Profile

Actions

Bug #4395

open

errors are ignored if there is a "ignore_failure" in the code.

Added by Marek Hulán about 10 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
foreman_chef
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Original issue reported via github https://github.com/theforeman/foreman_chef/issues/4 by Raboo

I don't know if the errors are supposed to be logged or ignored in foreman when there is a ignore_failure true in the resource.

as an example this code:

execute "use_openjdk7" do
  command "update-java-alternatives -s java-1.7.0-openjdk-amd64" 
  ignore_failure true
  returns 2
  not_if "update-alternatives --display java 2>&1 | grep currently | grep java-7-openjdk" 
end

produces following error in chef client log:
[Thu, 13 Feb 2014 09:50:30 +0100] ERROR: execute[use_openjdk7] (java7::make_default line 1) had an error: Expected process to exit with [2], but received '0'
---- Begin output of update-java-alternatives -s java-1.7.0-openjdk-amd64 ----
STDOUT:
STDERR: update-alternatives: error: no alternatives for apt.
update-alternatives: error: no alternatives for mozilla-javaplugin.so.
update-alternatives: error: no alternatives for xulrunner-1.9-javaplugin.so.
update-java-alternatives: plugin alternative does not exist: /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/IcedTeaPlugin.so
---- End output of update-java-alternatives -s java-1.7.0-openjdk-amd64 ----
Ran update-java-alternatives -s java-1.7.0-openjdk-amd64 returned 0; ignore_failure is set, continuing

and in foreman it's blank:

It's the same behavior with chef 11 and chef 10 clients.

also same behavior when reports_log_level "debug".
The funny thing is that it doesn't even display that resource as being run..

No data to display

Actions

Also available in: Atom PDF