Issue #3123 has been updated by Chris Blumentritt.

File exectest.pp added

Okay I got it a bit wrong, it is late for me.  I have corrected my test 
manifest and the new debug output is below.  What really happens is the files 
get created for both cases of unless and do not get created for both cases of 
onlyif.

tornado:scratch$ puppet --debug exectest.pp 
debug: Creating default schedules
debug: Failed to load library 'shadow' for feature 'libshadow'
debug: Failed to load library 'selinux' for feature 'selinux'
info: Applying configuration version '1264670703'
debug: //Exec[test unless exit 1]: Executing check 'diff -q <(echo a) <(echo b)'
debug: Executing 'diff -q <(echo a) <(echo b)'
debug: //Exec[test unless exit 1]: Changing returns
debug: //Exec[test unless exit 1]: 1 change(s)
debug: //Exec[test unless exit 1]: Executing 'echo foo > /tmp/exec-unless1'
debug: Executing 'echo foo > /tmp/exec-unless1'
notice: //Exec[test unless exit 1]/returns: executed successfully
debug: //Exec[test onlyif  exit 1]: Executing check 'diff -q <(echo a) <(echo 
b)'
debug: Executing 'diff -q <(echo a) <(echo b)'
debug: //Exec[test unless exit 0]: Executing check 'diff -q <(echo a) <(echo a)'
debug: Executing 'diff -q <(echo a) <(echo a)'
debug: //Exec[test unless exit 0]: Changing returns
debug: //Exec[test unless exit 0]: 1 change(s)
debug: //Exec[test unless exit 0]: Executing 'echo foo > /tmp/exec-unless0'
debug: Executing 'echo foo > /tmp/exec-unless0'
notice: //Exec[test unless exit 0]/returns: executed successfully
debug: //Exec[test onlyif exit 0]: Executing check 'diff -q <(echo a) <(echo a)'
debug: Executing 'diff -q <(echo a) <(echo a)'
debug: Finishing transaction 2166976140 with 2 changes
----------------------------------------
Bug #3123: onlyif and unless do not work when using subshell with in the 
statement
http://projects.reductivelabs.com/issues/3123

Author: Chris Blumentritt
Status: Unreviewed
Priority: Normal
Assigned to: 
Category: exec
Target version: 
Affected version: 0.25.3
Keywords: 
Branch: 


Feel free to change that subject as I don't really know how to explain the 
problem.  I have a situation where I have to diff the output of commands.  This 
can be done by doing something like:

diff <(echo a) <(echo a)

This will return an exit status of 0

diff <(echo a) <(echo b)

This will return an exit status of 1

unless and only if seems to ignore this and always run the command specified in 
the exec statement

Attached is a manifest to reproduce the problem.  Below is a debug trace of the 
out put when running the attached manifest.  I have verified this with 0.25.1 
and 0.25.3 on karmic and 0.25.3 in snow leopard (those are the only versions I 
tried).

tornado:scratch$ puppet --trace --debug exectest.pp 
debug: Creating default schedules
debug: Failed to load library 'shadow' for feature 'libshadow'
debug: Failed to load library 'selinux' for feature 'selinux'
info: Applying configuration version '1264667348'
debug: //Exec[test unless exit 1]: Executing check 'diff -q <(echo a) <(echo b)'
debug: Executing 'diff -q <(echo a) <(echo b)'
debug: //Exec[test unless exit 1]: Changing returns
debug: //Exec[test unless exit 1]: 1 change(s)
debug: //Exec[test unless exit 1]: Executing 'echo foo > /tmp/exec-unless1'
debug: Executing 'echo foo > /tmp/exec-unless1'
notice: //Exec[test unless exit 1]/returns: executed successfully
debug: //Exec[test unless exit 0]: Executing check 'diff -q <(echo a) <(echo a)'
debug: Executing 'diff -q <(echo a) <(echo a)'
debug: //Exec[test unless exit 0]: Changing returns
debug: //Exec[test unless exit 0]: 1 change(s)
debug: //Exec[test unless exit 0]: Executing 'echo foo > /tmp/exec-unless0'
debug: Executing 'echo foo > /tmp/exec-unless0'
notice: //Exec[test unless exit 0]/returns: executed successfully
debug: //Exec[test onlyif exit 0]: Executing check 'diff -q <(echo a) <(echo a)'
debug: Executing 'diff -q <(echo a) <(echo a)'
debug: //Exec[test onlyif exit 0]: Changing returns
debug: //Exec[test onlyif exit 0]: 1 change(s)
debug: //Exec[test onlyif exit 0]: Executing 'echo foo > /tmp/exec-onlyif0'
debug: Executing 'echo foo > /tmp/exec-onlyif0'
notice: //Exec[test onlyif exit 0]/returns: executed successfully
debug: //Exec[test onlyif  exit 1]: Executing check 'diff -q <(echo a) <(echo 
b)'
debug: Executing 'diff -q <(echo a) <(echo b)'
debug: //Exec[test onlyif  exit 1]: Changing returns
debug: //Exec[test onlyif  exit 1]: 1 change(s)
debug: //Exec[test onlyif  exit 1]: Executing 'echo foo > /tmp/exec-onlyif1'
debug: Executing 'echo foo > /tmp/exec-onlyif1'
notice: //Exec[test onlyif  exit 1]/returns: executed successfully
debug: Finishing transaction 2166971880 with 4 changes





-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://reductivelabs.com/redmine/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to