Issue #16525 has been reported by Hunter Haugen.

----------------------------------------
Bug #16525: Collectors should be evaluated at declaration time
https://projects.puppetlabs.com/issues/16525

Author: Hunter Haugen
Status: Unreviewed
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 
Keywords: 
Branch: 


# Exported Resource Collector Bug

## Overview:

There is [a loop in 
Puppet](https://github.com/puppetlabs/puppet/blob/f15a260295fe36af578802909a0b282abc57c90d/lib/puppet/parser/compiler.rb#L255)
 ( that runs all collectors at the end of processing the catalog, and then 
evaluates any defined resources (in case the collector added them). This means 
that collectors are not run at the time of declaration, and the `defined()` 
funcion in puppet will not find the resources.

The trick to get it working is that the `defined()` method can be put in a 
defined resource declared after the collector, which will cause the collector 
to be run first. Icky.

## Extra

Since this is a fairly complicated issue, I've created a repo to illustrate 
this bug: <https://github.com/hunner/puppet-collector_bug>

Note the broken test: 
<https://github.com/hunner/puppet-collector_bug/blob/master/spec/classes/collector_bug_broken_spec.rb>
 ... this should not be passing, but it does.

Also, I am using a fork of rspec-puppet that implements exported resource 
testing, which is how I found this bug: 
<https://github.com/rodjek/rspec-puppet/pull/49>


-- 
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