Uploaded image for project: 'Facter'
  1. Facter
  2. FACT-3079

Caching not working for some custom facts

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • None
    • FACT 4.2.6
    • None
    • Puppet 7.11 on CentOS 7

    • Night's Watch
    • 5
    • NW - 2021-11-17, NW - 2021-12-06
    • Needs Assessment
    • Bug Fix
    • Hide
      When using `Facter.value(:fact_name)` inside a custom fact, caching will not
      work properly, as it will caches the value from the inner fact instead of the actual fact.

      Now it will correctly cache the required fact, by skipping writing the cache
      file when it is not required.
      Show
      When using `Facter.value(:fact_name)` inside a custom fact, caching will not work properly, as it will caches the value from the inner fact instead of the actual fact. Now it will correctly cache the required fact, by skipping writing the cache file when it is not required.
    • Needs Assessment

    Description

      I have configured facter to cache and block several core and custom facts (puppet 7.11) and I am finding that the behaviour is odd.   The example that I have attached here is from the puppetlabs-yum module that declares 3 custom facts:

      - yum_package_updates (This is the primary fact that does all the work)
      - yum_has_updates (returns the value of yum_package_updates.any?)

      • yum_updates (returns the value of yum_package_updates.length)

      My facter.conf file (attached) declares a yum group that contains these 3 facts but when I run puppet only the yum_package_updates fact is cached (cache file attached).

      This seems to cause the other two dependent facts (yum_has_updates and yum_updates) to force the resolution (not from cache) of the main yum_package_updates fact.

      I can also see in the debug logs that it seems to use the cache sometimes but then lose the cached value and resolve it again.  It also states that the cache file is expired, missing or corrupt but the file is fresh, created by facter itself and the ttl is 6 hours.

      If I specify all 3 facts in the cache individually (not in a group) the caching behaviour seems to work properly.  

      Attachments

        1. facter.conf
          0.1 kB
        2. yum
          1 kB
        3. yum-facter-debug.log
          100 kB

        Activity

          People

            dorin.pleava Dorin Pleava
            tparker@cbnco.com Tom Parker
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Zendesk Support