facter 2.1.0-universal-darwin → 2.2.0-universal-darwin

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.

Files changed (139) hide show
  1. data/COMMITTERS.md +25 -34
  2. data/CONTRIBUTING.md +27 -5
  3. data/README.md +32 -0
  4. data/ext/build_defaults.yaml +1 -1
  5. data/ext/debian/control +3 -2
  6. data/ext/osx/file_mapping.yaml +5 -0
  7. data/ext/redhat/facter.spec.erb +4 -1
  8. data/lib/facter/Cfkey.rb +2 -2
  9. data/lib/facter/architecture.rb +2 -2
  10. data/lib/facter/augeasversion.rb +2 -2
  11. data/lib/facter/blockdevices.rb +12 -12
  12. data/lib/facter/dhcp_servers.rb +4 -4
  13. data/lib/facter/domain.rb +4 -4
  14. data/lib/facter/ec2.rb +17 -0
  15. data/lib/facter/ec2/rest.rb +2 -2
  16. data/lib/facter/facterversion.rb +2 -2
  17. data/lib/facter/filesystems.rb +10 -3
  18. data/lib/facter/fqdn.rb +1 -1
  19. data/lib/facter/gid.rb +16 -0
  20. data/lib/facter/hardwareisa.rb +3 -3
  21. data/lib/facter/hardwaremodel.rb +3 -3
  22. data/lib/facter/hostname.rb +1 -1
  23. data/lib/facter/id.rb +4 -4
  24. data/lib/facter/interfaces.rb +3 -0
  25. data/lib/facter/ipaddress6.rb +9 -9
  26. data/lib/facter/kernel.rb +2 -2
  27. data/lib/facter/kernelmajversion.rb +2 -2
  28. data/lib/facter/kernelrelease.rb +4 -4
  29. data/lib/facter/kernelversion.rb +3 -3
  30. data/lib/facter/ldom.rb +11 -0
  31. data/lib/facter/lsbdistcodename.rb +8 -4
  32. data/lib/facter/lsbdistdescription.rb +6 -10
  33. data/lib/facter/lsbdistid.rb +8 -4
  34. data/lib/facter/lsbdistrelease.rb +8 -4
  35. data/lib/facter/lsbmajdistrelease.rb +7 -12
  36. data/lib/facter/lsbminordistrelease.rb +22 -0
  37. data/lib/facter/lsbrelease.rb +8 -4
  38. data/lib/facter/macaddress.rb +1 -0
  39. data/lib/facter/macosx.rb +1 -1
  40. data/lib/facter/manufacturer.rb +3 -3
  41. data/lib/facter/memory.rb +8 -8
  42. data/lib/facter/netmask.rb +2 -1
  43. data/lib/facter/network.rb +3 -3
  44. data/lib/facter/operatingsystem.rb +9 -126
  45. data/lib/facter/operatingsystem/base.rb +61 -0
  46. data/lib/facter/operatingsystem/cumuluslinux.rb +27 -0
  47. data/lib/facter/operatingsystem/implementation.rb +30 -0
  48. data/lib/facter/operatingsystem/linux.rb +467 -0
  49. data/lib/facter/operatingsystem/sunos.rb +54 -0
  50. data/lib/facter/operatingsystem/vmkernel.rb +11 -0
  51. data/lib/facter/operatingsystem/windows.rb +37 -0
  52. data/lib/facter/operatingsystemmajrelease.rb +14 -33
  53. data/lib/facter/operatingsystemrelease.rb +14 -235
  54. data/lib/facter/os.rb +69 -0
  55. data/lib/facter/osfamily.rb +4 -23
  56. data/lib/facter/partitions.rb +4 -3
  57. data/lib/facter/path.rb +2 -2
  58. data/lib/facter/physicalprocessorcount.rb +10 -74
  59. data/lib/facter/processor.rb +13 -129
  60. data/lib/facter/processors.rb +60 -0
  61. data/lib/facter/processors/os.rb +234 -0
  62. data/lib/facter/ps.rb +5 -4
  63. data/lib/facter/puppetversion.rb +1 -1
  64. data/lib/facter/rackspace.rb +34 -0
  65. data/lib/facter/rubysitedir.rb +3 -0
  66. data/lib/facter/rubyversion.rb +2 -2
  67. data/lib/facter/selinux.rb +57 -2
  68. data/lib/facter/ssh.rb +1 -0
  69. data/lib/facter/system_uptime.rb +42 -0
  70. data/lib/facter/timezone.rb +1 -1
  71. data/lib/facter/uptime.rb +5 -23
  72. data/lib/facter/uptime_days.rb +4 -6
  73. data/lib/facter/uptime_hours.rb +4 -6
  74. data/lib/facter/uptime_seconds.rb +5 -9
  75. data/lib/facter/util/formatter.rb +1 -1
  76. data/lib/facter/util/manufacturer.rb +1 -1
  77. data/lib/facter/util/partitions.rb +3 -1
  78. data/lib/facter/util/partitions/linux.rb +1 -1
  79. data/lib/facter/util/partitions/openbsd.rb +35 -0
  80. data/lib/facter/util/uptime.rb +4 -3
  81. data/lib/facter/util/virtual.rb +3 -1
  82. data/lib/facter/util/xendomains.rb +12 -3
  83. data/lib/facter/version.rb +1 -1
  84. data/lib/facter/virtual.rb +24 -23
  85. data/lib/facter/vlans.rb +1 -1
  86. data/lib/facter/xendomains.rb +1 -1
  87. data/lib/facter/zfs_version.rb +6 -2
  88. data/lib/facter/zones.rb +6 -5
  89. data/lib/facter/zpool_version.rb +1 -1
  90. data/spec/fixtures/cpuinfo/amd64dual-grep +2 -0
  91. data/spec/fixtures/cpuinfo/amd64twentyfour-grep +24 -0
  92. data/spec/fixtures/cpuinfo/two_multicore-grep +4 -0
  93. data/spec/fixtures/cpuinfo/two_singlecore-grep +2 -0
  94. data/spec/fixtures/unit/processors/os/darwin-system-profiler +287 -0
  95. data/spec/fixtures/unit/zfs_version/zfs_new +61 -0
  96. data/spec/fixtures/unit/zfs_version/zfs_old +43 -0
  97. data/spec/fixtures/unit/zfs_version/zfsonlinux_0.6.1 +13 -0
  98. data/spec/fixtures/unit/zpool_version/zfsonlinux_0.6.1 +48 -0
  99. data/spec/unit/ec2/rest_spec.rb +6 -6
  100. data/spec/unit/gid_spec.rb +22 -0
  101. data/spec/unit/hardwaremodel_spec.rb +2 -0
  102. data/spec/unit/lsbdistcodename_spec.rb +22 -17
  103. data/spec/unit/lsbdistdescription_spec.rb +22 -17
  104. data/spec/unit/lsbdistid_spec.rb +23 -18
  105. data/spec/unit/lsbdistrelease_spec.rb +22 -17
  106. data/spec/unit/lsbmajdistrelease_spec.rb +23 -6
  107. data/spec/unit/lsbminordistrelease_spec.rb +31 -0
  108. data/spec/unit/lsbrelease_spec.rb +22 -17
  109. data/spec/unit/macaddress_spec.rb +3 -0
  110. data/spec/unit/operatingsystem/base_spec.rb +76 -0
  111. data/spec/unit/operatingsystem/cumuluslinux_spec.rb +40 -0
  112. data/spec/unit/operatingsystem/implementation_spec.rb +49 -0
  113. data/spec/unit/operatingsystem/linux_spec.rb +538 -0
  114. data/spec/unit/operatingsystem/sunos_spec.rb +144 -0
  115. data/spec/unit/operatingsystem/vmkernel_spec.rb +13 -0
  116. data/spec/unit/operatingsystem/windows_spec.rb +68 -0
  117. data/spec/unit/operatingsystem_spec.rb +10 -153
  118. data/spec/unit/operatingsystemmajrelease_spec.rb +14 -31
  119. data/spec/unit/operatingsystemrelease_spec.rb +13 -229
  120. data/spec/unit/os_spec.rb +131 -0
  121. data/spec/unit/osfamily_spec.rb +9 -54
  122. data/spec/unit/partitions_spec.rb +41 -3
  123. data/spec/unit/physicalprocessorcount_spec.rb +6 -78
  124. data/spec/unit/processor_spec.rb +18 -381
  125. data/spec/unit/processors/os_spec.rb +446 -0
  126. data/spec/unit/processors_spec.rb +203 -0
  127. data/spec/unit/rackspace_spec.rb +40 -0
  128. data/spec/unit/system_uptime_spec.rb +80 -0
  129. data/spec/unit/util/formatter_spec.rb +5 -0
  130. data/spec/unit/util/macaddress_spec.rb +2 -0
  131. data/spec/unit/util/processor_spec.rb +120 -0
  132. data/spec/unit/util/uptime_spec.rb +3 -4
  133. data/spec/unit/util/virtual_spec.rb +8 -0
  134. data/spec/unit/util/xendomains_spec.rb +54 -9
  135. data/spec/unit/virtual_spec.rb +8 -1
  136. data/spec/unit/zfs_version_spec.rb +20 -8
  137. data/spec/unit/zpool_version_spec.rb +5 -0
  138. metadata +654 -589
  139. checksums.yaml +0 -7
