facter 1.6.2 → 1.6.3

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 (57) hide show
  1. data/CHANGELOG +11 -0
  2. data/LICENSE +1 -1
  3. data/conf/osx/createpackage.sh +1 -1
  4. data/conf/redhat/facter.spec +9 -6
  5. data/conf/solaris/pkginfo +1 -1
  6. data/install.rb +1 -1
  7. data/lib/facter.rb +2 -2
  8. data/lib/facter/architecture.rb +1 -2
  9. data/lib/facter/augeasversion.rb +1 -2
  10. data/lib/facter/domain.rb +3 -3
  11. data/lib/facter/hardwareisa.rb +1 -1
  12. data/lib/facter/ipaddress.rb +2 -2
  13. data/lib/facter/lsbmajdistrelease.rb +1 -1
  14. data/lib/facter/macaddress.rb +2 -2
  15. data/lib/facter/manufacturer.rb +1 -1
  16. data/lib/facter/netmask.rb +0 -3
  17. data/lib/facter/network.rb +2 -3
  18. data/lib/facter/operatingsystem.rb +5 -2
  19. data/lib/facter/operatingsystemrelease.rb +3 -3
  20. data/lib/facter/osfamily.rb +1 -1
  21. data/lib/facter/processor.rb +2 -2
  22. data/lib/facter/selinux.rb +3 -3
  23. data/lib/facter/uniqueid.rb +1 -1
  24. data/lib/facter/uptime_days.rb +0 -1
  25. data/lib/facter/uptime_hours.rb +0 -1
  26. data/lib/facter/util/manufacturer.rb +2 -3
  27. data/lib/facter/util/processor.rb +3 -3
  28. data/lib/facter/util/resolution.rb +3 -3
  29. data/lib/facter/util/values.rb +1 -1
  30. data/lib/facter/virtual.rb +2 -2
  31. data/lib/facter/vlans.rb +1 -2
  32. data/lib/facter/xendomains.rb +0 -1
  33. data/spec/fixtures/unit/util/manufacturer/solaris_sunfire_v120_prtdiag +33 -0
  34. data/spec/fixtures/unit/util/manufacturer/solaris_t5220_prtdiag +136 -0
  35. data/spec/spec_helper.rb +5 -0
  36. data/spec/unit/architecture_spec.rb +40 -40
  37. data/spec/unit/facter_spec.rb +220 -220
  38. data/spec/unit/id_spec.rb +16 -16
  39. data/spec/unit/interfaces_spec.rb +6 -6
  40. data/spec/unit/memory_spec.rb +105 -105
  41. data/spec/unit/operatingsystem_spec.rb +72 -63
  42. data/spec/unit/operatingsystemrelease_spec.rb +44 -43
  43. data/spec/unit/processor_spec.rb +2 -2
  44. data/spec/unit/selinux_spec.rb +53 -53
  45. data/spec/unit/util/collection_spec.rb +183 -183
  46. data/spec/unit/util/confine_spec.rb +92 -92
  47. data/spec/unit/util/fact_spec.rb +96 -96
  48. data/spec/unit/util/ip_spec.rb +218 -218
  49. data/spec/unit/util/loader_spec.rb +193 -193
  50. data/spec/unit/util/macosx_spec.rb +63 -63
  51. data/spec/unit/util/manufacturer_spec.rb +124 -107
  52. data/spec/unit/util/resolution_spec.rb +235 -235
  53. data/spec/unit/util/virtual_spec.rb +167 -167
  54. data/spec/unit/util/vlans_spec.rb +6 -6
  55. data/spec/unit/virtual_spec.rb +246 -246
  56. data/spec/watchr.rb +1 -1
  57. metadata +6 -4
@@ -4,25 +4,25 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
4
4
 
5
5
  describe "id fact" do
6
6
 
7
- kernel = [ 'Linux', 'Darwin', 'windows', 'FreeBSD', 'OpenBSD', 'NetBSD', 'AIX', 'HP-UX' ]
7
+ kernel = [ 'Linux', 'Darwin', 'windows', 'FreeBSD', 'OpenBSD', 'NetBSD', 'AIX', 'HP-UX' ]
8
8
 
