Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-3656

Prefetch eats most exceptions (those derived from StandardError), there is no way to fail out.

    XMLWordPrintable

    Details

    • Template:
    • Story Points:
      2
    • Sprint:
      Platform Client 2015-01-21, Client 2015-02-04

      Description

      https://github.com/puppetlabs/puppet/blob/master/lib/puppet/transaction.rb#L306-L310

      This bug still exists in the master branch as of today and was introduced in 2.7.8 with this commit:

      https://github.com/puppetlabs/puppet/commit/000a2d811c740f4179a0cd4ced38e886858cf01f

      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:

      1. 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.
      2. 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.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              peter.huene Peter Huene
              Reporter:
              oholiab Matt Carroll
              Votes:
              4 Vote for this issue
              Watchers:
              12 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support