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

Failure when structured custom fact has a wrong layout

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • None
    • FACT 4.0.47
    • None
    • Hide

      For this particular case we should output an error stating that something is wrong with how the layout of the structured fact, or that we can not add a fact to a fact's value.

      Show
      For this particular case we should output an error stating that something is wrong with how the layout of the structured fact, or that we can not add a fact to a fact's value.
    • Night's Watch
    • 2
    • ghost-11.11, ghost 25.11
    • Needs Assessment
    • Enhancement
    • Added log message when custom fact names are incompatible and a fact hierarchy cannot be created.
    • Needs Assessment

    Description

      When creating a structured custom fact with:

      # frozen_string_literal: true
       
      Facter.add(:'my_fact.f1') do
        setcode do
          'f1_value'
        end
      end
       
      Facter.add(:'my_fact.f1.l1') do
        setcode do
          'f1_l1_value'
        end
      end
      
      

      When requesting for my_fact, facter fails with:

      NoMethodError: undefined method `bury' for "f1_value":String
        /Users/andrei.filipovici/projects/facter_fork/lib/facter/models/fact_collection.rb:33:in `bury'
      

      This happens because my_fact.f1.l1 tries to add a fact to my_fact.f1's value.

      Attachments

        Activity

          People

            bogdan.irimie Bogdan Irimie
            andrei.filipovici Andrei Filipovici
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Zendesk Support