summaryrefslogtreecommitdiffstats
path: root/bin/facter
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-05-16 14:57:26 -0500
committerLuke Kanies <luke@madstop.com>2008-05-16 14:57:26 -0500
commitedbfc44b2c032e489d082664bf011e543b0cba87 (patch)
treea9db970a79c1bde5e96b53b7eb268a1af8ca0ce4 /bin/facter
parentbb41db0bf4221e394411d2a82b6de264b557fb95 (diff)
downloadfacter-edbfc44b2c032e489d082664bf011e543b0cba87.tar.gz
facter-edbfc44b2c032e489d082664bf011e543b0cba87.tar.xz
facter-edbfc44b2c032e489d082664bf011e543b0cba87.zip
Adding a --puppet option to facter to load Puppet facts.
Also updating the changelog for previous work.
Diffstat (limited to 'bin/facter')
-rwxr-xr-xbin/facter14
1 files changed, 12 insertions, 2 deletions
diff --git a/bin/facter b/bin/facter
index 06d61ed..60cde6d 100755
--- a/bin/facter
+++ b/bin/facter
@@ -6,7 +6,7 @@
#
# = Usage
#
-# facter [-d|--debug] [-h|--help] [-v|--version] [-y|--yaml] [fact] [fact] [...]
+# facter [-d|--debug] [-h|--help] [-p|--puppet] [-v|--version] [-y|--yaml] [fact] [fact] [...]
#
# = Description
#
@@ -24,6 +24,9 @@
# help::
# Print this help message
#
+# puppet::
+# Load the Puppet libraries, thus allowing Facter to load Puppet-specific facts.
+#
# version::
# Print the version and exit.
#
@@ -64,7 +67,8 @@ result = GetoptLong.new(
[ "--help", "-h", GetoptLong::NO_ARGUMENT ],
[ "--debug", "-d", GetoptLong::NO_ARGUMENT ],
[ "--yaml", "-y", GetoptLong::NO_ARGUMENT ],
- [ "--config", "-c", GetoptLong::REQUIRED_ARGUMENT ]
+ [ "--config", "-c", GetoptLong::REQUIRED_ARGUMENT ],
+ [ "--puppet", "-p", GetoptLong::NO_ARGUMENT ]
)
options = {
@@ -76,6 +80,12 @@ result.each { |opt,arg|
when "--version"
puts "%s" % Facter.version
exit
+ when "--puppet"
+ begin
+ require 'puppet'
+ rescue LoadError => detail
+ $stderr.puts "Could not load Puppet: %s" % detail
+ end
when "--yaml"
options[:yaml] = true
when "--debug"