9
- kernel.each do |k|
10
- describe "with kernel reported as #{k}" do
11
- it "should return the current user" do
12
- Facter.fact(:kernel).stubs(:value).returns(k)
13
- Facter::Util::Config.stubs(:is_windows?).returns(k == 'windows')
14
- Facter::Util::Resolution.expects(:exec).once.with('whoami').returns 'bar'
9
+ kernel.each do |k|
10
+ describe "with kernel reported as #{k}" do
11
+ it "should return the current user" do
12
+ Facter.fact(:kernel).stubs(:value).returns(k)
13
+ Facter::Util::Config.stubs(:is_windows?).returns(k == 'windows')
14
+ Facter::Util::Resolution.expects(:exec).once.with('whoami').returns 'bar'
15
15
 
16
- Facter.fact(:id).value.should == 'bar'
17
- end
18
- end
16
+ Facter.fact(:id).value.should == 'bar'
17
+ end
19
18
  end
19
+ end
20
20
 
21
- it "should return the current user on Solaris" do
22
- Facter::Util::Config.stubs(:is_windows?).returns(false)
23
- Facter::Util::Resolution.stubs(:exec).with('uname -s').returns('SunOS')
24
- Facter::Util::Resolution.expects(:exec).once.with('/usr/xpg4/bin/id -un').returns 'bar'
21
+ it "should return the current user on Solaris" do
22
+ Facter::Util::Config.stubs(:is_windows?).returns(false)
23
+ Facter::Util::Resolution.stubs(:exec).with('uname -s').returns('SunOS')
24
+ Facter::Util::Resolution.expects(:exec).once.with('/usr/xpg4/bin/id -un').returns 'bar'
25
25
 
26
- Facter.fact(:id).value.should == 'bar'
27
- end
26
+ Facter.fact(:id).value.should == 'bar'
27
+ end
28
28
  end
@@ -6,13 +6,13 @@ require 'facter'
6
6
  require 'facter/util/ip'
7
7
 
8
8
  describe "Per Interface IP facts" do
9
- it "should replace the ':' in an interface list with '_'" do
10
- # So we look supported
11
- Facter.fact(:kernel).stubs(:value).returns("SunOS")
9
+ it "should replace the ':' in an interface list with '_'" do
10
+ # So we look supported
11
+ Facter.fact(:kernel).stubs(:value).returns("SunOS")
12
12
 
13
- Facter::Util::IP.stubs(:get_interfaces).returns %w{eth0:1 eth1:2}
14
- Facter.fact(:interfaces).value.should == %{eth0_1,eth1_2}
15
- end
13
+ Facter::Util::IP.stubs(:get_interfaces).returns %w{eth0:1 eth1:2}
14
+ Facter.fact(:interfaces).value.should == %{eth0_1,eth1_2}
15
+ end
16
16
 
17
17
  it "should replace non-alphanumerics in an interface list with '_'" do
18
18
  Facter.fact(:kernel).stubs(:value).returns("windows")
@@ -5,146 +5,146 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
5
5
  require 'facter'
6
6
 
7
7
  describe "Memory facts" do
8
- before do
9
- # We need these facts loaded, but they belong to a file with a
10
- # different name, so load the file explicitly.
11
- Facter.collection.loader.load(:memory)
12
- end
8
+ before do
9
+ # We need these facts loaded, but they belong to a file with a
10
+ # different name, so load the file explicitly.
11
+ Facter.collection.loader.load(:memory)
12
+ end
13
13
 
14
- after do
15
- Facter.clear
16
- end
14
+ after do
15
+ Facter.clear
16
+ end
17
17
 
18
- it "should return the current swap size" do
18
+ it "should return the current swap size" do
19
19
 
20
- Facter.fact(:kernel).stubs(:value).returns("Darwin")
21
- Facter::Util::Resolution.stubs(:exec).with('sysctl vm.swapusage').returns("vm.swapusage: total = 64.00M used = 0.00M free = 64.00M (encrypted)")
22
- swapusage = "vm.swapusage: total = 64.00M used = 0.00M free = 64.00M (encrypted)"
20
+ Facter.fact(:kernel).stubs(:value).returns("Darwin")
21
+ Facter::Util::Resolution.stubs(:exec).with('sysctl vm.swapusage').returns("vm.swapusage: total = 64.00M used = 0.00M free = 64.00M (encrypted)")
22
+ swapusage = "vm.swapusage: total = 64.00M used = 0.00M free = 64.00M (encrypted)"
23
23
 
24
- if swapusage =~ /total = (\S+).*/
25
- Facter.fact(:swapfree).value.should == $1
26
- end
24
+ if swapusage =~ /total = (\S+).*/
25
+ Facter.fact(:swapfree).value.should == $1
27
26
  end
27
+ end
28
28
 
