Issue #17246 has been updated by Dominic Cleal. Description updated Status changed from Needs More Information to Needs Decision Assignee changed from Dominic Cleal to Andrew Parker
Andrew Parker wrote: > Dominic, can you provide a proposal of how you think the interface for > defining the features in this manner might work? Sure. It needs to continue supporting the following test methods: * evaluate a supplied code block * test for presence of library and load it But explicitly expose these caching options: * run once only, always cache (pre-#14822 behaviour) * positive cache only (post-#14822 behaviour) * never cache The `Puppet::Util::Feature.add` method currently executes a block immediately and always caches, else it uses positive result caching. I'd suggest just accepting a new element in the options hash to indicate caching methodology (`:always`, `:positive`, `:never`). For now leave the default as following the current mixed behaviour and aim to change the default to `:positive` on a minor/major release (Andy?) to ensure consistency (e.g. if I change from :libs to a code block to initialise my library, caching behaviour shouldn't change). This would mean changing most code blocks in `lib/puppet/features/` to specify `:always` since `posix` or `microsoft_windows` aren't going to change during a run. ---------------------------------------- Refactor #17246: Refactor Puppet::Util::Feature.add to expose caching options https://projects.puppetlabs.com/issues/17246#change-77968 Author: Dominic Cleal Status: Needs Decision Priority: Normal Assignee: Andrew Parker Category: Target version: Affected Puppet version: 3.0.0 Keywords: features Branch: The "add" method of Puppet::Util::Feature has a couple of different caching behaviours, which should instead be explicitly exposed through the options hash or via multiple methods. Prior to #14822: * blocks get immediately run and the result cached * test results get cached on the first query to the feature After #14822: * blocks get immediately run and the result cached * tests, positive results get cached on the first query to the feature The interface should probably offer the ability to always cache, positive or negative cache and to never cache. -- 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.
