ohai 0.5.0 → 0.5.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 (70) hide show
  1. data/Rakefile +3 -3
  2. data/bin/ohai +14 -4
  3. data/docs/man/man1/ohai.1 +23 -0
  4. data/lib/ohai.rb +1 -1
  5. data/lib/ohai/application.rb +8 -0
  6. data/lib/ohai/plugins/chef.rb +23 -0
  7. data/lib/ohai/plugins/groovy.rb +35 -0
  8. data/lib/ohai/plugins/java.rb +6 -3
  9. data/lib/ohai/plugins/kernel.rb +1 -1
  10. data/lib/ohai/plugins/linux/network.rb +1 -1
  11. data/lib/ohai/plugins/linux/platform.rb +1 -1
  12. data/lib/ohai/plugins/lua.rb +34 -0
  13. data/lib/ohai/plugins/mono.rb +37 -0
  14. data/lib/ohai/plugins/network_listeners.rb +47 -0
  15. data/lib/ohai/plugins/ohai.rb +23 -0
  16. data/lib/ohai/plugins/os.rb +5 -4
  17. data/lib/ohai/plugins/perl.rb +5 -3
  18. data/lib/ohai/plugins/php.rb +36 -0
  19. data/lib/ohai/plugins/rackspace.rb +14 -4
  20. data/lib/ohai/plugins/windows/filesystem.rb +0 -0
  21. data/lib/ohai/system.rb +14 -9
  22. data/spec/ohai/mixin/command_spec.rb +1 -1
  23. data/spec/ohai/mixin/from_file_spec.rb +1 -1
  24. data/spec/ohai/plugins/chef_spec.rb +38 -0
  25. data/spec/ohai/plugins/cloud_spec.rb +3 -1
  26. data/spec/ohai/plugins/darwin/hostname_spec.rb +1 -1
  27. data/spec/ohai/plugins/darwin/kernel_spec.rb +1 -1
  28. data/spec/ohai/plugins/darwin/platform_spec.rb +1 -1
  29. data/spec/ohai/plugins/dmi_spec.rb +1 -1
  30. data/spec/ohai/plugins/ec2_spec.rb +1 -1
  31. data/spec/ohai/plugins/erlang_spec.rb +1 -1
  32. data/spec/ohai/plugins/freebsd/hostname_spec.rb +1 -1
  33. data/spec/ohai/plugins/freebsd/kernel_spec.rb +1 -1
  34. data/spec/ohai/plugins/freebsd/platform_spec.rb +1 -1
  35. data/spec/ohai/plugins/groovy_spec.rb +53 -0
  36. data/spec/ohai/plugins/hostname_spec.rb +1 -1
  37. data/spec/ohai/plugins/java_spec.rb +1 -1
  38. data/spec/ohai/plugins/kernel_spec.rb +1 -1
  39. data/spec/ohai/plugins/linux/cpu_spec.rb +1 -1
  40. data/spec/ohai/plugins/linux/hostname_spec.rb +1 -1
  41. data/spec/ohai/plugins/linux/kernel_spec.rb +1 -1
  42. data/spec/ohai/plugins/linux/lsb_spec.rb +1 -1
  43. data/spec/ohai/plugins/linux/platform_spec.rb +32 -1
  44. data/spec/ohai/plugins/linux/uptime_spec.rb +1 -1
  45. data/spec/ohai/plugins/linux/virtualization_spec.rb +1 -1
  46. data/spec/ohai/plugins/lua_spec.rb +53 -0
  47. data/spec/ohai/plugins/mono_spec.rb +53 -0
  48. data/spec/ohai/plugins/netbsd/hostname_spec.rb +1 -1
  49. data/spec/ohai/plugins/netbsd/kernel_spec.rb +1 -1
  50. data/spec/ohai/plugins/netbsd/platform_spec.rb +1 -1
  51. data/spec/ohai/plugins/ohai_spec.rb +33 -0
  52. data/spec/ohai/plugins/ohai_time_spec.rb +1 -1
  53. data/spec/ohai/plugins/openbsd/hostname_spec.rb +1 -1
  54. data/spec/ohai/plugins/openbsd/kernel_spec.rb +1 -1
  55. data/spec/ohai/plugins/openbsd/platform_spec.rb +1 -1
  56. data/spec/ohai/plugins/os_spec.rb +9 -3
  57. data/spec/ohai/plugins/passwd_spec.rb +1 -1
  58. data/spec/ohai/plugins/perl_spec.rb +3 -3
  59. data/spec/ohai/plugins/php_spec.rb +52 -0
  60. data/spec/ohai/plugins/platform_spec.rb +1 -1
  61. data/spec/ohai/plugins/python_spec.rb +1 -1
  62. data/spec/ohai/plugins/rackspace_spec.rb +1 -1
  63. data/spec/ohai/plugins/ruby_spec.rb +1 -1
  64. data/spec/ohai/plugins/solaris2/hostname_spec.rb +1 -1
  65. data/spec/ohai/plugins/solaris2/kernel_spec.rb +1 -1
  66. data/spec/ohai/plugins/solaris2/network_spec.rb +1 -1
  67. data/spec/ohai/system_spec.rb +1 -1
  68. data/spec/ohai_spec.rb +1 -1
  69. data/spec/spec_helper.rb +0 -5
  70. metadata +32 -7
