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 | |
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
-rw-r--r-- | CHANGELOG | 28 | ||||
-rw-r--r-- | accecptance/tests/ticket_7039_facter_multiple_facts_one_file.rb | 31 | ||||
-rw-r--r-- | lib/facter/application.rb | 14 | ||||
-rw-r--r-- | lib/facter/arp.rb | 2 |
4 files changed, 53 insertions, 22 deletions
@@ -1,36 +1,34 @@ -1.5.9rc5 -======== +1.5.9 +===== +4de8b20 Updated CHANGELOG for 1.5.9rc6 +cc67a01 Removed inappropriately uncredited Ohai method from ec2 fact +69f98da Add facter test for ticket 7039 +f91c120 downcase arp output so that the ec2 arp is matched +a75f0f9 (#7039) Pre-load all facts when requesting a single fact +6b97242 Update CHANGELOG for 1.5.9rc5 acf0bb2 Ensures that ARP facts are returned only on EC2 hosts - -1.5.9rc4 -======== +76f544b Updated CHANGELOG for 1.5.9rc4 09b9f9b (#6795) Update tests to reflect changed exec - -1.5.9rc3 -======== +3db1cd0 Updated CHANGELOG for 1.5.9rc3 def3322 (#6795) xendomains: Ignore error output from xm list f39d487 (#6763) Use Facter::Util::Resolution.exec for arp 3eb9410 arp: Cleanup indendation - -1.5.9rc2 -======== +50b9b3f Updated CHANGELOG for 1.5.9rc2 2fb8316 Clean up indentation, and alignment in macaddress_spec.rb 3f0a340 (#6716) fix facter issues on OSX with ipv6 in macaddress.rb. +43f82ef Update CHANGELOG for 1.5.9rc1 d62e079 Fixed #2346 - A much cleverer EC2 fact 0411d2e Fixed #2346 - Part 1: Added arp fact for Linux 5b6f4fa Discussion on ec2 facts - #2346 e917e1a Fixed #3087 - Identify VMWare d0f0f63 (#6327) Memory facts should be available on Mac Darwin -2e48e18 Fixed #6695 - Updated id fact for Darwin et al - -1.5.9rc1 -======== 458a22d Incremented release to 1.5.9 4eb64fe Fixed #6719 Typo ffd80ac (#5011) Adds swap statistics for OSX 1207765 (#6719) Restricts virtualization types for zones 8d71db3 Fixed #6616 - Stubbing in VMware tests on Linux aa959df Remove Solaris from the list of confined systems. It won't get the original lsb facts, and it's nonsensical too. +2e48e18 Fixed #6695 - Updated id fact for Darwin et al d718af4 Fix #6679 - Added Scientific Linux to operatingsystem fact dea6f78 Further fix to #5485 - SELinux facts 6d6d8da (#2721) Merged patch from Brane GraAnar diff --git a/accecptance/tests/ticket_7039_facter_multiple_facts_one_file.rb b/accecptance/tests/ticket_7039_facter_multiple_facts_one_file.rb new file mode 100644 index 0000000..fb78628 --- /dev/null +++ b/accecptance/tests/ticket_7039_facter_multiple_facts_one_file.rb @@ -0,0 +1,31 @@ +test_name "#7039: Facter having issue handling multiple facts in a single file" + +fact_file= %q{ +Facter.add(:test_fact1) do + setcode do + "test fact 1" + end +end + +Facter.add(:test_fact2) do + setcode do + "test fact 2" + end +end +} + +agent1=agents.first +step "Agent: Create fact file with multiple facts" +create_remote_file(agent1, '/tmp/test_facts.rb', fact_file ) + +step "Agent: Verify test_fact1 from /tmp/test_facts.rb" +on(agent1, "export FACTERLIB=/tmp && facter --puppet test_fact1") do + fail_test "Fact 1 not returned by facter --puppet test_fact1" unless + stdout.include? 'test fact 1' +end + +step "Agent: Verify test_fact2 from /tmp/test_facts.rb" +on(agent1, "export FACTERLIB=/tmp && facter --puppet test_fact2") do + fail_test "Fact 1 not returned by facter --puppet test_fact2" unless + stdout.include? 'test fact 2' +end 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 |