Jira (FACT-3022) `--json` flag inconsistencies between Facter 3 and Facter 4

4 views
Skip to first unread message

Gheorghe Popescu (Jira)

unread,
Apr 19, 2021, 5:26:01 AM4/19/21
to puppe...@googlegroups.com
Gheorghe Popescu created an issue
 
Facter / Bug FACT-3022
`--json` flag inconsistencies between Facter 3 and Facter 4
Issue Type: Bug Bug
Assignee: Unassigned
Created: 2021/04/19 2:25 AM
Priority: Normal Normal
Reporter: Gheorghe Popescu

Running facter cli with `--json` produces different outputs on Facter 3 and Facter 4

# 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 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": ""
  }
}

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.13.2#813002-sha1:c495a97)
Atlassian logo

Gheorghe Popescu (Jira)

unread,
Apr 19, 2021, 5:27:03 AM4/19/21
to puppe...@googlegroups.com
Gheorghe Popescu updated an issue
Change By: Gheorghe Popescu
Running facter cli with `--json` produces different outputs , on Facter 3 and Facter 4 , for facts that cannot be resolved



{code}

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

# facter 3
❯ cfacter non_existent --json
{
  "non_existent": ""
}
{code}


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

{code}

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": ""
  }
}
{code}

Gheorghe Popescu (Jira)

unread,
Apr 19, 2021, 5:28:02 AM4/19/21
to puppe...@googlegroups.com
Gheorghe Popescu updated an issue
Running facter cli with `--json` produces different outputs, on Facter 3 and Facter 4, for facts that cannot be resolved


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

# facter 3
❯ cfacter non_existent --json
{
  "non_existent": ""
}
{code}

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


{code}
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": ""
  }
}
{code}
Reply all
Reply to author
Forward
0 new messages