@@ -16,14 +16,24 @@
16
16
 
17
17
  provides "rackspace"
18
18
 
19
+ require_plugin "kernel"
19
20
  require_plugin "network"
20
21
 
22
+ # Checks for matching rackspace kernel name
23
+ #
24
+ # === Return
25
+ # true:: If kernel name matches
26
+ # false:: Otherwise
27
+ def has_rackspace_kernel?
28
+ kernel[:release].split('-').last.eql?("rscloud")
29
+ end
30
+
21
31
  # Checks for matching rackspace arp mac
22
32
  #
23
33
  # === Return
24
- # true:: If mac address matches
34
+ # true:: If mac address matches
25
35
  # false:: Otherwise
26
- def has_rackspace_mac?
36
+ def has_rackspace_mac?
27
37
  network[:interfaces].values.each do |iface|
28
38
  unless iface[:arp].nil?
29
39
  return true if iface[:arp].value?("00:00:0c:07:ac:01")
@@ -37,8 +47,8 @@ end
37
47
  # === Return
38
48
  # true:: If the rackspace cloud can be identified
39
49
  # false:: Otherwise
40
- def looks_like_rackspace?
41
- has_rackspace_mac?
50
+ def looks_like_rackspace?
51
+ has_rackspace_mac? || has_rackspace_kernel?
42
52
  end
43
53
 
44
54
  # Names rackspace ip address
File without changes
@@ -16,7 +16,6 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require 'rubygems'
20
19
  require 'extlib'
21
20
  require 'ohai/log'
22
21
  require 'ohai/mixin/from_file'
@@ -102,9 +101,9 @@ module Ohai
102
101
  return md[1]
103
102
  end
104
103
  end
105
-
106
- def set_attribute(name, *value)
107
- @data[name] = *value
104
+
105
+ def set_attribute(name, *values)
106
+ @data[name] = Array18(*values)
108
107
  @data[name]
109
108
  end
110
109
 
@@ -129,7 +128,10 @@ module Ohai
129
128
  end
130
129
  end
131
130
  # Catch any errant children who need to be reaped
132
- Process.waitall
131
+ begin
132
+ true while Process.wait(-1, Process::WNOHANG)
133
+ rescue Errno::ECHILD
134
+ end
133
135
  true
134
136
  end
135
137
 
@@ -197,7 +199,7 @@ module Ohai
197
199
  rescue IOError => e
198
200
  Ohai::Log.debug("No #{plugin_name} at #{check_path}")
199
201
  rescue Exception,Errno::ENOENT => e
200
- Ohai::Log.debug("Plugin #{plugin_name} threw exception #{e.inspect}")
202
+ Ohai::Log.debug("Plugin #{plugin_name} threw exception #{e.inspect} #{e.backtrace.join("\n")}")
201
203
  end
202
204
  end
203
205
  end
@@ -246,8 +248,11 @@ module Ohai
246
248
  end
247
249
 
248
250
  private
249
- def load_plugin_file
250
-
251
- end
251
+
252
+ def Array18(*args)
253
+ return nil if args.empty?
254
+ return args.first if args.length == 1
255
+ return *args
256
+ end
252
257
  end
253
258
  end
@@ -16,7 +16,7 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require File.join(File.dirname(__FILE__), '..', '..', '/spec_helper.rb')
19
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
20
20
 
21
21
  describe Ohai::Mixin::Command, "popen4" do
22
22
 
