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

Failure when structured custom fact has a wrong layout

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: FACT 4.0.47
    • Component/s: None
    • Labels:
    • Template:
    • Acceptance Criteria:
      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.
    • Team:
      Night's Watch
    • Sub-team:
    • Story Points:
      2
    • Sprint:
      ghost-11.11, ghost 25.11
    • Method Found:
      Needs Assessment
    • Release Notes:
      Enhancement
    • Release Notes Summary:
      Added log message when custom fact names are incompatible and a fact hierarchy cannot be created.
    • QA Risk Assessment:
      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

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

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support