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

cannot use text-based external facts to represent empty fact-values.

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Normal
    • Resolution: Won't Do
    • FACT 2.3.0
    • None
    • None
    • None

    Description

      Text-based external facts can be created by adding a file to a module's facts.d/ directory. Indeed, thanks to another bug, at least one fact must exist (or an error is generated). It becomes sensible to create a "null" fact. However, the text-based parser does not allow this.

        module KeyValuePairOutputFormat
          def self.parse(output)
            return {} if output.nil?
       
            result = {}
            re = /^(.+?)=(.+)$/
            output.each_line do |line|
              if match_data = re.match(line.chomp)
                result[match_data[1]] = match_data[2]
              end
            end
            result
          end
        end
      

      A different re would fix this:

      re = /^(.+?)=(.*)$/
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              otheus otheus
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support

                  Time Tracking

                    Estimated:
                    Original Estimate - 2 hours
                    2h
                    Remaining:
                    Remaining Estimate - 2 hours
                    2h
                    Logged:
                    Time Spent - Not Specified
                    Not Specified