@@ -16,7 +16,7 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require File.join(File.dirname(__FILE__), '..', '..', '/spec_helper.rb')
19
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
20
20
 
21
21
  describe Ohai::System, "from_file" do
22
22
  before(:each) do
@@ -0,0 +1,38 @@
1
+ #
2
+ # Author:: Adam Jacob (<adam@opscode.com>)
3
+ # Author:: Tollef Fog Heen <tfheen@err.no>
4
+ # Copyright:: Copyright (c) 2008 Opscode, Inc.
5
+ # Copyright:: Copyright (c) 2010 Tollef Fog Heen <tfheen@err.no>
6
+ # License:: Apache License, Version 2.0
7
+ #
8
+ # Licensed under the Apache License, Version 2.0 (the "License");
9
+ # you may not use this file except in compliance with the License.
10
+ # You may obtain a copy of the License at
11
+ #
12
+ # http://www.apache.org/licenses/LICENSE-2.0
13
+ #
14
+ # Unless required by applicable law or agreed to in writing, software
15
+ # distributed under the License is distributed on an "AS IS" BASIS,
16
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ # See the License for the specific language governing permissions and
18
+ # limitations under the License.
19
+ #
20
+
21
+ begin
22
+ require 'chef'
23
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
24
+
25
+ describe Ohai::System, "plugin chef" do
26
+ before(:each) do
27
+ @ohai = Ohai::System.new
28
+ @ohai.stub!(:require_plugin).and_return(true)
29
+ end
30
+
31
+ it "should set chef[:version] to the current chef version" do
32
+ @ohai._require_plugin("chef")
33
+ @ohai[:chef][:version].should == Chef::VERSION
34
+ end
35
+ end
36
+ rescue LoadError
37
+ # the chef module is not available, ignoring.
38
+ end
@@ -15,7 +15,9 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require File.join(File.dirname(__FILE__), '..', '..', '/spec_helper.rb')
18
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
19
+
20
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
19
21
 
20
22
  describe Ohai::System, "plugin cloud" do
21
23
  before(:each) do
@@ -17,7 +17,7 @@
17
17
  #
18
18
 
19
19
 
20
- require File.join(File.dirname(__FILE__), '..', '..', '..', '/spec_helper.rb')
20
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
21
21
 
22
22
  describe Ohai::System, "Darwin hostname plugin" do
23
23
  before(:each) do
@@ -17,7 +17,7 @@
17
17
  #
18
18
 
19
19
 
20
- require File.join(File.dirname(__FILE__), '..', '..', '..', '/spec_helper.rb')
20
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
21
21
 
22
22
  describe Ohai::System, "Darwin kernel plugin" do
23
23
  before(:each) do
@@ -17,7 +17,7 @@
17
17
  #
18
18
 
19
19
 
20
- require File.join(File.dirname(__FILE__), '..', '..', '..', '/spec_helper.rb')
20
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
21
21
 
22
22
  describe Ohai::System, "Darwin plugin platform" do
23
23
  before(:each) do
@@ -17,7 +17,7 @@
17
17
  #
18
18
 
19
19
 
20
- require File.join(File.dirname(__FILE__), '..', '..', '/spec_helper.rb')
20
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
21
21
 
22
22
  describe Ohai::System, "plugin dmi" do
23
23
  before(:each) do
@@ -17,7 +17,7 @@
17
17
  # limitations under the License.
18
18
  #
19
19
 
20
- require File.join(File.dirname(__FILE__), '..', '..', '/spec_helper.rb')
20
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
21
21
  require 'open-uri'
22
22
 
23
23
  describe Ohai::System, "plugin ec2" do
@@ -17,7 +17,7 @@
17
17
  #
18
18
 
19
19
 
20
- require File.join(File.dirname(__FILE__), '..', '..', '/spec_helper.rb')
20
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
21
21
 
22
22
  describe Ohai::System, "plugin erlang" do
23
23
 
@@ -17,7 +17,7 @@
17
17
  #
18
18
 
19
19
 
20
- require File.join(File.dirname(__FILE__), '..', '..', '..', '/spec_helper.rb')
20
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
21
21
 
22
22
  describe Ohai::System, "FreeBSD hostname plugin" do
23
23
  before(:each) do
@@ -17,7 +17,7 @@
17
17
  #
18
18
 
19
19
 
20
- require File.join(File.dirname(__FILE__), '..', '..', '..', '/spec_helper.rb')
20
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
21
21
 
