This bug still exists in the master branch as of today and was introduced in 2.7.8 with this commit:
The rescue condition means that any exception raised by providers during prefetch gets logged but then swallowed by Puppet. As a result of this, any provider which relies only on prefetch to find all instances will end up running the resource creation regardless of whether the resource exists or not.
In order to negate this behaviour, provider authors would need to create checks for instance existence which run during the creation phase as well, which defeats the point of having prefetch in the first place.
Note to docs: module authors who use the prefetch method may want to be aware of the changes in this fix. Two things to consider:
- previously, the prefetch method could throw any exception and puppet would carry on. As discussed above this is the wrong behavior in general, however some module authors may have stumbled across this, allowed/encouraged prefetch to throw exceptions, and let puppet runs succeed. So modules should be examined for this assumption.
- the only two legitimate causes for prefetch to throw an exception now are LoadError and (added in this puppet 4.0) Puppet::MissingCommand
This is a breaking change in 4.0.