ohai 0.5.4 → 0.5.6

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'date'
5
5
  require 'spec/rake/spectask'
6
6
 
7
7
  GEM = "ohai"
8
- GEM_VERSION = "0.5.4"
8
+ GEM_VERSION = "0.5.6"
9
9
  AUTHOR = "Adam Jacob"
10
10
  EMAIL = "adam@opscode.com"
11
11
  HOMEPAGE = "http://wiki.opscode.com/display/ohai"
data/lib/ohai.rb CHANGED
@@ -20,5 +20,5 @@ require 'ohai/config'
20
20
  require 'ohai/system'
21
21
 
22
22
  module Ohai
23
- VERSION = '0.5.4'
23
+ VERSION = '0.5.6'
24
24
  end
@@ -0,0 +1,107 @@
1
+ #
2
+ # Author:: Doug MacEachern <dougm@vmware.com>
3
+ # Copyright:: Copyright (c) 2010 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
+ require 'rbconfig'
20
+
21
+ provides "languages/c"
22
+
23
+ require_plugin "languages"
24
+
25
+ c = Mash.new
26
+
27
+ #gcc
28
+ status, stdout, stderr = run_command(:no_status_check => true, :command => "gcc -v")
29
+ if status == 0
30
+ description = stderr.split($/).last
31
+ output = description.split
32
+ if output.length >= 3
33
+ c[:gcc] = Mash.new
34
+ c[:gcc][:version] = output[2]
35
+ c[:gcc][:description] = description
36
+ end
37
+ end
38
+
39
+ #glibc
40
+ status, stdout, stderr = run_command(:no_status_check => true, :command => "/lib/libc.so.6")
41
+ if status == 0
42
+ description = stdout.split($/).first
43
+ if description =~ /(\d+\.\d+\.\d+)/
44
+ c[:glibc] = Mash.new
45
+ c[:glibc][:version] = $1
46
+ c[:glibc][:description] = description
47
+ end
48
+ end
49
+
50
+ #ms cl
51
+ status, stdout, stderr = run_command(:no_status_check => true, :command => "cl /?")
52
+ if status == 0
53
+ description = stderr.split($/).first
54
+ if description =~ /Compiler Version ([\d\.]+)/
55
+ c[:cl] = Mash.new
56
+ c[:cl][:version] = $1
57
+ c[:cl][:description] = description
58
+ end
59
+ end
60
+
61
+ #ms vs
62
+ status, stdout, stderr = run_command(:no_status_check => true, :command => "devenv.com /?")
63
+ if status == 0
64
+ lines = stdout.split($/)
65
+ description = lines[0].length == 0 ? lines[1] : lines[0]
66
+ if description =~ /Visual Studio Version ([\d\.]+)/
67
+ c[:vs] = Mash.new
68
+ c[:vs][:version] = $1.chop
69
+ c[:vs][:description] = description
70
+ end
71
+ end
72
+
73
+ #ibm xlc
74
+ status, stdout, stderr = run_command(:no_status_check => true, :command => "xlc -qversion")
75
+ if status == 0
76
+ lines = stdout.split($/)
77
+ if lines.size >= 2
78
+ c[:xlc] = Mash.new
79
+ c[:xlc][:version] = lines[1].split.last
80
+ c[:xlc][:description] = lines[0]
81
+ end
82
+ end
83
+
84
+ #sun pro
85
+ status, stdout, stderr = run_command(:no_status_check => true, :command => "cc -V -flags")
86
+ if status == 0
87
+ output = stderr.split
88
+ if output.size >= 4
89
+ c[:sunpro] = Mash.new
90
+ c[:sunpro][:version] = output[3]
91
+ c[:sunpro][:description] = stderr.chomp
92
+ end
93
+ end
94
+
95
+ #hpux cc
96
+ status, stdout, stderr = run_command(:no_status_check => true, :command => "what /opt/ansic/bin/cc")
97
+ if status == 0
98
+ description = stdout.split($/).select { |line| line =~ /HP C Compiler/ }.first
99
+ if description
100
+ output = description.split
101
+ c[:hpcc] = Mash.new
102
+ c[:hpcc][:version] = output[1] if output.size >= 1
103
+ c[:hpcc][:description] = description.strip
104
+ end
105
+ end
106
+
107
+ languages[:c] = c if c.keys.length > 0
@@ -29,6 +29,7 @@ require_plugin "network"
29
29
  EC2_METADATA_ADDR = "169.254.169.254" unless defined?(EC2_METADATA_ADDR)