22
22
  describe Ohai::System, "FreeBSD kernel plugin" do
23
23
  before(:each) do
@@ -17,7 +17,7 @@
17
17
  #
18
18
 
19
19
 
20
- require File.join(File.dirname(__FILE__), '..', '..', '..', '/spec_helper.rb')
20
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
21
21
 
22
22
  describe Ohai::System, "FreeBSD plugin platform" do
23
23
  before(:each) do
@@ -0,0 +1,53 @@
1
+ #
2
+ # Author:: Doug MacEachern <dougm@vmware.com>
3
+ # Copyright:: Copyright (c) 2009 VMware, 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 groovy" do
23
+
24
+ before(:each) do
25
+ @ohai = Ohai::System.new
26
+ @ohai[:languages] = Mash.new
27
+ @ohai.stub!(:require_plugin).and_return(true)
28
+ @status = 0
29
+ @stdout = "Groovy Version: 1.6.3 JVM: 1.6.0_0\n"
30
+ @stderr = ""
31
+ @ohai.stub!(:run_command).with({:no_status_check=>true, :command=>"groovy -v"}).and_return([@status, @stdout, @stderr])
32
+ end
33
+
34
+ it "should get the groovy version from running groovy -v" do
35
+ @ohai.should_receive(:run_command).with({:no_status_check=>true, :command=>"groovy -v"}).and_return([0, "Groovy Version: 1.6.3 JVM: 1.6.0_0\n", ""])
36
+ @ohai._require_plugin("groovy")
37
+ end
38
+
39
+ it "should set languages[:groovy][:version]" do
40
+ @ohai._require_plugin("groovy")
41
+ @ohai.languages[:groovy][:version].should eql("1.6.3")
42
+ end
43
+
44
+ it "should not set the languages[:groovy] tree up if groovy command fails" do
45
+ @status = 1
46
+ @stdout = "Groovy Version: 1.6.3 JVM: 1.6.0_0\n"
47
+ @stderr = ""
48
+ @ohai.stub!(:run_command).with({:no_status_check=>true, :command=>"groovy -v"}).and_return([@status, @stdout, @stderr])
49
+ @ohai._require_plugin("groovy")
50
+ @ohai.languages.should_not have_key(:groovy)
51
+ end
52
+
53
+ end
@@ -17,7 +17,7 @@
17
17
  #
18
18
 
19
19
 
20
- require File.join(File.dirname(__FILE__), '..', '..', '/spec_helper.rb')
20
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
21
21
 
22
22
  describe Ohai::System, "hostname plugin" do
23
23
  before(:each) do
@@ -16,7 +16,7 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require File.join(File.dirname(__FILE__), '..', '..', '/spec_helper.rb')
19
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
20
20
 
21
21
  describe Ohai::System, "plugin java" do
22
22
  before(:each) do
@@ -17,7 +17,7 @@
17
17
  #
18
18
 
19
19
 
20
- require File.join(File.dirname(__FILE__), '..', '..', '/spec_helper.rb')
20
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
21
21
 
22
22
  describe Ohai::System, "plugin kernel" do
23
23
  before(:each) do
@@ -17,7 +17,7 @@
17
17
  #
18
18
 
19
19
 
20
- require File.join(File.dirname(__FILE__), '..', '..', '..', '/spec_helper.rb')
20
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
21
21
 
22
22
  describe Ohai::System, "Linux cpu plugin" do
23
23
  before(:each) do
@@ -17,7 +17,7 @@
17
17
  #
18
18
 
19
19
 
20
- require File.join(File.dirname(__FILE__), '..', '..', '..', '/spec_helper.rb')
20
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
21
21
 
22
22
  describe Ohai::System, "Linux hostname plugin" do
23
23
  before(:each) do
@@ -17,7 +17,7 @@
17
17
  #
18
18
 
19
19
 
20
- require File.join(File.dirname(__FILE__), '..', '..', '..', '/spec_helper.rb')
20
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
21
21
 
22
22
  describe Ohai::System, "Linux kernel plugin" do
23
23
  before(:each) do
@@ -17,7 +17,7 @@
17
17
  #
18
18
 
19
19
 
20
- require File.join(File.dirname(__FILE__), '..', '..', '..', '/spec_helper.rb')
20
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
21
21
 
22
22
  describe Ohai::System, "Linux lsb plugin" do
23
23
  before(:each) do