29
- it "should return the current swap free" do
30
- Facter.fact(:kernel).stubs(:value).returns("Darwin")
31
- Facter::Util::Resolution.stubs(:exec).with('sysctl vm.swapusage').returns("vm.swapusage: total = 64.00M used = 0.00M free = 64.00M (encrypted)")
32
- swapusage = "vm.swapusage: total = 64.00M used = 0.00M free = 64.00M (encrypted)"
29
+ it "should return the current swap free" do
30
+ Facter.fact(:kernel).stubs(:value).returns("Darwin")
31
+ Facter::Util::Resolution.stubs(:exec).with('sysctl vm.swapusage').returns("vm.swapusage: total = 64.00M used = 0.00M free = 64.00M (encrypted)")
32
+ swapusage = "vm.swapusage: total = 64.00M used = 0.00M free = 64.00M (encrypted)"
33
33
 
34
- if swapusage =~ /free = (\S+).*/
35
- Facter.fact(:swapfree).value.should == $1
36
- end
34
+ if swapusage =~ /free = (\S+).*/
35
+ Facter.fact(:swapfree).value.should == $1
37
36
  end
37
+ end
38
38
 
39
- it "should return whether swap is encrypted" do
40
- Facter.fact(:kernel).stubs(:value).returns("Darwin")
41
- Facter::Util::Resolution.stubs(:exec).with('sysctl vm.swapusage').returns("vm.swapusage: total = 64.00M used = 0.00M free = 64.00M (encrypted)")
42
- swapusage = "vm.swapusage: total = 64.00M used = 0.00M free = 64.00M (encrypted)"
39
+ it "should return whether swap is encrypted" do
40
+ Facter.fact(:kernel).stubs(:value).returns("Darwin")
41
+ Facter::Util::Resolution.stubs(:exec).with('sysctl vm.swapusage').returns("vm.swapusage: total = 64.00M used = 0.00M free = 64.00M (encrypted)")
42
+ swapusage = "vm.swapusage: total = 64.00M used = 0.00M free = 64.00M (encrypted)"
43
43
 
44
- swapusage =~ /\(encrypted\)/
45
- Facter.fact(:swapencrypted).value.should == true
46
- end
44
+ swapusage =~ /\(encrypted\)/
45
+ Facter.fact(:swapencrypted).value.should == true
46
+ end
47
47
 
48
- describe "on OpenBSD" do
49
- before :each do
50
- Facter.clear
51
- Facter.fact(:kernel).stubs(:value).returns("OpenBSD")
48
+ describe "on OpenBSD" do
49
+ before :each do
50
+ Facter.clear
51
+ Facter.fact(:kernel).stubs(:value).returns("OpenBSD")
52
52
 
53
- swapusage = "total: 148342k bytes allocated = 0k used, 148342k available"
54
- Facter::Util::Resolution.stubs(:exec).with('swapctl -s').returns(swapusage)
53
+ swapusage = "total: 148342k bytes allocated = 0k used, 148342k available"
54
+ Facter::Util::Resolution.stubs(:exec).with('swapctl -s').returns(swapusage)
55
55
 
56
- vmstat = <<EOS
57
- procs memory page disks traps cpu
58
- r b w avm fre flt re pi po fr sr cd0 sd0 int sys cs us sy id
59
- 0 0 0 11048 181028 39 0 0 0 0 0 0 1 3 90 17 0 0 100
56
+ vmstat = <<EOS
57
+ procs memory page disks traps cpu
58
+ r b w avm fre flt re pi po fr sr cd0 sd0 int sys cs us sy id
59
+ 0 0 0 11048 181028 39 0 0 0 0 0 0 1 3 90 17 0 0 100
60
60
  EOS
61
- Facter::Util::Resolution.stubs(:exec).with('vmstat').returns(vmstat)
62
-
63
- Facter::Util::Resolution.stubs(:exec).with("sysctl hw.physmem | cut -d'=' -f2").returns('267321344')
61
+ Facter::Util::Resolution.stubs(:exec).with('vmstat').returns(vmstat)
64
62
 
65
- Facter.collection.loader.load(:memory)
66
- end
63
+ Facter::Util::Resolution.stubs(:exec).with("sysctl hw.physmem | cut -d'=' -f2").returns('267321344')
67
64
 
68
- after :each do
69
- Facter.clear
70
- end
71
-
72
- it "should return the current swap free" do
73
- Facter.fact(:swapfree).value.should == "144.87 MB"
74
- end
75
-
76
- it "should return the current swap size" do
77
- Facter.fact(:swapsize).value.should == "144.87 MB"
78
- end
65
+ Facter.collection.loader.load(:memory)
66
+ end
79
67
 