30
30
  EC2_METADATA_URL = "http://#{EC2_METADATA_ADDR}/2008-02-01/meta-data" unless defined?(EC2_METADATA_URL)
31
31
  EC2_USERDATA_URL = "http://#{EC2_METADATA_ADDR}/2008-02-01/user-data" unless defined?(EC2_USERDATA_URL)
32
+ EC2_ARRAY_VALUES = %w(security-groups)
32
33
 
33
34
  def can_metadata_connect?(addr, port, timeout=2)
34
35
  t = Socket.new(Socket::Constants::AF_INET, Socket::Constants::SOCK_STREAM, 0)
@@ -69,8 +70,12 @@ def metadata(id='')
69
70
  OpenURI.open_uri("#{EC2_METADATA_URL}/#{id}").read.split("\n").each do |o|
70
71
  key = "#{id}#{o.gsub(/\=.*$/, '/')}"
71
72
  if key[-1..-1] != '/'
72
- ec2[key.gsub(/\-|\//, '_').to_sym] =
73
- OpenURI.open_uri("#{EC2_METADATA_URL}/#{key}").read
73
+ ec2[key.gsub(/\-|\//, '_').to_sym] =
74
+ if EC2_ARRAY_VALUES.include? key
75
+ OpenURI.open_uri("#{EC2_METADATA_URL}/#{key}").read.split("\n")
76
+ else
77
+ OpenURI.open_uri("#{EC2_METADATA_URL}/#{key}").read
78
+ end
74
79
  else
75
80
  metadata(key)
76
81
  end
@@ -25,12 +25,12 @@ if File.exists?("/sys/block")
25
25
  block[dir] = Mash.new
26
26
  %w{size removable}.each do |check|
27
27
  if File.exists?("/sys/block/#{dir}/#{check}")
28
- block[dir][check] = File.read("/sys/block/#{dir}/#{check}").chomp
28
+ File.open("/sys/block/#{dir}/#{check}") { |f| block[dir][check] = f.read_nonblock(1024).strip }
29
29
  end
30
30
  end
31
31
  %w{model rev state timeout vendor}.each do |check|
32
32
  if File.exists?("/sys/block/#{dir}/device/#{check}")
33
- block[dir][check] = File.read("/sys/block/#{dir}/device/#{check}").chomp
33
+ File.open("/sys/block/#{dir}/device/#{check}") { |f| block[dir][check] = f.read_nonblock(1024).strip }
34
34
  end
35
35
  end
36
36
  end
@@ -37,7 +37,7 @@ popen4("ifconfig -a") do |pid, stdin, stdout, stderr|
37
37
  cint = nil
38
38
  stdout.each do |line|
39
39
  tmp_addr = nil
40
- if line =~ /^([0-9a-zA-Z\.\:\-]+)\s+/
40
+ if line =~ /^([0-9a-zA-Z\.\:\-_]+)\s+/
41
41
  cint = $1
42
42
  iface[cint] = Mash.new
43
43
  if cint =~ /^(\w+)(\d+.*)/
@@ -0,0 +1,47 @@
1
+ #
2
+ # Author:: Doug MacEachern <dougm@vmware.com>
3
+ # Copyright:: Copyright (c) 2010 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
+ require 'ruby-wmi'
20
+
21
+ provides "cpu"
22
+
23
+ cpuinfo = Mash.new
24
+ cpu_number = 0
25
+ index = 0
26
+
27
+ WMI::Win32_Processor.find(:all).each do |processor|
28
+ cpu_number += processor.numberofcores
29
+ current_cpu = index.to_s
30
+ index += 1
31
+ cpuinfo[current_cpu] = Mash.new
32
+ cpuinfo[current_cpu]["vendor_id"] = processor.manufacturer
33
+ cpuinfo[current_cpu]["family"] = processor.family.to_s
34
+ cpuinfo[current_cpu]["model"] = processor.revision.to_s
35
+ cpuinfo[current_cpu]["stepping"] = processor.stepping
36
+ cpuinfo[current_cpu]["physical_id"] = processor.deviceid
37
+ #cpuinfo[current_cpu]["core_id"] = XXX
38
+ cpuinfo[current_cpu]["cores"] = processor.numberofcores
39
+ cpuinfo[current_cpu]["model_name"] = processor.description
40
+ cpuinfo[current_cpu]["mhz"] = processor.maxclockspeed.to_s
41
+ cpuinfo[current_cpu]["cache_size"] = "#{processor.l2cachesize} KB"
42
+ #cpuinfo[current_cpu]["flags"] = XXX
43
+ end
44
+
45
+ cpu cpuinfo
46
+ cpu[:total] = cpu_number
47
+ cpu[:real] = index
@@ -21,5 +21,13 @@ require 'socket'
21
21
 
22
22
  host = WMI::Win32_ComputerSystem.find(:first)
23
23
  hostname "#{host.Name}"
24
- #hostname "#{Socket.gethostname}"
25
- fqdn "#{Socket.gethostbyname(Socket.gethostname).first}"
24
+
25
+ info = Socket.gethostbyname(Socket.gethostname)
26
+ if info.first =~ /.+?\.(.*)/
27
+ fqdn info.first
28
+ else
29
+ #host is not in dns. optionally use:
30
+ #C:\WINDOWS\system32\drivers\etc\hosts
31
+ fqdn Socket.gethostbyaddr(info.last).first
32
+ end
33
+
@@ -0,0 +1,256 @@
1
+ #
2
+ # Author:: Doug MacEachern <dougm@vmware.com>
3
+ # Copyright:: Copyright (c) 2010 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
+ require 'rbconfig'
20
+
21
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '/spec_helper.rb'))
22
+
23
+ C_GCC = <<EOF
24
+ Reading specs from /usr/lib/gcc/x86_64-redhat-linux/3.4.6/specs
25
+ Configured with: ../configure --prefix=/usr ... --host=x86_64-redhat-linux
26
+ Thread model: posix
27
+ gcc version 3.4.6 20060404 (Red Hat 3.4.6-3)
28
+ EOF
29
+
30
+ C_GLIBC = <<EOF
31
+ GNU C Library stable release version 2.3.4, by Roland McGrath et al.
32
+ Copyright (C) 2005 Free Software Foundation, Inc.
33
+ This is free software; see the source for copying conditions.
34
+ There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
35
+ PARTICULAR PURPOSE.
36
+ Compiled by GNU CC version 3.4.6 20060404 (Red Hat 3.4.6-3).
37
+ Compiled on a Linux 2.4.20 system on 2006-08-12.
38
+ Available extensions:
39
+ GNU libio by Per Bothner
40
+ crypt add-on version 2.1 by Michael Glad and others
41
+ linuxthreads-0.10 by Xavier Leroy
42
+ The C stubs add-on version 2.1.2.
43
+ BIND-8.2.3-T5B
44
+ NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk
45
+ Glibc-2.0 compatibility add-on by Cristian Gafton
46
+ GNU Libidn by Simon Josefsson
47
+ libthread_db work sponsored by Alpha Processor Inc
48
+ Thread-local storage support included.
49
+ For bug reporting instructions, please see:
50
+ <http://www.gnu.org/software/libc/bugs.html>.
51
+ EOF
52
+
53
+ C_CL = <<EOF
54
+ Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86
55
+ Copyright (C) Microsoft Corporation. All rights reserved.
56
+ EOF
57
+
58
+ C_VS = <<EOF
59
+
60
+ Microsoft (R) Visual Studio Version 8.0.50727.762.
61
+ Copyright (C) Microsoft Corp 1984-2005. All rights reserved.
62
+ EOF
63
+
64
+ C_XLC = <<EOF
65
+ IBM XL C/C++ Enterprise Edition for AIX, V9.0
66
+ Version: 09.00.0000.0000
67
+ EOF
68
+
69
+ C_SUN = <<EOF
70
+ cc: Sun C 5.8 Patch 121016-06 2007/08/01
71
+ EOF
72
+
73
+ C_HPUX = <<EOF
74
+ /opt/ansic/bin/cc:
75
+ $Revision: 92453-07 linker linker crt0.o B.11.47 051104 $
76
+ LINT B.11.11.16 CXREF B.11.11.16
77
+ HP92453-01 B.11.11.16 HP C Compiler
78
+ $ PATCH/11.00:PHCO_27774 Oct 3 2002 09:45:59 $
79
+ EOF
80
+
81
+ describe Ohai::System, "plugin c" do
82
+
83
+ before(:each) do
84
+ @ohai = Ohai::System.new
85
+ @ohai[:languages] = Mash.new
86
+ @ohai.stub!(:require_plugin).and_return(true)
87
+ #gcc
88
+ @ohai.stub!(:run_command).with({:no_status_check=>true, :command=>"gcc -v"}).and_return([0, "", C_GCC])
89
+ #glibc
90
+ @ohai.stub!(:run_command).with({:no_status_check=>true, :command=>"/lib/libc.so.6"}).and_return([0, C_GLIBC, ""])
91
+ #ms cl
92
+ @ohai.stub!(:run_command).with({:no_status_check=>true, :command=>"cl /\?"}).and_return([0, "", C_CL])
93
+ #ms vs
94
+ @ohai.stub!(:run_command).with({:no_status_check=>true, :command=>"devenv.com /\?"}).and_return([0, C_VS, ""])
95
+ #ibm xlc
96
+ @ohai.stub!(:run_command).with({:no_status_check=>true, :command=>"xlc -qversion"}).and_return([0, C_XLC, ""])
97
+ #sun pro
98
+ @ohai.stub!(:run_command).with({:no_status_check=>true, :command=>"cc -V -flags"}).and_return([0, "", C_SUN])
99
+ #hpux cc
100
+ @ohai.stub!(:run_command).with({:no_status_check=>true, :command=>"what /opt/ansic/bin/cc"}).and_return([0, C_HPUX, ""])
101
+ end
102
+
103
+ #gcc
104
+ it "should get the gcc version from running gcc -v" do
105
+ @ohai.should_receive(:run_command).with({:no_status_check=>true, :command=>"gcc -v"}).and_return([0, "", C_GCC])
106
+ @ohai._require_plugin("c")
107
+ end
108
+
109
+ it "should set languages[:c][:gcc][:version]" do
110
+ @ohai._require_plugin("c")
111
+ @ohai.languages[:c][:gcc][:version].should eql("3.4.6")
112
+ end
113
+
114
+ it "should set languages[:c][:gcc][:description]" do
115
+ @ohai._require_plugin("c")
116
+ @ohai.languages[:c][:gcc][:description].should eql(C_GCC.split($/).last)
117
+ end
118
+
119
+ it "should not set the languages[:c][:gcc] tree up if gcc command fails" do
120
+ @ohai.stub!(:run_command).with({:no_status_check=>true, :command=>"gcc -v"}).and_return([1, "", ""])
121
+ @ohai._require_plugin("c")
122
+ @ohai[:languages][:c].should_not have_key(:gcc) if @ohai[:languages][:c]
123
+ end
124
+
125
+ #glibc
126
+ it "should get the glibc version from running gcc -v" do
127
+ @ohai.should_receive(:run_command).with({:no_status_check=>true, :command=>"/lib/libc.so.6"}).and_return([0, C_GLIBC, ""])
128
+ @ohai._require_plugin("c")
129
+ end
130
+
131
+ it "should set languages[:c][:glibc][:version]" do
132
+ @ohai._require_plugin("c")
133
+ @ohai.languages[:c][:glibc][:version].should eql("2.3.4")
134
+ end
135
+
136
+ it "should set languages[:c][:glibc][:description]" do
137
+ @ohai._require_plugin("c")
138
+ @ohai.languages[:c][:glibc][:description].should eql(C_GLIBC.split($/).first)
139
+ end
140
+
141
+ it "should not set the languages[:c][:glibc] tree up if glibc command fails" do
142
+ @ohai.stub!(:run_command).with({:no_status_check=>true, :command=>"/lib/libc.so.6"}).and_return([1, "", ""])
143
+ @ohai._require_plugin("c")
144
+ @ohai[:languages][:c].should_not have_key(:glibc) if @ohai[:languages][:c]
145
+ end
146
+
147
+ #ms cl
148
+ it "should get the cl version from running cl /?" do
149
+ @ohai.should_receive(:run_command).with({:no_status_check=>true, :command=>"cl /\?"}).and_return([0, "", C_CL])
150
+ @ohai._require_plugin("c")
151
+ end
152
+
153
+ it "should set languages[:c][:cl][:version]" do
154
+ @ohai._require_plugin("c")
155
+ @ohai.languages[:c][:cl][:version].should eql("14.00.50727.762")
156
+ end
157
+
158
+ it "should set languages[:c][:cl][:description]" do
159
+ @ohai._require_plugin("c")
160
+ @ohai.languages[:c][:cl][:description].should eql(C_CL.split($/).first)
161
+ end
162
+
163
+ it "should not set the languages[:c][:cl] tree up if cl command fails" do
164
+ @ohai.stub!(:run_command).with({:no_status_check=>true, :command=>"cl /\?"}).and_return([1, "", ""])
165
+ @ohai._require_plugin("c")
166
+ @ohai[:languages][:c].should_not have_key(:cl) if @ohai[:languages][:c]
167
+ end
168
+
169
+ #ms vs
170
+ it "should get the vs version from running devenv.com /?" do
171
+ @ohai.should_receive(:run_command).with({:no_status_check=>true, :command=>"devenv.com /\?"}).and_return([0, C_VS, ""])
172
+ @ohai._require_plugin("c")
173
+ end
174
+
175
+ it "should set languages[:c][:vs][:version]" do
176
+ @ohai._require_plugin("c")
177
+ @ohai.languages[:c][:vs][:version].should eql("8.0.50727.762")
178
+ end
179
+
180
+ it "should set languages[:c][:vs][:description]" do
181
+ @ohai._require_plugin("c")
182
+ @ohai.languages[:c][:vs][:description].should eql(C_VS.split($/)[1])
183
+ end
184
+
185
+ it "should not set the languages[:c][:vs] tree up if devenv command fails" do
186
+ @ohai.stub!(:run_command).with({:no_status_check=>true, :command=>"devenv.com /\?"}).and_return([1, "", ""])
187
+ @ohai._require_plugin("c")
188
+ @ohai[:languages][:c].should_not have_key(:vs) if @ohai[:languages][:c]
189
+ end
190
+
191
+ #ibm xlc
192
+ it "should get the xlc version from running xlc -qversion" do
193
+ @ohai.should_receive(:run_command).with({:no_status_check=>true, :command=>"xlc -qversion"}).and_return([0, C_XLC, ""])
194
+ @ohai._require_plugin("c")
195
+ end
196
+
197
+ it "should set languages[:c][:xlc][:version]" do
198
+ @ohai._require_plugin("c")
199
+ @ohai.languages[:c][:xlc][:version].should eql("09.00.0000.0000")
200
+ end
201
+
202
+ it "should set languages[:c][:xlc][:description]" do
203
+ @ohai._require_plugin("c")
204
+ @ohai.languages[:c][:xlc][:description].should eql(C_XLC.split($/).first)
205
+ end
206
+
207
+ it "should not set the languages[:c][:xlc] tree up if xlc command fails" do
208
+ @ohai.stub!(:run_command).with({:no_status_check=>true, :command=>"xlc -qversion"}).and_return([1, "", ""])
209
+ @ohai._require_plugin("c")
210
+ @ohai[:languages][:c].should_not have_key(:xlc) if @ohai[:languages][:c]
211
+ end
212
+
213
+ #sun pro
214
+ it "should get the cc version from running cc -V -flags" do
215
+ @ohai.should_receive(:run_command).with({:no_status_check=>true, :command=>"cc -V -flags"}).and_return([0, "", C_SUN])
216
+ @ohai._require_plugin("c")
217
+ end
218
+
219
+ it "should set languages[:c][:sunpro][:version]" do
220
+ @ohai._require_plugin("c")
221
+ @ohai.languages[:c][:sunpro][:version].should eql("5.8")
222
+ end
223
+
224
+ it "should set languages[:c][:sunpro][:description]" do
225
+ @ohai._require_plugin("c")
226
+ @ohai.languages[:c][:sunpro][:description].should eql(C_SUN.chomp)
227
+ end
228
+
229
+ it "should not set the languages[:c][:sunpro] tree up if cc command fails" do
230
+ @ohai.stub!(:run_command).with({:no_status_check=>true, :command=>"cc -V -flags"}).and_return([1, "", ""])
231
+ @ohai._require_plugin("c")
232
+ @ohai[:languages][:c].should_not have_key(:sunpro) if @ohai[:languages][:c]
233
+ end
234
+
235
+ #hpux cc
236
+ it "should get the cc version from running what cc" do
237
+ @ohai.should_receive(:run_command).with({:no_status_check=>true, :command=>"what /opt/ansic/bin/cc"}).and_return([0, C_HPUX, ""])
238
+ @ohai._require_plugin("c")
239
+ end
240
+
241
+ it "should set languages[:c][:hpcc][:version]" do
242
+ @ohai._require_plugin("c")
243
+ @ohai.languages[:c][:hpcc][:version].should eql("B.11.11.16")
244
+ end
245
+
246
+ it "should set languages[:c][:hpcc][:description]" do
247
+ @ohai._require_plugin("c")
248
+ @ohai.languages[:c][:hpcc][:description].should eql(C_HPUX.split($/)[3].strip)
249
+ end
250
+
251
+ it "should not set the languages[:c][:hpcc] tree up if cc command fails" do
252
+ @ohai.stub!(:run_command).with({:no_status_check=>true, :command=>"what /opt/ansic/bin/cc"}).and_return([1, "", ""])
253
+ @ohai._require_plugin("c")
254
+ @ohai[:languages][:c].should_not have_key(:hpcc) if @ohai[:languages][:c]
255
+ end
256
+ end
@@ -38,13 +38,16 @@ describe Ohai::System, "plugin ec2" do
38
38
  before(:each) do
39
39
  OpenURI.stub!(:open_uri).
40
40
  with("http://169.254.169.254/2008-02-01/meta-data/").
41
- and_return(mock(IO, :read => "instance_type\nami_id\n"))
41
+ and_return(mock(IO, :read => "instance_type\nami_id\nsecurity-groups"))
42
42
  OpenURI.stub!(:open_uri).
43
43
  with("http://169.254.169.254/2008-02-01/meta-data/instance_type").
44
44
  and_return(mock(IO, :read => "c1.medium"))
45
45
  OpenURI.stub!(:open_uri).
46
46
  with("http://169.254.169.254/2008-02-01/meta-data/ami_id").
47
47
  and_return(mock(IO, :read => "ami-5d2dc934"))
48
+ OpenURI.stub!(:open_uri).
49
+ with("http://169.254.169.254/2008-02-01/meta-data/security-groups").
50
+ and_return(mock(IO, :read => "group1\ngroup2"))
48
51
  OpenURI.stub!(:open_uri).
49
52
  with("http://169.254.169.254/2008-02-01/user-data/").
50
53
  and_return(mock(IO, :gets => "By the pricking of my thumb..."))
@@ -59,6 +62,7 @@ describe Ohai::System, "plugin ec2" do
59
62
  @ohai[:ec2].should_not be_nil
60
63
  @ohai[:ec2]['instance_type'].should == "c1.medium"
61
64
  @ohai[:ec2]['ami_id'].should == "ami-5d2dc934"
65
+ @ohai[:ec2]['security_groups'].should eql ['group1', 'group2']
62
66
  end
63
67
  end
64
68
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 4
9
- version: 0.5.4
8
+ - 6
9
+ version: 0.5.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Adam Jacob
@@ -14,7 +14,7 @@ autorequire: ohai
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-11 00:00:00 -07:00
17
+ date: 2010-06-20 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -126,6 +126,7 @@ files:
126
126
  - lib/ohai/plugins/aix/ps.rb
127
127
  - lib/ohai/plugins/aix/ssh_host_key.rb
128
128
  - lib/ohai/plugins/aix/uptime.rb
129
+ - lib/ohai/plugins/c.rb
129
130
  - lib/ohai/plugins/chef.rb
130
131
  - lib/ohai/plugins/cloud.rb
131
132
  - lib/ohai/plugins/command.rb
@@ -232,6 +233,7 @@ files:
232
233
  - lib/ohai/plugins/solaris2/ssh_host_key.rb
233
234
  - lib/ohai/plugins/uptime.rb
234
235
  - lib/ohai/plugins/virtualization.rb
236
+ - lib/ohai/plugins/windows/cpu.rb
235
237
  - lib/ohai/plugins/windows/filesystem.rb
236
238
  - lib/ohai/plugins/windows/hostname.rb
237
239
  - lib/ohai/plugins/windows/kernel.rb
@@ -241,6 +243,7 @@ files:
241
243
  - lib/ohai.rb
242
244
  - spec/ohai/mixin/command_spec.rb
243
245
  - spec/ohai/mixin/from_file_spec.rb
246
+ - spec/ohai/plugins/c_spec.rb
244
247
  - spec/ohai/plugins/chef_spec.rb
245
248
  - spec/ohai/plugins/cloud_spec.rb
246
249
  - spec/ohai/plugins/darwin/hostname_spec.rb
@@ -318,7 +321,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
318
321
  requirements: []
319
322
 
320
323
  rubyforge_project:
321
- rubygems_version: 1.3.6.1
324
+ rubygems_version: 1.3.7
322
325
  signing_key:
323
326
  specification_version: 3
324
327
  summary: Ohai profiles your system and emits JSON