Developing/Testing Custom Facts for Puppet 5 and 6

Structure of a Custom Fact in Ruby

Facter.add(<fact name>) do
confine :<someFact> => '<some value>'
confine :<someOtherFact> do |f|
f == '<value 1> || f == '<value 2>'
end
has_weight <some number> setcode do
# code for fact ...
end
end

How to Test Run a Custom Fact

$ puppet agent -vt
$ FACTERLIB=<directory of fact> facter <name of custom fact>
$ facter --custom-dir=<directory of fact> <name of custom fact>
$ facter --custom-dir=. foobar

--

--

--

Senior Software Architect located in Houston, Texas

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Information Theory and Elastic: Pt.1 Elastic Common Schema

How to enable auto migration in Go?

Boom or Bust, 50 Days to Colorado Gold Rust: Day 5

The late night tinkering project # 11: Arduino + Flutter = 💙

API Primer — REST API s— what’s in a name…

Building an API to fetch Memes using Python and Flask

Building an Uber Like Cab Service

Optimal VS Code settings

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Michael Sharpe

Michael Sharpe

Senior Software Architect located in Houston, Texas

More from Medium

Memcache Testing and Proxying

Available Assertions In PHPUnit Testing

Develop a Sense of Code.

Avoid using `loadByProperties` to load entities