80
- it "should return the current memorysize" do
81
- Facter.fact(:memorytotal).value.should == "254.94 MB"
82
- end
68
+ after :each do
69
+ Facter.clear
83
70
  end
84
71
 
85
- describe "on DragonFly BSD" do
86
- before :each do
87
- Facter.clear
88
- Facter.fact(:kernel).stubs(:value).returns("dragonfly")
72
+ it "should return the current swap free" do
73
+ Facter.fact(:swapfree).value.should == "144.87 MB"
74
+ end
89
75
 
90
- swapusage = "total: 148342k bytes allocated = 0k used, 148342k available"
91
- Facter::Util::Resolution.stubs(:exec).with('/sbin/sysctl -n hw.pagesize').returns("4096")
92
- Facter::Util::Resolution.stubs(:exec).with('/sbin/sysctl -n vm.swap_size').returns("128461")
93
- Facter::Util::Resolution.stubs(:exec).with('/sbin/sysctl -n vm.swap_anon_use').returns("2635")
94
- Facter::Util::Resolution.stubs(:exec).with('/sbin/sysctl -n vm.swap_cache_use').returns("0")
76
+ it "should return the current swap size" do
77
+ Facter.fact(:swapsize).value.should == "144.87 MB"
78
+ end
95
79
 
96
- vmstat = <<EOS
97
- procs memory page disks faults cpu
98
- r b w avm fre flt re pi po fr sr da0 sg1 in sy cs us sy id
80
+ it "should return the current memorysize" do
81
+ Facter.fact(:memorytotal).value.should == "254.94 MB"
82
+ end
83
+ end
84
+
85
+ describe "on DragonFly BSD" do
86
+ before :each do
87
+ Facter.clear
88
+ Facter.fact(:kernel).stubs(:value).returns("dragonfly")
89
+
90
+ swapusage = "total: 148342k bytes allocated = 0k used, 148342k available"
91
+ Facter::Util::Resolution.stubs(:exec).with('/sbin/sysctl -n hw.pagesize').returns("4096")
92
+ Facter::Util::Resolution.stubs(:exec).with('/sbin/sysctl -n vm.swap_size').returns("128461")
93
+ Facter::Util::Resolution.stubs(:exec).with('/sbin/sysctl -n vm.swap_anon_use').returns("2635")
94
+ Facter::Util::Resolution.stubs(:exec).with('/sbin/sysctl -n vm.swap_cache_use').returns("0")
95
+
96
+ vmstat = <<EOS
97
+ procs memory page disks faults cpu
98
+ r b w avm fre flt re pi po fr sr da0 sg1 in sy cs us sy id
99
99
  0 0 0 33152 13940 1902120 2198 53119 11642 6544597 5460994 0 0 6148243 7087927 3484264 0 1 9
100
100
  EOS
101
- Facter::Util::Resolution.stubs(:exec).with('vmstat').returns(vmstat)
101
+ Facter::Util::Resolution.stubs(:exec).with('vmstat').returns(vmstat)
102
102
 
103
- Facter::Util::Resolution.stubs(:exec).with("sysctl -n hw.physmem").returns('248512512')
103
+ Facter::Util::Resolution.stubs(:exec).with("sysctl -n hw.physmem").returns('248512512')
104
104
 
105
- Facter.collection.loader.load(:memory)
106
- end
105
+ Facter.collection.loader.load(:memory)
106
+ end
107
107
 
108
- after :each do
109
- Facter.clear
110
- end
108
+ after :each do
109
+ Facter.clear
110
+ end
111
111
 
112
- it "should return the current swap free" do
113
- Facter.fact(:swapfree).value.should == "491.51 MB"
114
- end
112
+ it "should return the current swap free" do
113
+ Facter.fact(:swapfree).value.should == "491.51 MB"
114
+ end
115
115
 
116
- it "should return the current swap size" do
117
- Facter.fact(:swapsize).value.should == "501.80 MB"
118
- end
116
+ it "should return the current swap size" do
117
+ Facter.fact(:swapsize).value.should == "501.80 MB"
118
+ end
119
119
 
120
- it "should return the current memorysize" do
121
- Facter.fact(:memorytotal).value.should == "237.00 MB"
122
- end
120
+ it "should return the current memorysize" do
121
+ Facter.fact(:memorytotal).value.should == "237.00 MB"
123
122
  end
123
+ end
124
124
 
