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

Features are not being re-evaluated when a block is used

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 6.0.0
    • Component/s: DOCS, Types and Providers
    • Labels:
      None
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Hide
      Features defined using a block or a list of libraries now behave the same, so the following are equivalent:

      Puppet.features.add(:my_feature) do
        require 'mylib'
      end

      Puppet.features.add(:my_feature, libs: ['my_lib'])

      Previously the result of the block was always cached. With this change only true or false return values are cached. To indicate that the state of the feature is unknown and may become available later, the block should return nil.
      Show
      Features defined using a block or a list of libraries now behave the same, so the following are equivalent: Puppet.features.add(:my_feature) do   require 'mylib' end Puppet.features.add(:my_feature, libs: ['my_lib']) Previously the result of the block was always cached. With this change only true or false return values are cached. To indicate that the state of the feature is unknown and may become available later, the block should return nil.

      Description

      When a block is passed to the add method of Puppet::Util::Feature, it will only get evaluated once. This makes the "feature" feature practically unusable for anything except ruby libraries.

      Updated:

      Features should behave consistently when passed a block or an explicit list of ruby libraries. By default, they should not cache misses. If always_retry_plugins is false, then both block and non-block forms should cache misses, so that puppetserver doesn't try to reevaluate features.

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  josh Josh Cooper
                  Reporter:
                  imriz Imri Zvik
                • Votes:
                  1 Vote for this issue
                  Watchers:
                  8 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: