opscode-ohai 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. data/LICENSE +201 -0
  2. data/README.rdoc +56 -0
  3. data/Rakefile +58 -0
  4. data/bin/ohai +58 -0
  5. data/lib/ohai.rb +27 -0
  6. data/lib/ohai/config.rb +118 -0
  7. data/lib/ohai/exception.rb +23 -0
  8. data/lib/ohai/log.rb +89 -0
  9. data/lib/ohai/log/formatter.rb +57 -0
  10. data/lib/ohai/mixin/command.rb +198 -0
  11. data/lib/ohai/mixin/from_file.rb +36 -0
  12. data/lib/ohai/plugins/command.rb +19 -0
  13. data/lib/ohai/plugins/darwin/hostname.rb +20 -0
  14. data/lib/ohai/plugins/darwin/kernel.rb +31 -0
  15. data/lib/ohai/plugins/darwin/network.rb +154 -0
  16. data/lib/ohai/plugins/darwin/platform.rb +34 -0
  17. data/lib/ohai/plugins/darwin/ps.rb +21 -0
  18. data/lib/ohai/plugins/darwin/ssh_host_key.rb +24 -0
  19. data/lib/ohai/plugins/ec2.rb +41 -0
  20. data/lib/ohai/plugins/hostname.rb +23 -0
  21. data/lib/ohai/plugins/kernel.rb +24 -0
  22. data/lib/ohai/plugins/keys.rb +20 -0
  23. data/lib/ohai/plugins/languages.rb +19 -0
  24. data/lib/ohai/plugins/linux/block_device.rb +36 -0
  25. data/lib/ohai/plugins/linux/cpu.rb +58 -0
  26. data/lib/ohai/plugins/linux/filesystem.rb +55 -0
  27. data/lib/ohai/plugins/linux/hostname.rb +20 -0
  28. data/lib/ohai/plugins/linux/kernel.rb +31 -0
  29. data/lib/ohai/plugins/linux/lsb.rb +36 -0
  30. data/lib/ohai/plugins/linux/memory.rb +81 -0
  31. data/lib/ohai/plugins/linux/network.rb +103 -0
  32. data/lib/ohai/plugins/linux/platform.rb +41 -0
  33. data/lib/ohai/plugins/linux/ps.rb +21 -0
  34. data/lib/ohai/plugins/linux/ssh_host_key.rb +24 -0
  35. data/lib/ohai/plugins/linux/uptime.rb +26 -0
  36. data/lib/ohai/plugins/network.rb +48 -0
  37. data/lib/ohai/plugins/ohai_time.rb +19 -0
  38. data/lib/ohai/plugins/os.rb +34 -0
  39. data/lib/ohai/plugins/platform.rb +23 -0
  40. data/lib/ohai/plugins/ruby.rb +33 -0
  41. data/lib/ohai/plugins/uptime.rb +42 -0
  42. data/lib/ohai/system.rb +163 -0
  43. data/spec/ohai/log/log_formatter_spec.rb +50 -0
  44. data/spec/ohai/log_spec.rb +63 -0
  45. data/spec/ohai/mixin/from_file_spec.rb +53 -0
  46. data/spec/ohai/plugins/darwin/hostname_spec.rb +34 -0
  47. data/spec/ohai/plugins/darwin/kernel_spec.rb +35 -0
  48. data/spec/ohai/plugins/darwin/platform_spec.rb +67 -0
  49. data/spec/ohai/plugins/hostname_spec.rb +33 -0
  50. data/spec/ohai/plugins/kernel_spec.rb +41 -0
  51. data/spec/ohai/plugins/linux/cpu_spec.rb +128 -0
  52. data/spec/ohai/plugins/linux/hostname_spec.rb +34 -0
  53. data/spec/ohai/plugins/linux/kernel_spec.rb +31 -0
  54. data/spec/ohai/plugins/linux/lsb_spec.rb +59 -0
  55. data/spec/ohai/plugins/linux/platform_spec.rb +51 -0
  56. data/spec/ohai/plugins/linux/uptime_spec.rb +61 -0
  57. data/spec/ohai/plugins/ohai_time_spec.rb +46 -0
  58. data/spec/ohai/plugins/os_spec.rb +58 -0
  59. data/spec/ohai/plugins/platform_spec.rb +56 -0
  60. data/spec/ohai/plugins/ruby_spec.rb +49 -0
  61. data/spec/ohai/system_spec.rb +130 -0
  62. data/spec/ohai_spec.rb +27 -0
  63. data/spec/rcov.opts +2 -0
  64. data/spec/spec.opts +2 -0
  65. data/spec/spec_helper.rb +47 -0
  66. metadata +138 -0