125
- describe "on Windows" do
126
- before :each do
127
- Facter.clear
128
- Facter.fact(:kernel).stubs(:value).returns("windows")
129
- Facter.collection.loader.load(:memory)
125
+ describe "on Windows" do
126
+ before :each do
127
+ Facter.clear
128
+ Facter.fact(:kernel).stubs(:value).returns("windows")
129
+ Facter.collection.loader.load(:memory)
130
130
 
131
- require 'facter/util/wmi'
132
- end
131
+ require 'facter/util/wmi'
132
+ end
133
133
 
134
- it "should return free memory" do
135
- os = stubs 'os'
136
- os.stubs(:FreePhysicalMemory).returns("3415624")
137
- Facter::Util::WMI.stubs(:execquery).returns([os])
134
+ it "should return free memory" do
135
+ os = stubs 'os'
136
+ os.stubs(:FreePhysicalMemory).returns("3415624")
137
+ Facter::Util::WMI.stubs(:execquery).returns([os])
138
138
 
139
- Facter.fact(:MemoryFree).value.should == '3.26 GB'
140
- end
139
+ Facter.fact(:MemoryFree).value.should == '3.26 GB'
140
+ end
141
141
 
142
- it "should return total memory" do
143
- computer = stubs 'computer'
144
- computer.stubs(:TotalPhysicalMemory).returns("4193837056")
145
- Facter::Util::WMI.stubs(:execquery).returns([computer])
142
+ it "should return total memory" do
143
+ computer = stubs 'computer'
144
+ computer.stubs(:TotalPhysicalMemory).returns("4193837056")
145
+ Facter::Util::WMI.stubs(:execquery).returns([computer])
146
146
 
147
- Facter.fact(:MemoryTotal).value.should == '3.91 GB'
148
- end
147
+ Facter.fact(:MemoryTotal).value.should == '3.91 GB'
149
148
  end
149
+ end
150
150
  end
@@ -6,78 +6,87 @@ require 'facter'
6
6
 
7
7
  describe "Operating System fact" do
8
8
 
9
- before do
10
- Facter.clear
11
- end
9
+ before do
10
+ Facter.clear
11
+ end
12
12
 
13
- after do
14
- Facter.clear
15
- end
13
+ after do
14
+ Facter.clear
15
+ end
16
16
 
17
- it "should default to the kernel name" do
18
- Facter.fact(:kernel).stubs(:value).returns("Nutmeg")
17
+ it "should default to the kernel name" do
18
+ Facter.fact(:kernel).stubs(:value).returns("Nutmeg")
19
19
 
20
- Facter.fact(:operatingsystem).value.should == "Nutmeg"
21
- end
20
+ Facter.fact(:operatingsystem).value.should == "Nutmeg"
21
+ end
22
22
 
23
- it "should be Solaris for SunOS" do
24
- Facter.fact(:kernel).stubs(:value).returns("SunOS")
23
+ it "should be Solaris for SunOS" do
24
+ Facter.fact(:kernel).stubs(:value).returns("SunOS")
25
25
 
26
- Facter.fact(:operatingsystem).value.should == "Solaris"
27
- end
26
+ Facter.fact(:operatingsystem).value.should == "Solaris"
27
+ end
28
28
 
29
- it "should be ESXi for VMkernel" do
30
- Facter.fact(:kernel).stubs(:value).returns("VMkernel")
29
+ it "should be ESXi for VMkernel" do
30
+ Facter.fact(:kernel).stubs(:value).returns("VMkernel")
31
31
 
32
- Facter.fact(:operatingsystem).value.should == "ESXi"
33
- end
32
+ Facter.fact(:operatingsystem).value.should == "ESXi"
33
+ end
34
34
 
35
- it "should identify Oracle VM as OVS" do
36
- Facter.fact(:kernel).stubs(:value).returns("Linux")
37
- Facter.stubs(:value).with(:lsbdistid).returns(nil)
38
- FileTest.stubs(:exists?).returns false
35
+ it "should identify Oracle VM as OVS" do
36
+ Facter.fact(:kernel).stubs(:value).returns("Linux")
37
+ Facter.stubs(:value).with(:lsbdistid).returns(nil)
38
+ FileTest.stubs(:exists?).returns false
39
39
 
40
- FileTest.expects(:exists?).with("/etc/ovs-release").returns true
41
- FileTest.expects(:exists?).with("/etc/enterprise-release").returns true
40
+ FileTest.expects(:exists?).with("/etc/ovs-release").returns true
41
+ FileTest.expects(:exists?).with("/etc/enterprise-release").returns true
42
42
 
