facter 1.6.8 → 1.6.9

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,14 @@
1
+ 1.6.9
2
+ ===
3
+ b398bd8 (#14334) Fix dmidecode based facts on DragonFly BSD
4
+ 6c46b2c (#14332) Correct stubbing on Ubuntu
5
+ 753f3a4 Revert "(#12864) Windows: get primary DNS from registry"
6
+ ac51593 Wrap dmidecode/pciutils in ifarch block
7
+ fbaa8fe (#11511) Correct lsbrelease specfile filename
8
+ 14eee2b (#12864) Windows: get primary DNS from registry
9
+ 2842c96 Update rpm spec file
10
+ 515fd65 (#11511) Split lsb facts into multiple files
11
+
1
12
  1.6.8
2
13
  ===
3
14
  b86fe4c (#12831) Add rspec tests to have_which method in Resolution
@@ -1,11 +1,8 @@
1
1
  %{!?ruby_sitelibdir: %define ruby_sitelibdir %(ruby -rrbconfig -e 'puts Object.const_get(defined?(RbConfig) ? :RbConfig : :Config)::CONFIG["sitelibdir"]')}
2
2
 
3
- %define has_ruby_abi 0%{?fedora} || 0%{?rhel} >= 5
4
- %define has_ruby_noarch %has_ruby_abi
5
-
6
3
  Summary: Ruby module for collecting simple facts about a host operating system
7
4
  Name: facter
8
- Version: 1.6.6
5
+ Version: 1.6.9
9
6
  Release: 1%{?dist}
10
7
  #Release: 0.1rc1%{?dist}
11
8
  License: Apache 2.0
@@ -14,22 +11,19 @@ URL: http://www.puppetlabs.com/puppet/related-projects/%{name}
14
11
  #Source0: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}rc1.tar.gz
15
12
  Source0: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}.tar.gz
16
13
  #Source1: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}rc1.tar.gz.asc
14
+ Source1: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}.tar.gz.asc
17
15
 
18
16
  BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
19
- %if %has_ruby_noarch
20
- BuildArch: noarch
21
- %endif
22
17
 
23
- Requires: ruby >= 1.8.1
18
+ Requires: ruby >= 1.8.5
24
19
  Requires: which
25
- # Note: dmidecode is only available on x86 and x86_64 so this package may need to move into being
26
- # arch specific if people are using ppc, arm, s390 etc
20
+ # dmidecode and pciutils are not available on all arches
21
+ %ifarch %ix86 x86_64 ia64
27
22
  Requires: dmidecode
28
23
  Requires: pciutils
29
- %if %has_ruby_abi
30
- Requires: ruby(abi) = 1.8
31
24
  %endif
32
- BuildRequires: ruby >= 1.8.1
25
+ Requires: ruby(abi) = 1.8
26
+ BuildRequires: ruby >= 1.8.5
33
27
 
34
28
  %description
35
29
  Ruby module for collecting simple facts about a host Operating
@@ -59,6 +53,15 @@ rm -rf %{buildroot}
59
53
 
60
54
 
61
55
  %changelog
56
+ * Thu May 17 2012 Moses Mendoza <moses@puppetlabs.com> - 1.6.9-1
57
+ - Update for 1.6.9
58
+
59
+ * Thu May 10 2012 Matthaus Litteken <matthaus@puppetlabs.com> - 1.6.9-0.1rc1
60
+ - Update for 1.6.9rc1
61
+
62
+ * Mon Apr 30 2012 Moses Mendoza <moses@puppetlabs.com> - 1.6.8-1
63
+ - Update for 1.6.8, spec for arch-specific build, req ruby 1.8.5
64
+
62
65
  * Thu Feb 23 2012 Michael Stahnke <stahnma@puppetlabs.com> - 1.6.6-1
63
66
  - Update for 1.6.6
64
67
 
data/lib/facter.rb CHANGED
@@ -25,7 +25,7 @@ module Facter
25
25
  include Comparable
26
26
  include Enumerable
27
27
 
28
- FACTERVERSION = '1.6.8'
28
+ FACTERVERSION = '1.6.9'
29
29
  # = Facter
30
30
  # Functions as a hash of 'facts' you might care about about your
31
31
  # system, such as mac address, IP address, Video card, etc.
@@ -0,0 +1,18 @@
1
+ # Fact: lsbdistcodename
2
+ #
3
+ # Purpose: Return Linux Standard Base information for the host.
4
+ #
5
+ # Resolution:
6
+ # Uses the lsb_release system command
7
+ #
8
+ # Caveats:
9
+ # Only works on Linux (and the kfreebsd derivative) systems.
10
+ # Requires the lsb_release program, which may not be installed by default.
11
+ # Also is as only as accurate as that program outputs.
12
+
13
+ Facter.add(:lsbdistcodename) do
14
+ confine :kernel => [ :linux, :"gnu/kfreebsd" ]
15
+ setcode do
16
+ Facter::Util::Resolution.exec('lsb_release -c -s')
17
+ end
18
+ end
@@ -0,0 +1,21 @@
1
+ # Fact: lsbdistdescription
2
+ #
3
+ # Purpose: Return Linux Standard Base information for the host.
4
+ #
5
+ # Resolution:
6
+ # Uses the lsb_release system command
7
+ #
8
+ # Caveats:
9
+ # Only works on Linux (and the kfreebsd derivative) systems.
10
+ # Requires the lsb_release program, which may not be installed by default.
11
+ # Also is as only as accurate as that program outputs.
12
+
13
+ Facter.add(:lsbdistdescription) do
14
+ confine :kernel => [ :linux, :"gnu/kfreebsd" ]
15
+ setcode do
16
+ if output = Facter::Util::Resolution.exec('lsb_release -d -s')
17
+ # the output may be quoted (at least it is on gentoo)
18
+ output.sub(/^"(.*)"$/,'\1')
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,18 @@
1
+ # Fact: lsbdistid
2
+ #
3
+ # Purpose: Return Linux Standard Base information for the host.
4
+ #
5
+ # Resolution:
6
+ # Uses the lsb_release system command
7
+ #
8
+ # Caveats:
9
+ # Only works on Linux (and the kfreebsd derivative) systems.
10
+ # Requires the lsb_release program, which may not be installed by default.
11
+ # Also is as only as accurate as that program outputs.
12
+
13
+ Facter.add(:lsbdistid) do
14
+ confine :kernel => [ :linux, :"gnu/kfreebsd" ]
15
+ setcode do
16
+ Facter::Util::Resolution.exec('lsb_release -i -s')
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # Fact: lsbdistrelease
2
+ #
3
+ # Purpose: Return Linux Standard Base information for the host.
4
+ #
5
+ # Resolution:
6
+ # Uses the lsb_release system command
7
+ #
8
+ # Caveats:
9
+ # Only works on Linux (and the kfreebsd derivative) systems.
10
+ # Requires the lsb_release program, which may not be installed by default.
11
+ # Also is as only as accurate as that program outputs.
12
+
13
+ Facter.add(:lsbdistrelease) do
14
+ confine :kernel => [ :linux, :"gnu/kfreebsd" ]
15
+ setcode do
16
+ Facter::Util::Resolution.exec('lsb_release -r -s')
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # Fact: lsbrelease
2
+ #
3
+ # Purpose: Return Linux Standard Base information for the host.
4
+ #
5
+ # Resolution:
6
+ # Uses the lsb_release system command
7
+ #
8
+ # Caveats:
9
+ # Only works on Linux (and the kfreebsd derivative) systems.
10
+ # Requires the lsb_release program, which may not be installed by default.
11
+ # Also is as only as accurate as that program outputs.
12
+
13
+ Facter.add(:lsbrelease) do
14
+ confine :kernel => [ :linux, :"gnu/kfreebsd" ]
15
+ setcode do
16
+ Facter::Util::Resolution.exec('lsb_release -v -s')
17
+ end
18
+ end
@@ -10,7 +10,6 @@
10
10
  #
11
11
  # Caveats:
12
12
  #
13
- require 'facter/lsb'
14
13
 
15
14
  Facter.add(:operatingsystem) do
16
15
  confine :kernel => :sunos
@@ -13,7 +13,7 @@ module Facter::Manufacturer
13
13
  return nil unless FileTest.exists?("/usr/local/sbin/dmidecode")
14
14
 
15
15
  output=%x{/usr/local/sbin/dmidecode 2>/dev/null}
16
- when 'NetBSD'
16
+ when 'NetBSD', 'DragonFly'
17
17
  return nil unless FileTest.exists?("/usr/pkg/sbin/dmidecode")
18
18
 
19
19
  output=%x{/usr/pkg/sbin/dmidecode 2>/dev/null}
@@ -38,7 +38,7 @@ module Facter::Manufacturer
38
38
  if line =~ /#{key}/ and line =~ /\n\s+#{value} (.+)\n/
39
39
  result = $1.strip
40
40
  Facter.add(facterkey) do
41
- confine :kernel => [ :linux, :freebsd, :netbsd, :sunos, :"gnu/kfreebsd" ]
41
+ confine :kernel => [ :linux, :freebsd, :netbsd, :sunos, :"gnu/kfreebsd", :dragonfly ]
42
42
  setcode do
43
43
  result
44
44
  end
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env rspec
2
+
3
+ require 'spec_helper'
4
+
5
+ describe "lsbdistcodename fact" do
6
+
7
+ [ "Linux", "GNU/kFreeBSD"].each do |kernel|
8
+ describe "on #{kernel}" do
9
+ before :each do
10
+ Facter.fact(:kernel).stubs(:value).returns kernel
11
+ end
12
+
13
+ it "should return the codename through lsb_release -c -s" do
14
+ Facter::Util::Resolution.stubs(:exec).with('lsb_release -c -s').returns 'n/a'
15
+ Facter.fact(:lsbdistcodename).value.should == 'n/a'
16
+ end
17
+
18
+ it "should return nil if lsb_release is not installed" do
19
+ Facter::Util::Resolution.stubs(:exec).with('lsb_release -c -s').returns nil
20
+ Facter.fact(:lsbdistcodename).value.should be_nil
21
+ end
22
+ end
23
+ end
24
+
25
+ end
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env rspec
2
+
3
+ require 'spec_helper'
4
+
5
+ describe "lsbdistdescription fact" do
6
+
7
+ [ "Linux", "GNU/kFreeBSD"].each do |kernel|
8
+ describe "on #{kernel}" do
9
+ before :each do
10
+ Facter.fact(:kernel).stubs(:value).returns kernel
11
+ end
12
+
13
+ it "should return the description through lsb_release -d -s" do
14
+ Facter::Util::Resolution.stubs(:exec).with('lsb_release -d -s').returns '"Gentoo Base System release 2.1"'
15
+ Facter.fact(:lsbdistdescription).value.should == 'Gentoo Base System release 2.1'
16
+ end
17
+
18
+ it "should return nil if lsb_release is not installed" do
19
+ Facter::Util::Resolution.stubs(:exec).with('lsb_release -d -s').returns nil
20
+ Facter.fact(:lsbdistdescription).value.should be_nil
21
+ end
22
+ end
23
+ end
24
+
25
+ end
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env rspec
2
+
3
+ require 'spec_helper'
4
+
5
+ describe "lsbdistid fact" do
6
+
7
+ [ "Linux", "GNU/kFreeBSD"].each do |kernel|
8
+ describe "on #{kernel}" do
9
+ before :each do
10
+ Facter.fact(:kernel).stubs(:value).returns kernel
11
+ end
12
+
13
+ it "should return the id through lsb_release -i -s" do
14
+ Facter::Util::Resolution.stubs(:exec).with('lsb_release -i -s').returns 'Gentoo'
15
+ Facter.fact(:lsbdistid).value.should == 'Gentoo'
16
+ end
17
+
18
+ it "should return nil if lsb_release is not installed" do
19
+ Facter::Util::Resolution.stubs(:exec).with('lsb_release -i -s').returns nil
20
+ Facter.fact(:lsbdistid).value.should be_nil
21
+ end
22
+ end
23
+ end
24
+
25
+ end
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env rspec
2
+
3
+ require 'spec_helper'
4
+
5
+ describe "lsbdistrelease fact" do
6
+
7
+ [ "Linux", "GNU/kFreeBSD"].each do |kernel|
8
+ describe "on #{kernel}" do
9
+ before :each do
10
+ Facter.fact(:kernel).stubs(:value).returns kernel
11
+ end
12
+
13
+ it "should return the release through lsb_release -r -s" do
14
+ Facter::Util::Resolution.stubs(:exec).with('lsb_release -r -s').returns '2.1'
15
+ Facter.fact(:lsbdistrelease).value.should == '2.1'
16
+ end
17
+
18
+ it "should return nil if lsb_release is not installed" do
19
+ Facter::Util::Resolution.stubs(:exec).with('lsb_release -r -s').returns nil
20
+ Facter.fact(:lsbdistrelease).value.should be_nil
21
+ end
22
+ end
23
+ end
24
+
25
+ end
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env rspec
2
+
3
+ require 'spec_helper'
4
+
5
+ describe "lsbrelease fact" do
6
+
7
+ [ "Linux", "GNU/kFreeBSD"].each do |kernel|
8
+ describe "on #{kernel}" do
9
+ before :each do
10
+ Facter.fact(:kernel).stubs(:value).returns kernel
11
+ end
12
+
13
+ it "should return the release through lsb_release -v -s" do
14
+ Facter::Util::Resolution.stubs(:exec).with('lsb_release -v -s').returns 'n/a'
15
+ Facter.fact(:lsbrelease).value.should == 'n/a'
16
+ end
17
+
18
+ it "should return nil if lsb_release is not installed" do
19
+ Facter::Util::Resolution.stubs(:exec).with('lsb_release -v -s').returns nil
20
+ Facter.fact(:lsbrelease).value.should be_nil
21
+ end
22
+ end
23
+ end
24
+
25
+ end
@@ -37,6 +37,9 @@ describe "Operating System fact" do
37
37
  describe "on Linux" do
38
38
  before :each do
39
39
  Facter.fact(:kernel).stubs(:value).returns("Linux")
40
+
41
+ # Always stub lsbdistid by default, so tests work on Ubuntu
42
+ Facter.stubs(:value).with(:lsbdistid).returns(nil)
40
43
  end
41
44
 
42
45
  {
@@ -69,7 +72,7 @@ describe "Operating System fact" do
69
72
  it "on Ubuntu should use the lsbdistid fact" do
70
73
  FileUtils.stubs(:exists?).with("/etc/debian_version").returns true
71
74
 
72
- Facter.fact(:lsbdistid).expects(:value).returns("Ubuntu")
75
+ Facter.stubs(:value).with(:lsbdistid).returns("Ubuntu")
73
76
  Facter.fact(:operatingsystem).value.should == "Ubuntu"
74
77
  end
75
78
 
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: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 6
9
- - 8
10
- version: 1.6.8
9
+ - 9
10
+ version: 1.6.9
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: 2012-04-23 00:00:00 Z
18
+ date: 2012-05-17 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: You can prove anything with facts!
@@ -56,8 +56,12 @@ files:
56
56
  - lib/facter/kernelmajversion.rb
57
57
  - lib/facter/kernelrelease.rb
58
58
  - lib/facter/kernelversion.rb
59
- - lib/facter/lsb.rb
59
+ - lib/facter/lsbdistcodename.rb
60
+ - lib/facter/lsbdistdescription.rb
61
+ - lib/facter/lsbdistid.rb
62
+ - lib/facter/lsbdistrelease.rb
60
63
  - lib/facter/lsbmajdistrelease.rb
64
+ - lib/facter/lsbrelease.rb
61
65
  - lib/facter/macaddress.rb
62
66
  - lib/facter/macosx.rb
63
67
  - lib/facter/manufacturer.rb
@@ -217,7 +221,12 @@ files:
217
221
  - spec/unit/id_spec.rb
218
222
  - spec/unit/interfaces_spec.rb
219
223
  - spec/unit/ipaddress6_spec.rb
224
+ - spec/unit/lsbdistcodename_spec.rb
225
+ - spec/unit/lsbdistdescription_spec.rb
226
+ - spec/unit/lsbdistid_spec.rb
227
+ - spec/unit/lsbdistrelease_spec.rb
220
228
  - spec/unit/lsbmajdistrelease_spec.rb
229
+ - spec/unit/lsbrelease_spec.rb
221
230
  - spec/unit/macaddress_spec.rb
222
231
  - spec/unit/memory_spec.rb
223
232
  - spec/unit/operatingsystem_spec.rb
@@ -279,7 +288,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
279
288
  requirements: []
280
289
 
281
290
  rubyforge_project: facter
282
- rubygems_version: 1.8.10
291
+ rubygems_version: 1.8.15
283
292
  signing_key:
284
293
  specification_version: 3
285
294
  summary: Facter, a system inventory tool
data/lib/facter/lsb.rb DELETED
@@ -1,39 +0,0 @@
1
- # Fact: lsb
2
- #
3
- # Purpose: Return Linux Standard Base information for the host.
4
- #
5
- # Resolution:
6
- # Uses the lsb_release system command and parses the output with a series of
7
- # regular expressions.
8
- #
9
- # Caveats:
10
- # Only works on Linux (and the kfreebsd derivative) systems.
11
- # Requires the lsb_release program, which may not be installed by default.
12
- # Also is as only as accurate as that program outputs.
13
-
14
- ## lsb.rb
15
- ## Facts related to Linux Standard Base (LSB)
16
-
17
- { "LSBRelease" => %r{^LSB Version:\t(.*)$},
18
- "LSBDistId" => %r{^Distributor ID:\t(.*)$},
19
- "LSBDistRelease" => %r{^Release:\t(.*)$},
20
- "LSBDistDescription" => %r{^Description:\t(.*)$},
21
- "LSBDistCodeName" => %r{^Codename:\t(.*)$}
22
- }.each do |fact, pattern|
23
- Facter.add(fact) do
24
- confine :kernel => [ :linux, :"gnu/kfreebsd" ]
25
- setcode do
26
- unless defined?(lsbdata) and defined?(lsbtime) and (Time.now.to_i - lsbtime.to_i < 5)
27
- type = nil
28
- lsbtime = Time.now
29
- lsbdata = Facter::Util::Resolution.exec('lsb_release -a 2>/dev/null')
30
- end
31
-
32
- if pattern.match(lsbdata)
33
- $1
34
- else
35
- nil
36
- end
37
- end
38
- end
39
- end