@@ -0,0 +1,53 @@
1
+ #
2
+ # Author:: Adam Jacob (<adam@opscode.com>)
3
+ # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require File.join(File.dirname(__FILE__), '..', '..', '/spec_helper.rb')
20
+
21
+ describe Ohai::System, "from_file" do
22
+ before(:each) do
23
+ @ohai = Ohai::System.new
24
+ File.stub!(:exists?).and_return(true)
25
+ File.stub!(:readable?).and_return(true)
26
+ IO.stub!(:read).and_return("king 'herod'")
27
+ end
28
+
29
+ it "should check to see that the file exists" do
30
+ File.should_receive(:exists?).and_return(true)
31
+ @ohai.from_file("/tmp/foo")
32
+ end
33
+
34
+ it "should check to see that the file is readable" do
35
+ File.should_receive(:readable?).and_return(true)
36
+ @ohai.from_file("/tmp/foo")
37
+ end
38
+
39
+ it "should actually read the file" do
40
+ IO.should_receive(:read).and_return("king 'herod'")
41
+ @ohai.from_file("/tmp/foo")
42
+ end
43
+
44
+ it "should call instance_eval with the contents of the file, file name, and line 1" do
45
+ @ohai.should_receive(:instance_eval).with("king 'herod'", "/tmp/foo", 1)
46
+ @ohai.from_file("/tmp/foo")
47
+ end
48
+
49
+ it "should raise an IOError if it cannot read the file" do
50
+ File.stub!(:exists?).and_return(false)
51
+ lambda { @ohai.from_file("/tmp/foo") }.should raise_error(IOError)
52
+ end
53
+ end
@@ -0,0 +1,34 @@
1
+ #
2
+ # Author:: Adam Jacob (<adam@opscode.com>)
3
+ # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+
20
+ require File.join(File.dirname(__FILE__), '..', '..', '..', '/spec_helper.rb')
21
+
22
+ describe Ohai::System, "Darwin hostname plugin" do
23
+ before(:each) do
24
+ @ohai = Ohai::System.new
25
+ @ohai.stub!(:require_plugin).and_return(true)
26
+ @ohai[:os] = "darwin"
27
+ @ohai.stub!(:from).with("hostname -s").and_return("katie")
28
+ @ohai.stub!(:from).with("hostname").and_return("katie.bethell")
29
+ end
30
+
31
+ it_should_check_from("darwin::hostname", "hostname", "hostname -s", "katie")
32
+
33
+ it_should_check_from("darwin::hostname", "fqdn", "hostname", "katie.bethell")
34
+ end
@@ -0,0 +1,35 @@
1
+ #
2
+ # Author:: Adam Jacob (<adam@opscode.com>)
3
+ # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+
20
+ require File.join(File.dirname(__FILE__), '..', '..', '..', '/spec_helper.rb')
21
+
22
+ describe Ohai::System, "Darwin kernel plugin" do
23
+ before(:each) do
24
+ @ohai = Ohai::System.new
25
+ @ohai.stub!(:require_plugin).and_return(true)
26
+ @ohai[:kernel] = Mash.new
27
+ @ohai[:kernel][:name] = "darwin"
28
+ end
29
+
30
+ it "should set the kernel_os to the kernel_name value" do
31
+ @ohai._require_plugin("darwin::kernel")
32
+ @ohai[:kernel][:os].should == @ohai[:kernel][:name]
33
+ end
34
+
35
+ end
@@ -0,0 +1,67 @@
1
+ #
2
+ # Author:: Adam Jacob (<adam@opscode.com>)
3
+ # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+
20
+ require File.join(File.dirname(__FILE__), '..', '..', '..', '/spec_helper.rb')
21
+
22
+ describe Ohai::System, "Darwin plugin platform" do
23
+ before(:each) do
24
+ @ohai = Ohai::System.new
25
+ @ohai.stub!(:require_plugin).and_return(true)
26
+ @ohai[:os] = "darwin"
27
+ @pid = 10
28
+ @stdin = mock("STDIN", { :close => true })
29
+ @stdout = mock("STDOUT")
30
+ @stdout.stub!(:each).
31
+ and_yield("ProductName: Mac OS X").
32
+ and_yield("ProductVersion: 10.5.5").
33
+ and_yield("BuildVersion: 9F33")
34
+ @stderr = mock("STDERR")
35
+ @ohai.stub!(:popen4).with("/usr/bin/sw_vers").and_yield(@pid, @stdin, @stdout, @stderr)
36
+ end
37
+
38
+ it "should run sw_vers" do
39
+ @ohai.should_receive(:popen4).with("/usr/bin/sw_vers").and_return(true)
40
+ @ohai._require_plugin("darwin::platform")
41
+ end
42
+
43
+ it "should close sw_vers stdin" do
44
+ @stdin.should_receive(:close)
45
+ @ohai._require_plugin("darwin::platform")
46
+ end
47
+
48
+ it "should iterate over each line of sw_vers stdout" do
49
+ @stdout.should_receive(:each).and_return(true)
50
+ @ohai._require_plugin("darwin::platform")
51
+ end
52
+
53
+ it "should set platform to ProductName, downcased with _ for \\s" do
54
+ @ohai._require_plugin("darwin::platform")
55
+ @ohai[:platform].should == "mac_os_x"
56
+ end
57
+
58
+ it "should set platform_version to ProductVersion" do
59
+ @ohai._require_plugin("darwin::platform")
60
+ @ohai[:platform_version].should == "10.5.5"
61
+ end
62
+
63
+ it "should set platform_build to BuildVersion" do
64
+ @ohai._require_plugin("darwin::platform")
65
+ @ohai[:platform_build].should == "9F33"
66
+ end
67
+ end
@@ -0,0 +1,33 @@
1
+ #
2
+ # Author:: Adam Jacob (<adam@opscode.com>)
3
+ # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+
20
+ require File.join(File.dirname(__FILE__), '..', '..', '/spec_helper.rb')
21
+
22
+ describe Ohai::System, "hostname plugin" do
23
+ before(:each) do
24
+ @ohai = Ohai::System.new
25
+ @ohai.stub!(:require_plugin).and_return(true)
26
+ @ohai[:fqdn] = "katie.bethell"
27
+ end
28
+
29
+ it "should set the domain to everything after the first dot of the fqdn" do
30
+ @ohai._require_plugin("hostname")
31
+ @ohai.domain.should == "bethell"
32
+ end
33
+ end
@@ -0,0 +1,41 @@
1
+ #
2
+ # Author:: Adam Jacob (<adam@opscode.com>)
3
+ # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+
20
+ require File.join(File.dirname(__FILE__), '..', '..', '/spec_helper.rb')
21
+
22
+ describe Ohai::System, "plugin kernel" do
23
+ before(:each) do
24
+ @ohai = Ohai::System.new
25
+ @ohai.stub!(:require_plugin).and_return(true)
26
+ @ohai.stub!(:from).with("uname -s").and_return("Darwin")
27
+ @ohai.stub!(:from).with("uname -r").and_return("9.5.0")
28
+ @ohai.stub!(:from).with("uname -v").and_return("Darwin Kernel Version 9.5.0: Wed Sep 3 11:29:43 PDT 2008; root:xnu-1228.7.58~1\/RELEASE_I386")
29
+ @ohai.stub!(:from).with("uname -m").and_return("i386")
30
+ @ohai.stub!(:from).with("uname -o").and_return("Linux")
31
+ end
32
+
33
+ it_should_check_from_mash("kernel", "name", "uname -s", "Darwin")
34
+
35
+ it_should_check_from_mash("kernel", "release", "uname -r", "9.5.0")
36
+
37
+ it_should_check_from_mash("kernel", "version", "uname -v", "Darwin Kernel Version 9.5.0: Wed Sep 3 11:29:43 PDT 2008; root:xnu-1228.7.58~1\/RELEASE_I386")
38
+
39
+ it_should_check_from_mash("kernel", "machine", "uname -m", "i386")
40
+
41
+ end
@@ -0,0 +1,128 @@
1
+ #
2
+ # Author:: Adam Jacob (<adam@opscode.com>)
3
+ # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+
20
+ require File.join(File.dirname(__FILE__), '..', '..', '..', '/spec_helper.rb')
21
+
22
+ describe Ohai::System, "Linux cpu plugin" do
23
+ before(:each) do
24
+ @ohai = Ohai::System.new
25
+ @ohai.stub!(:require_plugin).and_return(true)
26
+ @ohai[:os] = "linux"
27
+ @mock_file = mock("/proc/cpuinfo")
28
+ @mock_file.stub!(:each).
29
+ and_yield("processor : 0").
30
+ and_yield("vendor_id : GenuineIntel").
31
+ and_yield("cpu family : 6").
32
+ and_yield("model : 23").
33
+ and_yield("model name : Intel(R) Core(TM)2 Duo CPU T8300 @ 2.40GHz").
34
+ and_yield("stepping : 6").
35
+ and_yield("cpu MHz : 1968.770").
36
+ and_yield("cache size : 64 KB").
37
+ and_yield("fdiv_bug : no").
38
+ and_yield("hlt_bug : no").
39
+ and_yield("f00f_bug : no").
40
+ and_yield("coma_bug : no").
41
+ and_yield("fpu : yes").
42
+ and_yield("fpu_exception : yes").
43
+ and_yield("cpuid level : 10").
44
+ and_yield("wp : yes").
45
+ and_yield("flags : fpu pse tsc msr mce cx8 sep mtrr pge cmov").
46
+ and_yield("bogomips : 2575.86").
47
+ and_yield("clflush size : 32")
48
+ File.stub!(:open).with("/proc/cpuinfo").and_return(@mock_file)
49
+ end
50
+
51
+ it "should set cpu[:total] to 1" do
52
+ @ohai._require_plugin("linux::cpu")
53
+ @ohai[:cpu][:total].should == 1
54
+ end
55
+
56
+ it "should set cpu[:real] to 0" do
57
+ @ohai._require_plugin("linux::cpu")
58
+ @ohai[:cpu][:real].should == 0
59
+ end
60
+
61
+ it "should have a cpu 0" do
62
+ @ohai._require_plugin("linux::cpu")
63
+ @ohai[:cpu].should have_key("0")
64
+ end
65
+
66
+ it "should have a vendor_id for cpu 0" do
67
+ @ohai._require_plugin("linux::cpu")
68
+ @ohai[:cpu]["0"].should have_key("vendor_id")
69
+ @ohai[:cpu]["0"]["vendor_id"].should eql("GenuineIntel")
70
+ end
71
+
72
+ it "should have a family for cpu 0" do
73
+ @ohai._require_plugin("linux::cpu")
74
+ @ohai[:cpu]["0"].should have_key("family")
75
+ @ohai[:cpu]["0"]["family"].should eql("6")
76
+ end
77
+
78
+ it "should have a model for cpu 0" do
79
+ @ohai._require_plugin("linux::cpu")
80
+ @ohai[:cpu]["0"].should have_key("model")
81
+ @ohai[:cpu]["0"]["model"].should eql("23")
82
+ end
83
+
84
+ it "should have a stepping for cpu 0" do
85
+ @ohai._require_plugin("linux::cpu")
86
+ @ohai[:cpu]["0"].should have_key("stepping")
87
+ @ohai[:cpu]["0"]["stepping"].should eql("6")
88
+ end
89
+
90
+ it "should not have a phyiscal_id for cpu 0" do
91
+ @ohai._require_plugin("linux::cpu")
92
+ @ohai[:cpu]["0"].should_not have_key("physical_id")
93
+ end
94
+
95
+ it "should not have a core_id for cpu 0" do
96
+ @ohai._require_plugin("linux::cpu")
97
+ @ohai[:cpu]["0"].should_not have_key("core_id")
98
+ end
99
+
100
+ it "should not have a cores for cpu 0" do
101
+ @ohai._require_plugin("linux::cpu")
102
+ @ohai[:cpu]["0"].should_not have_key("cores")
103
+ end
104
+
105
+ it "should have a model name for cpu 0" do
106
+ @ohai._require_plugin("linux::cpu")
107
+ @ohai[:cpu]["0"].should have_key("model_name")
108
+ @ohai[:cpu]["0"]["model_name"].should eql("Intel(R) Core(TM)2 Duo CPU T8300 @ 2.40GHz")
109
+ end
110
+
111
+ it "should have a mhz for cpu 0" do
112
+ @ohai._require_plugin("linux::cpu")
113
+ @ohai[:cpu]["0"].should have_key("mhz")
114
+ @ohai[:cpu]["0"]["mhz"].should eql("1968.770")
115
+ end
116
+
117
+ it "should have a cache_size for cpu 0" do
118
+ @ohai._require_plugin("linux::cpu")
119
+ @ohai[:cpu]["0"].should have_key("cache_size")
120
+ @ohai[:cpu]["0"]["cache_size"].should eql("64 KB")
121
+ end
122
+
123
+ it "should have flags for cpu 0" do
124
+ @ohai._require_plugin("linux::cpu")
125
+ @ohai[:cpu]["0"].should have_key("flags")
126
+ @ohai[:cpu]["0"]["flags"].should == %w{fpu pse tsc msr mce cx8 sep mtrr pge cmov}
127
+ end
128
+ end
@@ -0,0 +1,34 @@
1
+ #
2
+ # Author:: Adam Jacob (<adam@opscode.com>)
3
+ # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+
20
+ require File.join(File.dirname(__FILE__), '..', '..', '..', '/spec_helper.rb')
21
+
22
+ describe Ohai::System, "Linux hostname plugin" do
23
+ before(:each) do
24
+ @ohai = Ohai::System.new
25
+ @ohai.stub!(:require_plugin).and_return(true)
26
+ @ohai[:os] = "linux"
27
+ @ohai.stub!(:from).with("hostname").and_return("katie")
28
+ @ohai.stub!(:from).with("hostname --fqdn").and_return("katie.bethell")
29
+ end
30
+
31
+ it_should_check_from("linux::hostname", "hostname", "hostname", "katie")
32
+
33
+ it_should_check_from("linux::hostname", "fqdn", "hostname --fqdn", "katie.bethell")
34
+ end
@@ -0,0 +1,31 @@
1
+ #
2
+ # Author:: Adam Jacob (<adam@opscode.com>)
3
+ # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+
20
+ require File.join(File.dirname(__FILE__), '..', '..', '..', '/spec_helper.rb')
21
+
22
+ describe Ohai::System, "Linux kernel plugin" do
23
+ before(:each) do
24
+ @ohai = Ohai::System.new
25
+ @ohai._require_plugin("kernel")
26
+ @ohai.stub!(:require_plugin).and_return(true)
27
+ @ohai.stub!(:from).with("uname -o").and_return("Linux")
28
+ end
29
+
30
+ it_should_check_from_deep_mash("linux::kernel", "kernel", "os", "uname -o", "Linux")
31
+ end