diff options
author | Jacob Helwig <jacob@puppetlabs.com> | 2011-05-20 11:50:27 -0700 |
---|---|---|
committer | Jacob Helwig <jacob@puppetlabs.com> | 2011-05-20 11:50:27 -0700 |
commit | 2c5effffa0558f0cec4e84d07ee80ffa27db9a2f (patch) | |
tree | fbba104c5d714156b3dc872b9e006107ee2a4618 /lib | |
parent | 0466baabc2b0f7f6858e707ff22d097594f80d00 (diff) | |
parent | 024f7c99543e58ec00bb8f755a1d89d01fd5174c (diff) | |
download | facter-2c5effffa0558f0cec4e84d07ee80ffa27db9a2f.tar.gz facter-2c5effffa0558f0cec4e84d07ee80ffa27db9a2f.tar.xz facter-2c5effffa0558f0cec4e84d07ee80ffa27db9a2f.zip |
Merge branch 'master' into next
* master:
Update CHANGELOG for 1.5.9
Updated CHANGELOG for 1.5.9rc6
Removed inappropriately uncredited Ohai method from ec2 fact
Add facter test for ticket 7039
downcase arp output so that the ec2 arp is matched
(#7039) Pre-load all facts when requesting a single fact
Diffstat (limited to 'lib')
-rw-r--r-- | lib/facter/application.rb | 14 | ||||
-rw-r--r-- | lib/facter/arp.rb | 2 |
2 files changed, 9 insertions, 7 deletions
diff --git a/lib/facter/application.rb b/lib/facter/application.rb index 6b351b1..bd68149 100644 --- a/lib/facter/application.rb +++ b/lib/facter/application.rb @@ -9,19 +9,21 @@ module Facter # Accept fact names to return from the command line names = argv - # Create the facts hash that is printed to standard out - if names.empty? - facts = Facter.to_hash - else + # Create the facts hash that is printed to standard out. + # Pre-load all of the facts, since we can have multiple facts + # per file, and since we can't know ahead of time which file a + # fact will be in, we'll need to load every file. + facts = Facter.to_hash + unless names.empty? facts = {} - names.each { |name| + names.each do |name| begin facts[name] = Facter.value(name) rescue => error $stderr.puts "Could not retrieve #{name}: #{error}" exit 10 end - } + end end # Print the facts as YAML and exit diff --git a/lib/facter/arp.rb b/lib/facter/arp.rb index 85befa4..383fb48 100644 --- a/lib/facter/arp.rb +++ b/lib/facter/arp.rb @@ -8,7 +8,7 @@ Facter.add(:arp) do arp = "" output.each_line do |s| if s =~ /^\S+\s\S+\s\S+\s(\S+)\s\S+\s\S+\s\S+$/ - arp = $1 + arp = $1.downcase break # stops on the first match end end |