facter 1.6.3 → 1.6.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of facter might be problematic. Click here for more details.

data/CHANGELOG CHANGED
@@ -1,3 +1,10 @@
1
+ 1.6.4
2
+ ===
3
+ 6406c8f (##11041) Add dmidecode as a requirement for rpm
4
+ ed81492 (#10444) Add identification of system boards to Facter
5
+ bdbb2da (#10885) Malformed facter.bat when ruby dir contains backreferences
6
+ 0bad18b (#10490) Handle case where no macaddress can be found
7
+
1
8
  1.6.3
2
9
  ===
3
10
  b2a66a9 (#7038) Validate prtdiag output in manufacturer
@@ -2,11 +2,11 @@
2
2
 
3
3
  %define has_ruby_abi 0%{?fedora} || 0%{?rhel} >= 5
4
4
  %define has_ruby_noarch %has_ruby_abi
5
- %global _ver 1.6.3
5
+ %global _ver 1.6.4
6
6
 
7
7
  Summary: Ruby module for collecting simple facts about a host operating system
8
8
  Name: facter
9
- Version: 1.6.3
9
+ Version: 1.6.4
10
10
  Release: 0.1rc1%{?dist}
11
11
  License: Apache 2.0
12
12
  Group: System Environment/Base
@@ -21,6 +21,7 @@ BuildArch: noarch
21
21
 
22
22
  Requires: ruby >= 1.8.1
23
23
  Requires: which
24
+ Requires: dmidecode
24
25
  %if %has_ruby_abi
25
26
  Requires: ruby(abi) = 1.8
26
27
  %endif
@@ -53,6 +54,9 @@ rm -rf %{buildroot}
53
54
 
54
55
 
55
56
  %changelog
57
+ * Wed Nov 30 2011 Matthaus Litteken <matthaus@puppetlabs.com> - 1.6.4-0.1rc1
58
+ - 1.6.4 rc1
59
+
56
60
  * Mon Oct 31 2011 Michael Stahnke <stahnma@puppetlabs.com> - 1.6.3-0.1rc1
57
61
  - 1.6.3 rc1
58
62
 
data/install.rb CHANGED
@@ -418,9 +418,17 @@ def install_binfile(from, op_file, target)
418
418
  if not installed_wrapper
419
419
  tmp_file2 = File.join(tmp_dir, '_tmp_wrapper')
420
420
  cwn = File.join(Config::CONFIG['bindir'], op_file)
421
- cwv = CMD_WRAPPER.gsub('<ruby>', ruby.gsub(%r{/}) { "\\" }).gsub!('<command>', cwn.gsub(%r{/}) { "\\" } )
422
-
423
- File.open(tmp_file2, "wb") { |cw| cw.puts cwv }
421
+ cwv = <<-EOS
422
+ @echo off
423
+ if "%OS%"=="Windows_NT" goto WinNT
424
+ #{ruby} -x "#{cwn}" %1 %2 %3 %4 %5 %6 %7 %8 %9
425
+ goto done
426
+ :WinNT
427
+ #{ruby} -x "#{cwn}" %*
428
+ goto done
429
+ :done
430
+ EOS
431
+ File.open(tmp_file2, "w") { |cw| cw.puts cwv }
424
432
  FileUtils.install(tmp_file2, File.join(target, "#{op_file}.bat"), :mode => 0755, :verbose => true)
425
433
 
426
434
  File.unlink(tmp_file2)
@@ -431,17 +439,6 @@ def install_binfile(from, op_file, target)
431
439
  File.unlink(tmp_file)
432
440
  end
433
441
 
434
- CMD_WRAPPER = <<-EOS
435
- @echo off
436
- if "%OS%"=="Windows_NT" goto WinNT
437
- <ruby> -x "<command>" %1 %2 %3 %4 %5 %6 %7 %8 %9
438
- goto done
439
- :WinNT
440
- <ruby> -x "<command>" %*
441
- goto done
442
- :done
443
- EOS
444
-
445
442
  check_prereqs
446
443
  prepare_installation
447
444
 
data/lib/facter.rb CHANGED
@@ -24,7 +24,7 @@ module Facter
24
24
  include Comparable
25
25
  include Enumerable
26
26
 
27
- FACTERVERSION = '1.6.3'
27
+ FACTERVERSION = '1.6.4'
28
28
  # = Facter
29
29
  # Functions as a hash of 'facts' you might care about about your
30
30
  # system, such as mac address, IP address, Video card, etc.
@@ -42,6 +42,11 @@ elsif Facter.value(:kernel) == "windows"
42
42
  Facter::Manufacturer.win32_find_system_info(win32_keys)
43
43
  else
44
44
  query = {
45
+ '[Bb]ase [Bb]oard [Ii]nformation' => [
46
+ { 'Manufacturer:' => 'boardmanufacturer' },
47
+ { 'Product(?: Name)?:' => 'boardproductname' },
48
+ { 'Serial Number:' => 'boardserialnumber' }
49
+ ],
45
50
  '[Ss]ystem [Ii]nformation' => [
46
51
  { 'Manufacturer:' => 'manufacturer' },
47
52
  { 'Product(?: Name)?:' => 'productname' },
@@ -3,6 +3,7 @@
3
3
  module Facter::Util::Macaddress
4
4
 
5
5
  def self.standardize(macaddress)
6
+ return nil unless macaddress
6
7
  macaddress.split(":").map{|x| "0#{x}"[-2..-1]}.join(":")
7
8
  end
8
9
 
@@ -0,0 +1,8 @@
1
+ lo Link encap:Local Loopback
2
+ inet addr:127.0.0.1 Mask:255.0.0.0
3
+ UP LOOPBACK RUNNING MTU:16436 Metric:1
4
+ RX packets:0 errors:0 dropped:0 overruns:0 frame:0
5
+ TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
6
+ collisions:0 txqueuelen:0
7
+ RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
8
+
@@ -0,0 +1,24 @@
1
+ lo Link encap:Local Loopback
2
+ inet addr:127.0.0.1 Mask:255.0.0.0
3
+ inet6 addr: ::1/128 Scope:Host
4
+ UP LOOPBACK RUNNING MTU:16436 Metric:1
5
+ RX packets:334 errors:0 dropped:0 overruns:0 frame:0
6
+ TX packets:334 errors:0 dropped:0 overruns:0 carrier:0
7
+ collisions:0 txqueuelen:0
8
+ RX bytes:16700 (16.7 KB) TX bytes:16700 (16.7 KB)
9
+
10
+ venet0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
11
+ inet addr:127.0.0.1 P-t-P:127.0.0.1 Bcast:0.0.0.0 Mask:255.255.255.255
12
+ UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
13
+ RX packets:7622207 errors:0 dropped:0 overruns:0 frame:0
14
+ TX packets:8183436 errors:0 dropped:1 overruns:0 carrier:0
15
+ collisions:0 txqueuelen:0
16
+ RX bytes:2102750761 (2.1 GB) TX bytes:2795213667 (2.7 GB)
17
+
18
+ venet0:0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
19
+ inet addr:XXX.XXX.XXX.XX1 P-t-P:XXX.XXX.XXX.XX1 Bcast:0.0.0.0 Mask:255.255.255.255
20
+ UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
21
+
22
+ venet0:1 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
23
+ inet addr:XXX.XXX.XXX.XX2 P-t-P:XXX.XXX.XXX.XX2 Bcast:0.0.0.0 Mask:255.255.255.255
24
+ UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
@@ -120,7 +120,9 @@ describe Facter do
120
120
 
121
121
  # #33 Make sure we only get one mac address
122
122
  it "should only return one mac address" do
123
- Facter.value(:macaddress).should_not be_include(" ")
123
+ if macaddress = Facter.value(:macaddress)
124
+ macaddress.should_not be_include(" ")
125
+ end
124
126
  end
125
127
 
126
128
  it "should have a method for registering directories to search" do
@@ -18,21 +18,45 @@ describe "macaddress fact" do
18
18
  Facter::Util::Config.stubs(:is_windows?).returns(false)
19
19
  end
20
20
 
21
- it "should return macaddress information for Linux" do
22
- Facter.fact(:kernel).stubs(:value).returns("Linux")
23
- Facter.fact(:operatingsystem).stubs(:value).returns("Linux")
24
- Facter::Util::Resolution.stubs(:exec).with('/sbin/ifconfig -a').
25
- returns(ifconfig_fixture('linux_ifconfig_all_with_multiple_interfaces'))
26
-
27
- Facter.value(:macaddress).should == "00:12:3f:be:22:01"
21
+ describe "when run on Linux" do
22
+ before :each do
23
+ Facter.fact(:kernel).stubs(:value).returns("Linux")
24
+ Facter.fact(:operatingsystem).stubs(:value).returns("Linux")
25
+ end
26
+
27
+ it "should return the macaddress of the first interface" do
28
+ Facter::Util::Resolution.stubs(:exec).with('/sbin/ifconfig -a').
29
+ returns(ifconfig_fixture('linux_ifconfig_all_with_multiple_interfaces'))
30
+
31
+ Facter.value(:macaddress).should == "00:12:3f:be:22:01"
32
+ end
33
+
34
+ it "should return nil when no macaddress can be found" do
35
+ Facter::Util::Resolution.stubs(:exec).with('/sbin/ifconfig -a').
36
+ returns(ifconfig_fixture('linux_ifconfig_no_mac'))
37
+
38
+ proc { Facter.value(:macaddress) }.should_not raise_error
39
+ Facter.value(:macaddress).should be_nil
40
+ end
41
+
42
+ # some interfaces dont have a real mac addresses (like venet inside a container)
43
+ it "should return nil when no interface has a real macaddress" do
44
+ Facter::Util::Resolution.stubs(:exec).with('/sbin/ifconfig -a').
45
+ returns(ifconfig_fixture('linux_ifconfig_venet'))
46
+
47
+ proc { Facter.value(:macaddress) }.should_not raise_error
48
+ Facter.value(:macaddress).should be_nil
49
+ end
28
50
  end
29
51
 
30
- it "should return macaddress information for BSD" do
31
- Facter.fact(:kernel).stubs(:value).returns("FreeBSD")
32
- Facter::Util::Resolution.stubs(:exec).with('/sbin/ifconfig').
33
- returns(ifconfig_fixture('bsd_ifconfig_all_with_multiple_interfaces'))
52
+ describe "when run on BSD" do
53
+ it "should return macaddress information" do
54
+ Facter.fact(:kernel).stubs(:value).returns("FreeBSD")
55
+ Facter::Util::Resolution.stubs(:exec).with('/sbin/ifconfig').
56
+ returns(ifconfig_fixture('bsd_ifconfig_all_with_multiple_interfaces'))
34
57
 
35
- Facter.value(:macaddress).should == "00:0b:db:93:09:67"
58
+ Facter.value(:macaddress).should == "00:0b:db:93:09:67"
59
+ end
36
60
  end
37
61
 
38
62
  end
@@ -8,10 +8,15 @@ describe "standardized MAC address" do
8
8
  it "should have zeroes added if missing" do
9
9
  Facter::Util::Macaddress::standardize("0:ab:cd:e:12:3").should == "00:ab:cd:0e:12:03"
10
10
  end
11
-
11
+
12
12
  it "should be identical if each octet already has two digits" do
13
13
  Facter::Util::Macaddress::standardize("00:ab:cd:0e:12:03").should == "00:ab:cd:0e:12:03"
14
14
  end
15
+
16
+ it "should be nil if input is nil" do
17
+ proc { result = Facter::Util::Macaddress.standardize(nil) }.should_not raise_error
18
+ Facter::Util::Macaddress.standardize(nil).should be_nil
19
+ end
15
20
  end
16
21
 
17
22
  describe "Darwin", :unless => Facter.value(:operatingsystem) == 'windows' do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: facter
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 6
9
- - 3
10
- version: 1.6.3
9
+ - 4
10
+ version: 1.6.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Puppet Labs
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-11-09 00:00:00 Z
18
+ date: 2011-12-07 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description:
@@ -143,6 +143,8 @@ files:
143
143
  - spec/fixtures/ifconfig/fedora_8_eth0
144
144
  - spec/fixtures/ifconfig/freebsd_6_0
145
145
  - spec/fixtures/ifconfig/linux_ifconfig_all_with_multiple_interfaces
146
+ - spec/fixtures/ifconfig/linux_ifconfig_no_mac
147
+ - spec/fixtures/ifconfig/linux_ifconfig_venet
146
148
  - spec/fixtures/ifconfig/open_solaris_10
147
149
  - spec/fixtures/ifconfig/open_solaris_b132
148
150
  - spec/fixtures/ifconfig/sunos_ifconfig_all_with_multiple_interfaces