Skip to content

Commit

Permalink
Fix to address Facter ticket: https://tickets.puppetlabs.com/browse/D…
Browse files Browse the repository at this point in the history
  • Loading branch information
MFredette committed Aug 16, 2018
1 parent 2293492 commit bc75416
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion source/facter/3.11/custom_facts.md
Expand Up @@ -254,12 +254,15 @@ Facter.add(:sleep) do
Facter::Core::Execution.execute('sleep 10', options = {:timeout => 5})
'did not timeout!'
rescue Facter::Core::Execution::ExecutionFailure
'timeout!'
Facter.warn("Sleep fact timed out!")
end
end
end

```

When Facter runs as standalone, using `Facter.warn` ensures that the message is printed to `STDERR`. When Facter is called as part of a catalog application, using `Facter.warn` prints the message to Puppet's log. If an exception is not caught, Facter automatically logs it as an error.

## Structured facts

Structured facts take the form of either a hash or an array. To create a structured fact, return a hash or an array from the `setcode` statement.
Expand Down

0 comments on commit bc75416

Please sign in to comment.