Issue #17887 has been updated by Dominic Cleal.

Josh Cooper wrote:
> Dominic, I'm marking the PR as code as insufficient, because we still want to 
> log the exception that results from the failure to sync the property.

Generally, we don't want to be catching things that aren't StandardErrors here, 
they should still be propagating up.

> Patrick and I were discussing creating a timeout method, e.g. 
> Puppet::Util.timeout, and have that always throw an instance of a standard 
> error.
> 
> But in my case, the Timeout::Error is originating in the Net::HTTP code due 
> to read timing out. Perhaps the best thing is to wrap our 
> Puppet::Network::HTTP::Connection#request method to catch Timeout::Error 
> explicitly and raise a Puppet::Error.

Timeouts are an exception and yes, should be fixed and caught lower down since 
we can skip to the next task.  I don't think this applies to anything else such 
as the mocha expectations in this issue, receiving signals, OOMs etc.  I'd 
suggest addressing that separately.
----------------------------------------
Bug #17887: Failure during property sync results in "Puppet::Util::Log requires 
a message"
https://projects.puppetlabs.com/issues/17887#change-81277

Author: Dominic Cleal
Status: Code Insufficient
Priority: Normal
Assignee: Dominic Cleal
Category: transactions
Target version: 3.x
Affected Puppet version: development
Keywords: resource harness, transaction
Branch: https://github.com/puppetlabs/puppet/pull/1358


During provider development and testing with rspec+mocha and using a test 
catalog, an expectation failure can cause the following log message:

    Could not evaluate: Puppet::Util::Log requires a message

This occurs if the property sync calls a method that has a mocha expectation 
set, but has reached the max call count or similar.

When testing a catalog from a test, the `Puppet::Transaction::ResourceHarness` 
calls `apply_parameter` for a given parameter, which then calls 
`property.sync`.  If the mocha expectation fails inside this sync, the `rescue` 
block is never called (it isn't an exception) but the `ensure` block is still 
run.  This calls `send_log` on the event, but the message is uninitialised at 
that point so the logging fails with the above 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