Last active
June 10, 2016 05:29
-
-
Save GeoffWilliams/bbaf5e5b0f20d968cc3c07124da649af to your computer and use it in GitHub Desktop.
Example of how to do a custom fact parsing output from a perl script that outputs YAML. This ruby file must be distributed via a module as a custom fact and should be saved in the modules lib/facter directory. The facter command can then be used to inspect the resulting structure, eg facter -p myfact.testdata.data1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'yaml' | |
| Facter.add(:myfact) do | |
| setcode do | |
| YAML.load(Facter::Core::Execution.exec("/usr/local/bin/mycoolscript.pl")) | |
| end | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use Facter::Core::Execution instead of %x{} to have more control over executions and errors