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

`--json` flag inconsistencies between Facter 3 and Facter 4 when resolving external executable files

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Won't Fix
    • None
    • None
    • None
    • Hide

      --json produces the same output on Facter 3 and Facter 4

      Show
      --json produces the same output on Facter 3 and Facter 4
    • Night's Watch
    • 1
    • NW - 2021-09-22
    • Needs Assessment
    • Not Needed
    • Needs Assessment

    Description

      Running facter cli with `--json` produces different outputs, on Facter 3 and Facter 4, for facts that cannot be resolved when querying for fact names

      # facter 4
      ❯ bx facter non_existent --json
      {
        "non_existent": null
      }
       
      # facter 3
      ❯ cfacter non_existent --json
      {
        "non_existent": ""
      }
      

      This can also be seen with external executable facts that do not produce any output, or have errors, creating entries in `puppet facts diff`

      cat /etc/facter/facts.d/bad.sh
      #!/bin/sh
      echo bad=`abc`
       
      puppet facts diff
      Warning: Facter: external fact file "/etc/facter/facts.d/bad.sh" had output on stderr: /etc/facter/facts.d/bad.sh: line 2: abc: command not found
      Warning: Facter: external fact file "/etc/facter/facts.d/bad.sh" had output on stderr: /etc/facter/facts.d/bad.sh: line 2: abc: command not found
      {
        "bad": {
          "new_value": null,
          "old_value": ""
        }
      }
      

      Attachments

        Activity

          People

            luchian.nemes Luchian Nemes
            gheorghe.popescu Gheorghe Popescu
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Zendesk Support