@@ -17,7 +17,8 @@
17
17
  #
18
18
 
19
19
 
20
- require File.join(File.dirname(__FILE__), '..', '..', '..', '/spec_helper.rb')
20
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
21
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
21
22
 
22
23
  describe Ohai::System, "Linux plugin platform" do
23
24
  before(:each) do
@@ -144,5 +145,35 @@ describe Ohai::System, "Linux plugin platform" do
144
145
  end
145
146
  end
146
147
 
148
+ describe "on suse" do
149
+ before(:each) do
150
+ @ohai.lsb = nil
151
+ File.should_receive(:exists?).with("/etc/SuSE-release").and_return(true)
152
+ end
153
+
154
+ it "should check for the existance of SuSE-release" do
155
+ @ohai._require_plugin("linux::platform")
156
+ end
157
+
158
+ it "should set platform to suse" do
159
+ @ohai._require_plugin("linux::platform")
160
+ @ohai[:platform].should == "suse"
161
+ end
162
+
163
+ it "should read the version as 10.1 for bogus SLES 10" do
164
+ File.should_receive(:read).with("/etc/SuSE-release").and_return("SUSE Linux Enterprise Server 10 (i586)\nVERSION = 10\nPATCHLEVEL = 1\n")
165
+ @ohai._require_plugin("linux::platform")
166
+ @ohai[:platform].should == "suse"
167
+ @ohai[:platform_version].should == "10.1"
168
+ end
169
+
170
+ it "should read the version as 11.2" do
171
+ File.should_receive(:read).with("/etc/SuSE-release").and_return("SUSE Linux Enterprise Server 11.2 (i586)\nVERSION = 11\nPATCHLEVEL = 2\n")
172
+ @ohai._require_plugin("linux::platform")
173
+ @ohai[:platform].should == "suse"
174
+ @ohai[:platform_version].should == "11.2"
175
+ end
176
+ end
177
+
147
178
  end
148
179
 
@@ -17,7 +17,7 @@
17
17
  #
18
18
 
19
19
 
20
- require File.join(File.dirname(__FILE__), '..', '..', '..', '/spec_helper.rb')
20
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
21
21
 
22
22
  describe Ohai::System, "Linux plugin uptime" do
23
23
  before(:each) do
@@ -16,7 +16,7 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require File.join(File.dirname(__FILE__), '..', '..', '..', '/spec_helper.rb')
19
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
20
20
 
21
21
  describe Ohai::System, "Linux virtualization platform" do
22
22
  before(:each) do
@@ -0,0 +1,53 @@
1
+ #
2
+ # Author:: Doug MacEachern <dougm@vmware.com>
3
+ # Copyright:: Copyright (c) 2009 VMware, 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 lua" do
23
+
24
+ before(:each) do
25
+ @ohai = Ohai::System.new
26
+ @ohai[:languages] = Mash.new
27
+ @ohai.stub!(:require_plugin).and_return(true)
28
+ @status = 0
29
+ @stdout = ""
30
+ @stderr = "Lua 5.1.2 Copyright (C) 1994-2008 Lua.org, PUC-Rio\n"
31
+ @ohai.stub!(:run_command).with({:no_status_check=>true, :command=>"lua -v"}).and_return([@status, @stdout, @stderr])
32
+ end
33
+
34
+ it "should get the lua version from running lua -v" do
35
+ @ohai.should_receive(:run_command).with({:no_status_check=>true, :command=>"lua -v"}).and_return([0, "", "Lua 5.1.2 Copyright (C) 1994-2008 Lua.org, PUC-Rio\n"])
36
+ @ohai._require_plugin("lua")
37
+ end
38
+
39
+ it "should set languages[:lua][:version]" do
40
+ @ohai._require_plugin("lua")
41
+ @ohai.languages[:lua][:version].should eql("5.1.2")
42
+ end
43
+
44
+ it "should not set the languages[:lua] tree up if lua command fails" do
45
+ @status = 1
46
+ @stdout = ""
47
+ @stderr = "Lua 5.1.2 Copyright (C) 1994-2008 Lua.org, PUC-Rio\n"
48
+ @ohai.stub!(:run_command).with({:no_status_check=>true, :command=>"lua -v"}).and_return([@status, @stdout, @stderr])
49
+ @ohai._require_plugin("lua")
50
+ @ohai.languages.should_not have_key(:lua)
51
+ end
52
+
53
+ end