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

Stdout in facts invalidates formatted output (yaml/json)

    XMLWordPrintable

Details

    • Platform OS
    • Platform OS Kanban

    Description

      When there is output to stdout in facts it creates a problem with the format options:

      Facter.add('test') do 
       confine :kernel => 'Linux' 
       begin 
       test = 'nomatch' 
       test = Facter.value(:doesntexist).strip()
      setcode { test }
      rescue Exception => ex 
       puts "#{File.basename(__FILE__)} - ruby fact threw an exception: #{ex}" 
       end 
      end
      

      Output:

      # facter -p -j test
      test.rb - ruby fact threw an exception: undefined method `strip' for nil:NilClass
      {
       "test": ""
      }

      Desired Outcome:

      using --json or --yaml should print the valid format even if there are messages sent to stdout. 

      Attachments

        Issue Links

          Activity

            People

              branan Branan Riley
              erik.hansen Erik Hansen
              Votes:
              1 Vote for this issue
              Watchers:
              13 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support