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

facter fails when using cached facts in a read-only filesystem

    XMLWordPrintable

Details

    • Hide

      Add a spec test and match the behavior in Facter 3

      Show
      Add a spec test and match the behavior in Facter 3
    • Phoenix
    • 3
    • Phoenix 2022-05-25
    • Needs Assessment
    • Bug Fix
    • Hide
      Facter no longer errors when using cached facts from a read-only filesystem.
      Community contribution from https://github.com/kajinamit
      Show
      Facter no longer errors when using cached facts from a read-only filesystem. Community contribution from https://github.com/kajinamit
    • Needs Assessment

    Description

      When using cached facts in a read-only filesystem, facter fails with error:

      [root@a41691fe3b11 ~]# facter --config facter.conf --debug
      [2022-04-26 16:00:36.720327 ] INFO Facter - executed with command line: --config facter.conf --debug
      [2022-04-26 16:00:36.720370 ] DEBUG Facter - Facter version: 4.2.8
      [2022-04-26 16:00:36.720386 ] DEBUG Facter - blocking collection of EC2 facts
      [2022-04-26 16:00:36.720436 ] DEBUG Facter::ClassDiscoverer - There is no module named Centos
      [2022-04-26 16:00:36.722209 ] DEBUG Facter::FactManager - Resolving facts sequentially
      [2022-04-26 16:00:36.723969 ] DEBUG Facter::FactLoader - Loading all internal facts
      [2022-04-26 16:00:36.728158 ] DEBUG Facter::FactLoader - Loading custom facts
      [2022-04-26 16:00:36.729015 ] DEBUG Facter::FactLoader - Loading external facts
      /usr/share/gems/gems/facter-4.2.8/lib/facter/framework/core/cache_manager.rb:229:in `delete': Read-only file system @ apply2files - /opt/puppetlabs/facter/cache/cached_facts/operating system (Errno::EROFS)
              from /usr/share/gems/gems/facter-4.2.8/lib/facter/framework/core/cache_manager.rb:229:in `delete_cache'
              from /usr/share/gems/gems/facter-4.2.8/lib/facter/framework/core/cache_manager.rb:99:in `read_fact'
              from /usr/share/gems/gems/facter-4.2.8/lib/facter/framework/core/cache_manager.rb:76:in `resolve_fact'
              from /usr/share/gems/gems/facter-4.2.8/lib/facter/framework/core/cache_manager.rb:17:in `block in resolve_facts'
              from /usr/share/gems/gems/facter-4.2.8/lib/facter/framework/core/cache_manager.rb:16:in `delete_if'
              from /usr/share/gems/gems/facter-4.2.8/lib/facter/framework/core/cache_manager.rb:16:in `resolve_facts'
              from /usr/share/gems/gems/facter-4.2.8/lib/facter/framework/core/fact_manager.rb:22:in `resolve_facts'
              from /usr/share/gems/gems/facter-4.2.8/lib/facter.rb:521:in `resolve_facts_for_user_query'
              from /usr/share/gems/gems/facter-4.2.8/lib/facter.rb:454:in `to_user_output'
              from /usr/share/gems/gems/facter-4.2.8/lib/facter/framework/cli/cli.rb:124:in `query'
              from /usr/share/gems/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
              from /usr/share/gems/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
              from /usr/share/gems/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
              from /usr/share/gems/gems/thor-1.1.0/lib/thor/base.rb:485:in `start'
              from /usr/share/gems/gems/facter-4.2.8/lib/facter/framework/cli/cli_launcher.rb:23:in `start'
              from /usr/bin/facter:10:in `<main>'
      

      I'm running this in a centos8 container and my facter.conf file is:

      facts : {
          blocklist: [ "EC2" ],
          cache: true
          ttls: [
            { "kernel" : 8 hour },
            { "memory" : 8 hour },
            { "networking" : 8 hour },
            { "operating system" : 8 hour },
            { "processor" : 8 hour },
          ]
        }   
      

      Note this worked fine with facter 3.14.

      Attachments

        Activity

          People

            Unassigned Unassigned
            amoralej Alfredo Moralejo
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Zendesk Support