@@ -0,0 +1,61 @@
1
+ usage: zfs command args ...
2
+ where 'command' is one of the following:
3
+
4
+ create [-p] [-o property=value] ... <filesystem>
5
+ create [-ps] [-b blocksize] [-o property=value] ... -V <size> <volume>
6
+ destroy [-rRf] <filesystem|volume>
7
+ destroy [-rRd] <snapshot>
8
+
9
+ snapshot [-r] [-o property=value] ... <filesystem@snapname|volume@snapname>
10
+ rollback [-rRf] <snapshot>
11
+ clone [-p] [-o property=value] ... <snapshot> <filesystem|volume>
12
+ promote <clone-filesystem>
13
+ rename <filesystem|volume|snapshot> <filesystem|volume|snapshot>
14
+ rename -p <filesystem|volume> <filesystem|volume>
15
+ rename -r <snapshot> <snapshot>
16
+ list [-rH][-d max] [-o property[,...]] [-t type[,...]] [-s property] ...
17
+ [-S property] ... [filesystem|volume|snapshot] ...
18
+
19
+ set <property=value> <filesystem|volume|snapshot> ...
20
+ get [-rHp] [-d max] [-o "all" | field[,...]] [-s source[,...]]
21
+ <"all" | property[,...]> [filesystem|volume|snapshot] ...
22
+ inherit [-rS] <property> <filesystem|volume|snapshot> ...
23
+ upgrade [-v]
24
+ upgrade [-r] [-V version] <-a | filesystem ...>
25
+ userspace [-hniHp] [-o field[,...]] [-sS field] ... [-t type[,...]]
26
+ <filesystem|snapshot>
27
+ groupspace [-hniHpU] [-o field[,...]] [-sS field] ... [-t type[,...]]
28
+ <filesystem|snapshot>
29
+
30
+ mount
31
+ mount [-vO] [-o opts] <-a | filesystem>
32
+ unmount [-f] <-a | filesystem|mountpoint>
33
+ share <-a | filesystem>
34
+ unshare <-a | filesystem|mountpoint>
35
+
36
+ send [-RDp] [-[iI] snapshot] <snapshot>
37
+ receive [-vnFu] <filesystem|volume|snapshot>
38
+ receive [-vnFu] [-d | -e] <filesystem>
39
+
40
+ allow <filesystem|volume>
41
+ allow [-ldug] <"everyone"|user|group>[,...] <perm|@setname>[,...]
42
+ <filesystem|volume>
43
+ allow [-ld] -e <perm|@setname>[,...] <filesystem|volume>
44
+ allow -c <perm|@setname>[,...] <filesystem|volume>
45
+ allow -s @setname <perm|@setname>[,...] <filesystem|volume>
46
+
47
+ unallow [-rldug] <"everyone"|user|group>[,...]
48
+ [<perm|@setname>[,...]] <filesystem|volume>
49
+ unallow [-rld] -e [<perm|@setname>[,...]] <filesystem|volume>
50
+ unallow [-r] -c [<perm|@setname>[,...]] <filesystem|volume>
51
+ unallow [-r] -s @setname [<perm|@setname>[,...]] <filesystem|volume>
52
+
53
+ hold [-r] <tag> <snapshot> ...
54
+ holds [-r] <snapshot> ...
55
+ release [-r] <tag> <snapshot> ...
56
+
57
+ Each dataset is of the form: pool/[dataset/]*dataset[@name]
58
+
59
+ For the property list, run: zfs set|get
60
+
61
+ For the delegated permission list, run: zfs allow|unallow
@@ -0,0 +1,43 @@
1
+ usage: zfs command args ...
2
+ where 'command' is one of the following:
3
+
4
+ create [[-o property=value] ... ] <filesystem>
5
+ create [-s] [-b blocksize] [[-o property=value] ...]
6
+ -V <size> <volume>
7
+ destroy [-rRf] <filesystem|volume|snapshot>
8
+
9
+ snapshot [-r] <filesystem@name|volume@name>
10
+ rollback [-rRf] <snapshot>
11
+ clone <snapshot> <filesystem|volume>
12
+ promote <clone filesystem>
13
+ rename <filesystem|volume|snapshot> <filesystem|volume|snapshot>
14
+
15
+ list [-rH] [-o property[,property]...] [-t type[,type]...]
16
+ [-s property [-s property]...] [-S property [-S property]...]
17
+ [filesystem|volume|snapshot] ...
18
+
19
+ set <property=value> <filesystem|volume> ...
20
+ get [-rHp] [-o field[,field]...] [-s source[,source]...]
21
+ <all | property[,property]...> [filesystem|volume|snapshot] ...
22
+ inherit [-r] <property> <filesystem|volume> ...
23
+
24
+ mount
25
+ mount [-o opts] [-O] -a
26
+ mount [-o opts] [-O] <filesystem>
27
+
28
+ unmount [-f] -a
29
+ unmount [-f] <filesystem|mountpoint>
30
+
31
+ share -a
32
+ share <filesystem>
33
+
34
+ unshare [-f] -a
35
+ unshare [-f] <filesystem|mountpoint>
36
+
37
+ send [-i <snapshot>] <snapshot>
38
+ receive [-vnF] <filesystem|volume|snapshot>
39
+ receive [-vnF] -d <filesystem>
40
+
41
+ Each dataset is of the form: pool/[dataset/]*dataset[@name]
42
+
43
+ For the property list, run: zfs set|get
@@ -0,0 +1,13 @@
1
+ The following filesystem versions are supported:
2
+
3
+ VER DESCRIPTION
4
+ --- --------------------------------------------------------
5
+ 1 Initial ZFS filesystem version
6
+ 2 Enhanced directory entries
7
+ 3 Case insensitive and filesystem user identifier (FUID)
8
+ 4 userquota, groupquota properties
9
+ 5 System attributes
10
+
11
+ For more information on a particular version, including supported releases,
12
+ see the ZFS Administration Guide.
13
+
@@ -0,0 +1,48 @@
1
+ This system supports ZFS pool feature flags.
2
+
3
+ The following features are supported:
4
+
5
+ FEAT DESCRIPTION
6
+ -------------------------------------------------------------
7
+ async_destroy (read-only compatible)
8
+ Destroy filesystems asynchronously.
9
+ empty_bpobj (read-only compatible)
10
+ Snapshots use less space.
11
+ lz4_compress
12
+ LZ4 compression algorithm support.
13
+
14
+ The following legacy versions are also supported:
15
+
16
+ VER DESCRIPTION
17
+ --- --------------------------------------------------------
18
+ 1 Initial ZFS version
19
+ 2 Ditto blocks (replicated metadata)
20
+ 3 Hot spares and double parity RAID-Z
21
+ 4 zpool history
22
+ 5 Compression using the gzip algorithm
23
+ 6 bootfs pool property
24
+ 7 Separate intent log devices
25
+ 8 Delegated administration
26
+ 9 refquota and refreservation properties
27
+ 10 Cache devices
28
+ 11 Improved scrub performance
29
+ 12 Snapshot properties
30
+ 13 snapused property
31
+ 14 passthrough-x aclinherit
32
+ 15 user/group space accounting
33
+ 16 stmf property support
34
+ 17 Triple-parity RAID-Z
35
+ 18 Snapshot user holds
36
+ 19 Log device removal
37
+ 20 Compression using zle (zero-length encoding)
38
+ 21 Deduplication
39
+ 22 Received properties
40
+ 23 Slim ZIL
41
+ 24 System attributes
42
+ 25 Improved scrub stats
43
+ 26 Improved snapshot deletion performance
44
+ 27 Improved snapshot creation performance
45
+ 28 Multiple vdev replacements
46
+
47
+ For more information on a particular version, including supported releases,
48
+ see the ZFS Administration Guide.
@@ -15,7 +15,7 @@ shared_examples_for "an ec2 rest querier" do
15
15
  end
