Issue #7019 has been updated by John Crenshaw.

Blast, I always forget about that reading deadlock.

Non-blocking reads are possible, but it can be a bit tricky to get right 
sometimes. The really hard part is that the other process can actually block 
itself by filling up one of the outputs. If you use something like gets() to 
read the output, you'll end up listening for the wrong output sometimes, and 
everything will deadlock. The solution is to use a stream select (I think this 
is IO.Select in Ruby?) to wait for data on BOTH streams at once. The select 
**should** return when either stream has data for you, and should indicate 
which stream has the data, ensuring that you never deadlock by looking at the 
wrong stream. I have a working PHP implementation that I could share if needed; 
this would at least point the way in terms of how the code needs to flow for 
this to work.

Alternately, it looks like the code also uses the tempfile hack in some cases 
to avoid the blocking reads. An alternative would be to always use the temp 
files (never dev null). Then you could get the responses from the files when 
handling failures.
----------------------------------------
Feature #7019: Display output of failed commands
https://projects.puppetlabs.com/issues/7019

Author: John Crenshaw
Status: Investigating
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 
Keywords: 
Branch: 


When a command is executed, Puppet silently discards output in almost all cases 
(I think it is discarding stdout, and only displaying stderr?). A quick example:

Puppet gave me the following error:
`
err: /Stage[main]/Apache::Base/Service[apache]: Failed to call refresh: Could 
not restart Service[apache]: Execution of '/etc/init.d/apache2 restart' 
returned 1:  at /etc/puppet/modules/apache/manifests/classes/apache-base.pp:65
`

To get the actual details of the problem, I have to manually run the command:
`
sudo /etc/init.d/apache2 restart
`

This gives me something more meaningful:
`
Syntax error on line 2 of /etc/apache2/sites-enabled/example.com:
Missing address for VirtualHost
Action 'configtest' failed.
The Apache error log may have more information.
`

Puppet should have displayed this information on its own when it detected that 
there was an error.


-- 
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://projects.puppetlabs.com/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