rightscale-ohai 0.3.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +201 -0
- data/README.rdoc +98 -0
- data/Rakefile +59 -0
- data/bin/ohai +78 -0
- data/lib/ohai/config.rb +118 -0
- data/lib/ohai/exception.rb +23 -0
- data/lib/ohai/log/formatter.rb +57 -0
- data/lib/ohai/log.rb +89 -0
- data/lib/ohai/mixin/command.rb +203 -0
- data/lib/ohai/mixin/from_file.rb +36 -0
- data/lib/ohai/mixin/string.rb +29 -0
- data/lib/ohai/plugins/cloud.rb +35 -0
- data/lib/ohai/plugins/command.rb +21 -0
- data/lib/ohai/plugins/darwin/filesystem.rb +57 -0
- data/lib/ohai/plugins/darwin/hostname.rb +22 -0
- data/lib/ohai/plugins/darwin/kernel.rb +37 -0
- data/lib/ohai/plugins/darwin/network.rb +187 -0
- data/lib/ohai/plugins/darwin/platform.rb +36 -0
- data/lib/ohai/plugins/darwin/ps.rb +23 -0
- data/lib/ohai/plugins/darwin/ssh_host_key.rb +25 -0
- data/lib/ohai/plugins/darwin/system_profiler.rb +33 -0
- data/lib/ohai/plugins/darwin/uptime.rb +32 -0
- data/lib/ohai/plugins/dmi.rb +59 -0
- data/lib/ohai/plugins/ec2.rb +100 -0
- data/lib/ohai/plugins/erlang.rb +40 -0
- data/lib/ohai/plugins/freebsd/cpu.rb +52 -0
- data/lib/ohai/plugins/freebsd/filesystem.rb +57 -0
- data/lib/ohai/plugins/freebsd/hostname.rb +22 -0
- data/lib/ohai/plugins/freebsd/kernel.rb +37 -0
- data/lib/ohai/plugins/freebsd/memory.rb +50 -0
- data/lib/ohai/plugins/freebsd/network.rb +112 -0
- data/lib/ohai/plugins/freebsd/platform.rb +23 -0
- data/lib/ohai/plugins/freebsd/ps.rb +24 -0
- data/lib/ohai/plugins/freebsd/ssh_host_key.rb +26 -0
- data/lib/ohai/plugins/freebsd/uptime.rb +32 -0
- data/lib/ohai/plugins/freebsd/virtualization.rb +66 -0
- data/lib/ohai/plugins/hostname.rb +27 -0
- data/lib/ohai/plugins/java.rb +36 -0
- data/lib/ohai/plugins/kernel.rb +33 -0
- data/lib/ohai/plugins/keys.rb +22 -0
- data/lib/ohai/plugins/languages.rb +21 -0
- data/lib/ohai/plugins/linux/block_device.rb +38 -0
- data/lib/ohai/plugins/linux/cpu.rb +60 -0
- data/lib/ohai/plugins/linux/filesystem.rb +57 -0
- data/lib/ohai/plugins/linux/hostname.rb +26 -0
- data/lib/ohai/plugins/linux/kernel.rb +33 -0
- data/lib/ohai/plugins/linux/lsb.rb +38 -0
- data/lib/ohai/plugins/linux/memory.rb +83 -0
- data/lib/ohai/plugins/linux/network.rb +112 -0
- data/lib/ohai/plugins/linux/platform.rb +43 -0
- data/lib/ohai/plugins/linux/ps.rb +23 -0
- data/lib/ohai/plugins/linux/ssh_host_key.rb +26 -0
- data/lib/ohai/plugins/linux/uptime.rb +28 -0
- data/lib/ohai/plugins/linux/virtualization.rb +77 -0
- data/lib/ohai/plugins/network.rb +52 -0
- data/lib/ohai/plugins/ohai_time.rb +21 -0
- data/lib/ohai/plugins/os.rb +43 -0
- data/lib/ohai/plugins/perl.rb +37 -0
- data/lib/ohai/plugins/platform.rb +25 -0
- data/lib/ohai/plugins/python.rb +37 -0
- data/lib/ohai/plugins/rightscale.rb +53 -0
- data/lib/ohai/plugins/ruby.rb +37 -0
- data/lib/ohai/plugins/solaris2/cpu.rb +33 -0
- data/lib/ohai/plugins/solaris2/hostname.rb +22 -0
- data/lib/ohai/plugins/solaris2/kernel.rb +21 -0
- data/lib/ohai/plugins/solaris2/network.rb +141 -0
- data/lib/ohai/plugins/solaris2/platform.rb +33 -0
- data/lib/ohai/plugins/solaris2/ps.rb +23 -0
- data/lib/ohai/plugins/solaris2/ssh_host_key.rb +26 -0
- data/lib/ohai/plugins/uptime.rb +42 -0
- data/lib/ohai/plugins/virtualization.rb +86 -0
- data/lib/ohai/plugins/windows/filesystem.rb +44 -0
- data/lib/ohai/plugins/windows/hostname.rb +25 -0
- data/lib/ohai/plugins/windows/kernel.rb +75 -0
- data/lib/ohai/plugins/windows/network.rb +114 -0
- data/lib/ohai/plugins/windows/platform.rb +26 -0
- data/lib/ohai/system.rb +226 -0
- data/lib/ohai.rb +27 -0
- data/spec/ohai/log/log_formatter_spec.rb +50 -0
- data/spec/ohai/log_spec.rb +63 -0
- data/spec/ohai/mixin/from_file_spec.rb +53 -0
- data/spec/ohai/plugins/cloud_spec.rb +64 -0
- data/spec/ohai/plugins/darwin/hostname_spec.rb +34 -0
- data/spec/ohai/plugins/darwin/kernel_spec.rb +46 -0
- data/spec/ohai/plugins/darwin/platform_spec.rb +67 -0
- data/spec/ohai/plugins/dmi_spec.rb +73 -0
- data/spec/ohai/plugins/ec2_spec.rb +77 -0
- data/spec/ohai/plugins/erlang_spec.rb +63 -0
- data/spec/ohai/plugins/freebsd/hostname_spec.rb +34 -0
- data/spec/ohai/plugins/freebsd/kernel_spec.rb +37 -0
- data/spec/ohai/plugins/freebsd/platform_spec.rb +40 -0
- data/spec/ohai/plugins/hostname_spec.rb +39 -0
- data/spec/ohai/plugins/java_spec.rb +70 -0
- data/spec/ohai/plugins/kernel_spec.rb +43 -0
- data/spec/ohai/plugins/linux/cpu_spec.rb +128 -0
- data/spec/ohai/plugins/linux/hostname_spec.rb +52 -0
- data/spec/ohai/plugins/linux/kernel_spec.rb +31 -0
- data/spec/ohai/plugins/linux/lsb_spec.rb +60 -0
- data/spec/ohai/plugins/linux/platform_spec.rb +81 -0
- data/spec/ohai/plugins/linux/uptime_spec.rb +61 -0
- data/spec/ohai/plugins/linux/virtualization_spec.rb +131 -0
- data/spec/ohai/plugins/ohai_time_spec.rb +46 -0
- data/spec/ohai/plugins/os_spec.rb +58 -0
- data/spec/ohai/plugins/perl_spec.rb +89 -0
- data/spec/ohai/plugins/platform_spec.rb +56 -0
- data/spec/ohai/plugins/python_spec.rb +53 -0
- data/spec/ohai/plugins/rightscale_spec.rb +71 -0
- data/spec/ohai/plugins/ruby_spec.rb +51 -0
- data/spec/ohai/system_spec.rb +130 -0
- data/spec/ohai_spec.rb +27 -0
- data/spec/rcov.opts +2 -0
- data/spec/spec.opts +2 -0
- data/spec/spec_helper.rb +66 -0
- metadata +209 -0
data/spec/ohai_spec.rb
ADDED
@@ -0,0 +1,27 @@
|
|
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.dirname(__FILE__) + '/spec_helper.rb'
|
20
|
+
|
21
|
+
describe Ohai do
|
22
|
+
|
23
|
+
it "should have a version constant defined" do
|
24
|
+
Ohai::VERSION.should be_a_kind_of(String)
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
data/spec/rcov.opts
ADDED
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
begin
|
2
|
+
require 'spec'
|
3
|
+
rescue LoadError
|
4
|
+
require 'rubygems'
|
5
|
+
gem 'rspec'
|
6
|
+
require 'spec'
|
7
|
+
end
|
8
|
+
|
9
|
+
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
10
|
+
require 'ohai'
|
11
|
+
Ohai::Config[:log_level] = :error
|
12
|
+
|
13
|
+
def it_should_check_from(plugin, attribute, from, value)
|
14
|
+
it "should get the #{attribute} value from '#{from}'" do
|
15
|
+
@ohai.should_receive(:from).with(from).and_return(value)
|
16
|
+
@ohai._require_plugin(plugin)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should set the #{attribute} to the value from '#{from}'" do
|
20
|
+
@ohai._require_plugin(plugin)
|
21
|
+
@ohai[attribute].should == value
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def it_should_check_from_mash(plugin, attribute, from, value)
|
26
|
+
it "should get the #{plugin}[:#{attribute}] value from '#{from}'" do
|
27
|
+
@ohai.should_receive(:from).with(from).and_return(value)
|
28
|
+
@ohai._require_plugin(plugin)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should set the #{plugin}[:#{attribute}] to the value from '#{from}'" do
|
32
|
+
@ohai._require_plugin(plugin)
|
33
|
+
@ohai[plugin][attribute].should == value
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# the mash variable may be an array listing multiple levels of Mash hierarchy
|
38
|
+
def it_should_check_from_deep_mash(plugin, mash, attribute, from, value)
|
39
|
+
it "should get the #{mash.inspect}[:#{attribute}] value from '#{from}'" do
|
40
|
+
@ohai.should_receive(:from).with(from).and_return(value)
|
41
|
+
@ohai._require_plugin(plugin)
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should set the #{mash.inspect}[:#{attribute}] to the value from '#{from}'" do
|
45
|
+
@ohai._require_plugin(plugin)
|
46
|
+
if mash.is_a?(String)
|
47
|
+
@ohai[mash][attribute].should == value
|
48
|
+
elsif mash.is_a?(Array)
|
49
|
+
if mash.length == 2
|
50
|
+
@ohai[mash[0]][mash[1]][attribute].should == value
|
51
|
+
elsif mash.length == 3
|
52
|
+
@ohai[mash[0]][mash[1]][mash[2]][attribute].should == value
|
53
|
+
else
|
54
|
+
return nil
|
55
|
+
end
|
56
|
+
else
|
57
|
+
return nil
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
module SimpleFromFile
|
63
|
+
def from_file(filename)
|
64
|
+
self.instance_eval(IO.read(filename), filename, 1)
|
65
|
+
end
|
66
|
+
end
|
metadata
ADDED
@@ -0,0 +1,209 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rightscale-ohai
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.3.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Adam Jacob
|
8
|
+
autorequire: ohai
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-05-16 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: json
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: extlib
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: systemu
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: "0"
|
44
|
+
version:
|
45
|
+
description: Ohai profiles your system and emits JSON
|
46
|
+
email: adam@opscode.com
|
47
|
+
executables:
|
48
|
+
- ohai
|
49
|
+
extensions: []
|
50
|
+
|
51
|
+
extra_rdoc_files: []
|
52
|
+
|
53
|
+
files:
|
54
|
+
- LICENSE
|
55
|
+
- README.rdoc
|
56
|
+
- Rakefile
|
57
|
+
- lib/ohai.rb
|
58
|
+
- lib/ohai
|
59
|
+
- lib/ohai/config.rb
|
60
|
+
- lib/ohai/log
|
61
|
+
- lib/ohai/log/formatter.rb
|
62
|
+
- lib/ohai/system.rb
|
63
|
+
- lib/ohai/exception.rb
|
64
|
+
- lib/ohai/mixin
|
65
|
+
- lib/ohai/mixin/from_file.rb
|
66
|
+
- lib/ohai/mixin/string.rb
|
67
|
+
- lib/ohai/mixin/command.rb
|
68
|
+
- lib/ohai/log.rb
|
69
|
+
- lib/ohai/plugins
|
70
|
+
- lib/ohai/plugins/ec2.rb
|
71
|
+
- lib/ohai/plugins/uptime.rb
|
72
|
+
- lib/ohai/plugins/darwin
|
73
|
+
- lib/ohai/plugins/darwin/uptime.rb
|
74
|
+
- lib/ohai/plugins/darwin/platform.rb
|
75
|
+
- lib/ohai/plugins/darwin/ssh_host_key.rb
|
76
|
+
- lib/ohai/plugins/darwin/ps.rb
|
77
|
+
- lib/ohai/plugins/darwin/hostname.rb
|
78
|
+
- lib/ohai/plugins/darwin/system_profiler.rb
|
79
|
+
- lib/ohai/plugins/darwin/filesystem.rb
|
80
|
+
- lib/ohai/plugins/darwin/network.rb
|
81
|
+
- lib/ohai/plugins/darwin/kernel.rb
|
82
|
+
- lib/ohai/plugins/platform.rb
|
83
|
+
- lib/ohai/plugins/solaris2
|
84
|
+
- lib/ohai/plugins/solaris2/platform.rb
|
85
|
+
- lib/ohai/plugins/solaris2/ssh_host_key.rb
|
86
|
+
- lib/ohai/plugins/solaris2/ps.rb
|
87
|
+
- lib/ohai/plugins/solaris2/hostname.rb
|
88
|
+
- lib/ohai/plugins/solaris2/network.rb
|
89
|
+
- lib/ohai/plugins/solaris2/kernel.rb
|
90
|
+
- lib/ohai/plugins/solaris2/cpu.rb
|
91
|
+
- lib/ohai/plugins/hostname.rb
|
92
|
+
- lib/ohai/plugins/erlang.rb
|
93
|
+
- lib/ohai/plugins/windows
|
94
|
+
- lib/ohai/plugins/windows/platform.rb
|
95
|
+
- lib/ohai/plugins/windows/hostname.rb
|
96
|
+
- lib/ohai/plugins/windows/filesystem.rb
|
97
|
+
- lib/ohai/plugins/windows/network.rb
|
98
|
+
- lib/ohai/plugins/windows/kernel.rb
|
99
|
+
- lib/ohai/plugins/ruby.rb
|
100
|
+
- lib/ohai/plugins/rightscale.rb
|
101
|
+
- lib/ohai/plugins/os.rb
|
102
|
+
- lib/ohai/plugins/network.rb
|
103
|
+
- lib/ohai/plugins/python.rb
|
104
|
+
- lib/ohai/plugins/freebsd
|
105
|
+
- lib/ohai/plugins/freebsd/uptime.rb
|
106
|
+
- lib/ohai/plugins/freebsd/platform.rb
|
107
|
+
- lib/ohai/plugins/freebsd/ssh_host_key.rb
|
108
|
+
- lib/ohai/plugins/freebsd/ps.rb
|
109
|
+
- lib/ohai/plugins/freebsd/hostname.rb
|
110
|
+
- lib/ohai/plugins/freebsd/filesystem.rb
|
111
|
+
- lib/ohai/plugins/freebsd/network.rb
|
112
|
+
- lib/ohai/plugins/freebsd/kernel.rb
|
113
|
+
- lib/ohai/plugins/freebsd/cpu.rb
|
114
|
+
- lib/ohai/plugins/freebsd/virtualization.rb
|
115
|
+
- lib/ohai/plugins/freebsd/memory.rb
|
116
|
+
- lib/ohai/plugins/keys.rb
|
117
|
+
- lib/ohai/plugins/command.rb
|
118
|
+
- lib/ohai/plugins/kernel.rb
|
119
|
+
- lib/ohai/plugins/cloud.rb
|
120
|
+
- lib/ohai/plugins/virtualization.rb
|
121
|
+
- lib/ohai/plugins/dmi.rb
|
122
|
+
- lib/ohai/plugins/linux
|
123
|
+
- lib/ohai/plugins/linux/uptime.rb
|
124
|
+
- lib/ohai/plugins/linux/platform.rb
|
125
|
+
- lib/ohai/plugins/linux/ssh_host_key.rb
|
126
|
+
- lib/ohai/plugins/linux/ps.rb
|
127
|
+
- lib/ohai/plugins/linux/hostname.rb
|
128
|
+
- lib/ohai/plugins/linux/filesystem.rb
|
129
|
+
- lib/ohai/plugins/linux/network.rb
|
130
|
+
- lib/ohai/plugins/linux/kernel.rb
|
131
|
+
- lib/ohai/plugins/linux/cpu.rb
|
132
|
+
- lib/ohai/plugins/linux/virtualization.rb
|
133
|
+
- lib/ohai/plugins/linux/memory.rb
|
134
|
+
- lib/ohai/plugins/linux/lsb.rb
|
135
|
+
- lib/ohai/plugins/linux/block_device.rb
|
136
|
+
- lib/ohai/plugins/java.rb
|
137
|
+
- lib/ohai/plugins/languages.rb
|
138
|
+
- lib/ohai/plugins/ohai_time.rb
|
139
|
+
- lib/ohai/plugins/perl.rb
|
140
|
+
- spec/spec.opts
|
141
|
+
- spec/ohai_spec.rb
|
142
|
+
- spec/spec_helper.rb
|
143
|
+
- spec/ohai
|
144
|
+
- spec/ohai/log_spec.rb
|
145
|
+
- spec/ohai/log
|
146
|
+
- spec/ohai/log/log_formatter_spec.rb
|
147
|
+
- spec/ohai/system_spec.rb
|
148
|
+
- spec/ohai/mixin
|
149
|
+
- spec/ohai/mixin/from_file_spec.rb
|
150
|
+
- spec/ohai/plugins
|
151
|
+
- spec/ohai/plugins/cloud_spec.rb
|
152
|
+
- spec/ohai/plugins/dmi_spec.rb
|
153
|
+
- spec/ohai/plugins/hostname_spec.rb
|
154
|
+
- spec/ohai/plugins/darwin
|
155
|
+
- spec/ohai/plugins/darwin/hostname_spec.rb
|
156
|
+
- spec/ohai/plugins/darwin/kernel_spec.rb
|
157
|
+
- spec/ohai/plugins/darwin/platform_spec.rb
|
158
|
+
- spec/ohai/plugins/ec2_spec.rb
|
159
|
+
- spec/ohai/plugins/os_spec.rb
|
160
|
+
- spec/ohai/plugins/ohai_time_spec.rb
|
161
|
+
- spec/ohai/plugins/freebsd
|
162
|
+
- spec/ohai/plugins/freebsd/hostname_spec.rb
|
163
|
+
- spec/ohai/plugins/freebsd/kernel_spec.rb
|
164
|
+
- spec/ohai/plugins/freebsd/platform_spec.rb
|
165
|
+
- spec/ohai/plugins/ruby_spec.rb
|
166
|
+
- spec/ohai/plugins/java_spec.rb
|
167
|
+
- spec/ohai/plugins/kernel_spec.rb
|
168
|
+
- spec/ohai/plugins/linux
|
169
|
+
- spec/ohai/plugins/linux/hostname_spec.rb
|
170
|
+
- spec/ohai/plugins/linux/uptime_spec.rb
|
171
|
+
- spec/ohai/plugins/linux/lsb_spec.rb
|
172
|
+
- spec/ohai/plugins/linux/cpu_spec.rb
|
173
|
+
- spec/ohai/plugins/linux/kernel_spec.rb
|
174
|
+
- spec/ohai/plugins/linux/virtualization_spec.rb
|
175
|
+
- spec/ohai/plugins/linux/platform_spec.rb
|
176
|
+
- spec/ohai/plugins/rightscale_spec.rb
|
177
|
+
- spec/ohai/plugins/python_spec.rb
|
178
|
+
- spec/ohai/plugins/erlang_spec.rb
|
179
|
+
- spec/ohai/plugins/perl_spec.rb
|
180
|
+
- spec/ohai/plugins/platform_spec.rb
|
181
|
+
- spec/rcov.opts
|
182
|
+
has_rdoc: true
|
183
|
+
homepage: http://wiki.opscode.com/display/ohai
|
184
|
+
post_install_message:
|
185
|
+
rdoc_options: []
|
186
|
+
|
187
|
+
require_paths:
|
188
|
+
- lib
|
189
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
190
|
+
requirements:
|
191
|
+
- - ">="
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: "0"
|
194
|
+
version:
|
195
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
196
|
+
requirements:
|
197
|
+
- - ">="
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: "0"
|
200
|
+
version:
|
201
|
+
requirements: []
|
202
|
+
|
203
|
+
rubyforge_project:
|
204
|
+
rubygems_version: 1.2.0
|
205
|
+
signing_key:
|
206
|
+
specification_version: 2
|
207
|
+
summary: Ohai profiles your system and emits JSON
|
208
|
+
test_files: []
|
209
|
+
|