16
16
 
17
17
  it "is false if the given uri returns a 404" do
18
- subject.expects(:open).with(anything).once.raises(OpenURI::HTTPError.new("404 Not Found", StringIO.new("woo")))
18
+ subject.expects(:open).with(anything, :proxy => nil).once.raises(OpenURI::HTTPError.new("404 Not Found", StringIO.new("woo")))
19
19
  expect(subject).to_not be_reachable
20
20
  end
21
21
 
@@ -36,7 +36,7 @@ describe Facter::EC2::Metadata do
36
36
  describe "fetching a metadata endpoint" do
37
37
  it "splits the body into an array" do
38
38
  response.string = my_fixture_read("meta-data/root")
39
- subject.stubs(:open).with("http://0.0.0.0/latest/meta-data/").returns response
39
+ subject.stubs(:open).with("http://0.0.0.0/latest/meta-data/", {:proxy => nil}).returns response
40
40
  output = subject.fetch_endpoint('')
41
41
 
42
42
  expect(output).to eq %w[
@@ -49,7 +49,7 @@ describe Facter::EC2::Metadata do
49
49
 
50
50
  it "reformats keys that are array indices" do
51
51
  response.string = "0=adrien@grey/"
52
- subject.stubs(:open).with("http://0.0.0.0/latest/meta-data/public-keys/").returns response
52
+ subject.stubs(:open).with("http://0.0.0.0/latest/meta-data/public-keys/", {:proxy => nil}).returns response
53
53
  output = subject.fetch_endpoint("public-keys/")
54
54
 
55
55
  expect(output).to eq %w[0/]
@@ -57,7 +57,7 @@ describe Facter::EC2::Metadata do
57
57
 
58
58
  it "returns nil if the endpoint returns a 404" do
59
59
  Facter.expects(:log_exception).never
60
- subject.stubs(:open).with("http://0.0.0.0/latest/meta-data/public-keys/1/").raises OpenURI::HTTPError.new("404 Not Found", response)
60
+ subject.stubs(:open).with("http://0.0.0.0/latest/meta-data/public-keys/1/", {:proxy => nil}).raises OpenURI::HTTPError.new("404 Not Found", response)
61
61
  output = subject.fetch_endpoint('public-keys/1/')
62
62
 
63
63
  expect(output).to be_nil
@@ -66,7 +66,7 @@ describe Facter::EC2::Metadata do
66
66
  it "logs an error if the endpoint raises a non-404 HTTPError" do
67
67
  Facter.expects(:log_exception).with(instance_of(OpenURI::HTTPError), anything)
68
68
 
69
- subject.stubs(:open).with("http://0.0.0.0/latest/meta-data/").raises OpenURI::HTTPError.new("418 I'm a Teapot", response)
69
+ subject.stubs(:open).with("http://0.0.0.0/latest/meta-data/", {:proxy => nil}).raises OpenURI::HTTPError.new("418 I'm a Teapot", response)
70
70
  output = subject.fetch_endpoint("")
71
71
 
72
72
  expect(output).to be_nil
@@ -75,7 +75,7 @@ describe Facter::EC2::Metadata do
75
75
  it "logs an error if the endpoint raises a connection error" do
76
76
  Facter.expects(:log_exception).with(instance_of(Errno::ECONNREFUSED), anything)
77
77
 
78
- subject.stubs(:open).with("http://0.0.0.0/latest/meta-data/").raises Errno::ECONNREFUSED
78
+ subject.stubs(:open).with("http://0.0.0.0/latest/meta-data/", {:proxy => nil}).raises Errno::ECONNREFUSED
79
79
  output = subject.fetch_endpoint('')
80
80
 
81
81
  expect(output).to be_nil
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe "gid fact" do
4
+
5
+ describe "on systems with id" do
6
+ it "should return the current group" do
7
+ Facter::Core::Execution.expects(:which).with('id').returns(true)
8
+ Facter::Core::Execution.expects(:exec).once.with('id -ng').returns 'bar'
9
+
10
+ Facter.fact(:gid).value.should == 'bar'
11
+ end
12
+ end
13
+
14
+ describe "on systems without id" do
15
+ it "is not supported" do
16
+ Facter::Core::Execution.expects(:which).with('id').returns(false)
17
+
18
+ Facter.fact(:gid).value.should == nil
19
+ end
20
+ end
21
+
22
+ end
@@ -6,6 +6,7 @@ require 'facter'
6
6
  describe "Hardwaremodel fact" do
7
7
  it "should match uname -m by default" do
8
8
  Facter.fact(:kernel).stubs(:value).returns("Darwin")
9
+ Facter.fact(:operatingsystem).stubs(:value).returns("Darwin")
9
10
  Facter::Core::Execution.stubs(:execute).with("uname -m", anything).returns("Inky")
10
11
 
11
12
  Facter.fact(:hardwaremodel).value.should == "Inky"
@@ -15,6 +16,7 @@ describe "Hardwaremodel fact" do
15
16
  require 'facter/util/wmi'
16
17
  before :each do
17
18
  Facter.fact(:kernel).stubs(:value).returns("windows")
19
+ Facter.fact(:operatingsystem).stubs(:value).returns("windows")
18
20
  end
19
21
 
20
22
  it "should detect i486" do
@@ -3,23 +3,28 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe "lsbdistcodename fact" do
6
+ let(:os_hash) { { "name" => "SomeOS",
7
+ "family" => "SomeFamily",
8
+ "release" => {
9
+ "major" => "1",
10
+ "minor" => "2",
11
+ "full" => "1.2.3"
12
+ },
13
+ "lsb" => {
14
+ "distcodename" => "SomeCodeName",
15
+ "distid" => "SomeID",
16
+ "distdescription" => "SomeDesc",
17
+ "distrelease" => "1.2.3",
18
+ "release" => "1.2.3",
19
+ "majdistrelease" => "1",
20
+ "minordistrelease" => "2"
21
+ },
22
+ }
23
+ }
6
24
 
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 "returns the codename through lsb_release -c -s 2>/dev/null" do
14
- Facter::Core::Execution.impl.stubs(:execute).with('lsb_release -c -s 2>/dev/null', anything).returns 'n/a'
15
- expect(Facter.fact(:lsbdistcodename).value).to eq 'n/a'
16
- end
17
-
18
- it "returns nil if lsb_release is not installed" do
19
- Facter::Core::Execution.impl.stubs(:expand_command).with('lsb_release -c -s 2>/dev/null').returns nil
20
- expect(Facter.fact(:lsbdistcodename).value).to be_nil
21
- end
22
- end
25
+ it "should use the 'distcodename' key of the 'os' fact" do
26
+ Facter.fact(:kernel).stubs(:value).returns("Linux")
27
+ Facter.fact("os").stubs(:value).returns(os_hash)
28
+ Facter.fact(:lsbdistcodename).value.should eq "SomeCodeName"
23
29
  end
24
-
25
30
  end
@@ -3,23 +3,28 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe "lsbdistdescription fact" do
6
+ let(:os_hash) { { "name" => "SomeOS",
7
+ "family" => "SomeFamily",
8
+ "release" => {
9
+ "major" => "1",
10
+ "minor" => "2",
11
+ "full" => "1.2.3"
12
+ },
13
+ "lsb" => {
14
+ "distcodename" => "SomeCodeName",
15
+ "distid" => "SomeID",
16
+ "distdescription" => "SomeDesc",
17
+ "distrelease" => "1.2.3",
18
+ "release" => "1.2.3",
19
+ "majdistrelease" => "1",
20
+ "minordistrelease" => "2"
21
+ },
22
+ }
23
+ }
6
24
 
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 "returns the description through lsb_release -d -s 2>/dev/null" do
14
- Facter::Core::Execution.stubs(:which).with('lsb_release').returns '/usr/bin/lsb_release'
15
- Facter::Core::Execution.stubs(:exec).with('lsb_release -d -s 2>/dev/null', anything).returns '"Gentoo Base System release 2.1"'
16
- expect(Facter.fact(:lsbdistdescription).value).to eq 'Gentoo Base System release 2.1'
17
- end
18
-
19
- it "returns nil if lsb_release is not installed" do
20
- Facter::Core::Execution.stubs(:which).with('lsb_release').returns nil
21
- expect(Facter.fact(:lsbdistdescription).value).to be_nil
22
- end
23
- end
25
+ it "should use the 'distdescription' key of the 'os' fact" do
26
+ Facter.fact(:kernel).stubs(:value).returns("Linux")
27
+ Facter.fact("os").stubs(:value).returns(os_hash)
28
+ Facter.fact(:lsbdistdescription).value.should eq "SomeDesc"
24
29
  end
25
30
  end
@@ -2,24 +2,29 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe "lsbdistid fact" do
5
+ describe "lsbdistcodename fact" do
6
+ let(:os_hash) { { "name" => "SomeOS",
7
+ "family" => "SomeFamily",
8
+ "release" => {
9
+ "major" => "1",
10
+ "minor" => "2",
11
+ "full" => "1.2.3"
12
+ },
13
+ "lsb" => {
14
+ "distcodename" => "SomeCodeName",
15
+ "distid" => "SomeID",
16
+ "distdescription" => "SomeDesc",
17
+ "distrelease" => "1.2.3",
18
+ "release" => "1.2.3",
19
+ "majdistrelease" => "1",
20
+ "minordistrelease" => "2"
21
+ },
22
+ }
23
+ }
6
24
 
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 "returns the id through lsb_release -i -s 2>/dev/null" do
14
- Facter::Core::Execution.impl.stubs(:execute).with('lsb_release -i -s 2>/dev/null', anything).returns 'Gentoo'
15
- expect(Facter.fact(:lsbdistid).value).to eq 'Gentoo'
16
- end
17
-
18
- it "returns nil if lsb_release is not installed" do
19
- Facter::Core::Execution.impl.stubs(:expand_command).with('lsb_release -i -s 2>/dev/null').returns nil
20
- expect(Facter.fact(:lsbdistid).value).to be_nil
21
- end
22
- end
25
+ it "should use the 'distcodename' key of the 'os' fact" do
26
+ Facter.fact(:kernel).stubs(:value).returns("Linux")
27
+ Facter.fact("os").stubs(:value).returns(os_hash)
28
+ Facter.fact(:lsbdistid).value.should eq "SomeID"
23
29
  end
24
-
25
30
  end
@@ -3,23 +3,28 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe "lsbdistrelease fact" do
6
+ let(:os_hash) { { "name" => "SomeOS",
7
+ "family" => "SomeFamily",
8
+ "release" => {
9
+ "major" => "1",
10
+ "minor" => "2",
11
+ "full" => "1.2.3"
12
+ },
13
+ "lsb" => {
14
+ "distcodename" => "SomeCodeName",
15
+ "distid" => "SomeID",
16
+ "distdescription" => "SomeDesc",
17
+ "distrelease" => "1.2.3",
18
+ "release" => "1.2.3",
19
+ "majdistrelease" => "1",
20
+ "minordistrelease" => "2"
21
+ },
22
+ }
23
+ }
6
24
 
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 2>/dev/null" do
14
- Facter::Core::Execution.stubs(:execute).with('lsb_release -r -s 2>/dev/null', anything).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::Core::Execution.stubs(:execute).with('lsb_release -r -s 2>/dev/null', anything).returns nil
20
- Facter.fact(:lsbdistrelease).value.should be_nil
21
- end
22
- end
25
+ it "should use the 'distrelease' key of the 'os' fact" do
26
+ Facter.fact(:kernel).stubs(:value).returns("Linux")
27
+ Facter.fact("os").stubs(:value).returns(os_hash)
28
+ Facter.fact(:lsbdistrelease).value.should eq "1.2.3"
23
29
  end
24
-
25
30
  end