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

Dig method fails on puppet $facts

    XMLWordPrintable

    Details

    • Template:
    • Team:
      Night's Watch
    • Sub-team:
    • Sprint:
      ghost-9.12
    • Method Found:
      Needs Assessment
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Hide
      Description of the problem: dig on $facts ('dig($facts, "os", "family")') fails with Facter 4. Facter's API method to_hash returns a different data type (Facter::FactCollection) than Facter 3.
      Description of the fix: Ensure that to_hash method returns a ruby Hash instance.
      Show
      Description of the problem: dig on $facts ('dig($facts, "os", "family")') fails with Facter 4. Facter's API method to_hash returns a different data type (Facter::FactCollection) than Facter 3. Description of the fix: Ensure that to_hash method returns a ruby Hash instance.
    • QA Risk Assessment:
      Needs Assessment

      Description

      On Puppet 7.0 it's not possible to dig() into $facts using Facter 4.

      root@base-buster-01-test:~# puppet -V
      7.0.0
      root@base-buster-01-test:~# puppet apply -e 'dig($facts, "os", "family")'
      Error: Evaluation Error: Error while evaluating a Function Call, 'dig' parameter 'data' expects a value of type Undef or Collection, got Runtime (line: 1, column: 1) on node base-buster-01-test.local
      

      Facter doen't return a Hash or a Collection and that seems to be the root cause:

      puppet apply -e 'notice(type($facts))'
      Notice: Scope(Class[main]): Runtime[ruby, 'Facter::FactCollection']
      

        Attachments

          Activity

            People

            Assignee:
            oana.tanasoiu Oana Tanasoiu
            Reporter:
            oana.tanasoiu Oana Tanasoiu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support