43
- Facter.fact(:operatingsystem).value.should == "OVS"
44
- end
43
+ Facter.fact(:operatingsystem).value.should == "OVS"
44
+ end
45
45
 
46
- it "should identify VMWare ESX" do
47
- Facter.fact(:kernel).stubs(:value).returns("Linux")
48
- Facter.stubs(:value).with(:lsbdistid).returns(nil)
49
- FileTest.stubs(:exists?).returns false
50
-
51
- FileTest.expects(:exists?).with("/etc/vmware-release").returns true
52
-
53
- Facter.fact(:operatingsystem).value.should == "VMWareESX"
54
- end
55
-
56
- it "should identify Alpine Linux" do
57
- Facter.fact(:kernel).stubs(:value).returns("Linux")
58
-
59
- FileTest.stubs(:exists?).returns false
60
-
61
- FileTest.expects(:exists?).with("/etc/alpine-release").returns true
62
-
63
- Facter.fact(:operatingsystem).value.should == "Alpine"
64
- end
65
-
66
- it "should identify Scientific Linux" do
67
- Facter.fact(:kernel).stubs(:value).returns("Linux")
68
- FileTest.stubs(:exists?).returns false
69
-
70
- FileTest.expects(:exists?).with("/etc/redhat-release").returns true
71
- File.expects(:read).with("/etc/redhat-release").returns("Scientific Linux SLC 5.7 (Boron)")
72
- Facter.fact(:operatingsystem).value.should == "Scientific"
73
- end
74
-
75
- it "should differentiate between Scientific Linux CERN and Scientific Linux" do
76
- Facter.fact(:kernel).stubs(:value).returns("Linux")
77
- FileTest.stubs(:exists?).returns false
78
-
79
- FileTest.expects(:exists?).with("/etc/redhat-release").returns true
80
- File.expects(:read).with("/etc/redhat-release").returns("Scientific Linux CERN SLC 5.7 (Boron)")
81
- Facter.fact(:operatingsystem).value.should == "SLC"
82
- end
46
+ it "should identify VMWare ESX" do
47
+ Facter.fact(:kernel).stubs(:value).returns("Linux")
48
+ Facter.stubs(:value).with(:lsbdistid).returns(nil)
49
+ FileTest.stubs(:exists?).returns false
50
+
51
+ FileTest.expects(:exists?).with("/etc/vmware-release").returns true
52
+
53
+ Facter.fact(:operatingsystem).value.should == "VMWareESX"
54
+ end
55
+
56
+ it "should identify Alpine Linux" do
57
+ Facter.fact(:kernel).stubs(:value).returns("Linux")
58
+
59
+ FileTest.stubs(:exists?).returns false
60
+
61
+ FileTest.expects(:exists?).with("/etc/alpine-release").returns true
62
+
63
+ Facter.fact(:operatingsystem).value.should == "Alpine"
64
+ end
65
+
66
+ it "should identify Scientific Linux" do
67
+ Facter.fact(:kernel).stubs(:value).returns("Linux")
68
+ FileTest.stubs(:exists?).returns false
69
+
70
+ FileTest.expects(:exists?).with("/etc/redhat-release").returns true
71
+ File.expects(:read).with("/etc/redhat-release").returns("Scientific Linux SLC 5.7 (Boron)")
72
+ Facter.fact(:operatingsystem).value.should == "Scientific"
73
+ end
74
+
75
+ it "should differentiate between Scientific Linux CERN and Scientific Linux" do
76
+ Facter.fact(:kernel).stubs(:value).returns("Linux")
77
+ FileTest.stubs(:exists?).returns false
78
+
79
+ FileTest.expects(:exists?).with("/etc/redhat-release").returns true
80
+ File.expects(:read).with("/etc/redhat-release").returns("Scientific Linux CERN SLC 5.7 (Boron)")
81
+ Facter.fact(:operatingsystem).value.should == "SLC"
82
+ end
83
+
84
+ it "should identify Ascendos Linux" do
85
+ Facter.fact(:kernel).stubs(:value).returns("Linux")
86
+ FileTest.stubs(:exists?).returns false
87
+
88
+ FileTest.expects(:exists?).with("/etc/redhat-release").returns true
89
+ File.expects(:read).with("/etc/redhat-release").returns("Ascendos release 6.0 (Nameless)")
90
+ Facter.fact(:operatingsystem).value.should == "Ascendos"
91
+ end
83
92
  end