ohai 0.5.2 → 0.5.4
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.
- data/Rakefile +1 -1
- data/bin/ohai +3 -2
- data/lib/ohai.rb +1 -4
- data/lib/ohai/plugins/aix/cpu.rb +19 -0
- data/lib/ohai/plugins/aix/filesystem.rb +19 -0
- data/lib/ohai/plugins/aix/hostname.rb +19 -0
- data/lib/ohai/plugins/aix/memory.rb +19 -0
- data/lib/ohai/plugins/aix/network.rb +19 -0
- data/lib/ohai/plugins/aix/platform.rb +19 -0
- data/lib/ohai/plugins/aix/ps.rb +23 -0
- data/lib/ohai/plugins/aix/ssh_host_key.rb +26 -0
- data/lib/ohai/plugins/aix/uptime.rb +19 -0
- data/lib/ohai/plugins/chef.rb +3 -2
- data/lib/ohai/plugins/hpux/cpu.rb +19 -0
- data/lib/ohai/plugins/hpux/filesystem.rb +19 -0
- data/lib/ohai/plugins/hpux/hostname.rb +19 -0
- data/lib/ohai/plugins/hpux/memory.rb +19 -0
- data/lib/ohai/plugins/hpux/network.rb +19 -0
- data/lib/ohai/plugins/hpux/platform.rb +19 -0
- data/lib/ohai/plugins/hpux/ps.rb +23 -0
- data/lib/ohai/plugins/hpux/ssh_host_key.rb +26 -0
- data/lib/ohai/plugins/hpux/uptime.rb +19 -0
- data/lib/ohai/plugins/ohai.rb +3 -2
- data/lib/ohai/plugins/os.rb +4 -0
- data/lib/ohai/plugins/perl.rb +2 -2
- data/lib/ohai/plugins/ruby.rb +5 -4
- data/lib/ohai/plugins/sigar/cpu.rb +40 -0
- data/lib/ohai/plugins/sigar/filesystem.rb +45 -0
- data/lib/ohai/plugins/sigar/hostname.rb +28 -0
- data/lib/ohai/plugins/sigar/memory.rb +36 -0
- data/lib/ohai/plugins/sigar/network.rb +102 -0
- data/lib/ohai/plugins/sigar/platform.rb +26 -0
- data/lib/ohai/plugins/sigar/uptime.rb +27 -0
- data/lib/ohai/system.rb +6 -4
- data/spec/ohai/mixin/command_spec.rb +1 -0
- data/spec/ohai/plugins/chef_spec.rb +2 -2
- data/spec/ohai/plugins/groovy_spec.rb +1 -1
- data/spec/ohai/plugins/lua_spec.rb +1 -1
- data/spec/ohai/plugins/mono_spec.rb +1 -1
- data/spec/ohai/plugins/ohai_spec.rb +2 -2
- data/spec/ohai/plugins/os_spec.rb +2 -2
- data/spec/ohai/plugins/perl_spec.rb +12 -20
- data/spec/ohai/plugins/php_spec.rb +1 -1
- data/spec/ohai/plugins/ruby_spec.rb +5 -3
- data/spec/ohai/system_spec.rb +4 -2
- metadata +28 -3
data/Rakefile
CHANGED
data/bin/ohai
CHANGED
@@ -19,9 +19,7 @@
|
|
19
19
|
# limitations under the License.
|
20
20
|
#
|
21
21
|
|
22
|
-
require 'rubygems'
|
23
22
|
|
24
|
-
$: << File.join(File.dirname(__FILE__), "..", "lib")
|
25
23
|
begin
|
26
24
|
require 'rubygems'
|
27
25
|
rescue LoadError
|
@@ -29,6 +27,9 @@ rescue LoadError
|
|
29
27
|
missing_rubygems = true
|
30
28
|
end
|
31
29
|
begin
|
30
|
+
# if we're in a source code checkout, we want to run the code from that.
|
31
|
+
# have to do this *after* rubygems is loaded.
|
32
|
+
$:.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib'))
|
32
33
|
require 'ohai/application'
|
33
34
|
rescue LoadError
|
34
35
|
if missing_rubygems
|
data/lib/ohai.rb
CHANGED
@@ -16,12 +16,9 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
$:.unshift(File.dirname(__FILE__)) unless
|
20
|
-
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
21
|
-
|
22
19
|
require 'ohai/config'
|
23
20
|
require 'ohai/system'
|
24
21
|
|
25
22
|
module Ohai
|
26
|
-
VERSION = '0.5.
|
23
|
+
VERSION = '0.5.4'
|
27
24
|
end
|
@@ -0,0 +1,19 @@
|
|
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_plugin "sigar::cpu"
|
@@ -0,0 +1,19 @@
|
|
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_plugin "sigar::filesystem"
|
@@ -0,0 +1,19 @@
|
|
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_plugin "sigar::hostname"
|
@@ -0,0 +1,19 @@
|
|
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_plugin "sigar::memory"
|
@@ -0,0 +1,19 @@
|
|
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_plugin "sigar::network"
|
@@ -0,0 +1,19 @@
|
|
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_plugin "sigar::platform"
|
@@ -0,0 +1,23 @@
|
|
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
|
+
provides "command/ps"
|
20
|
+
|
21
|
+
require_plugin 'command'
|
22
|
+
|
23
|
+
command[:ps] = 'ps -ef'
|
@@ -0,0 +1,26 @@
|
|
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
|
+
provides "keys/ssh"
|
20
|
+
|
21
|
+
require_plugin "keys"
|
22
|
+
|
23
|
+
keys[:ssh] = Mash.new
|
24
|
+
|
25
|
+
keys[:ssh][:host_dsa_public] = IO.read("/etc/ssh/ssh_host_dsa_key.pub").split[1]
|
26
|
+
keys[:ssh][:host_rsa_public] = IO.read("/etc/ssh/ssh_host_rsa_key.pub").split[1]
|
@@ -0,0 +1,19 @@
|
|
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_plugin "sigar::uptime"
|
data/lib/ohai/plugins/chef.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
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_plugin "sigar::cpu"
|
@@ -0,0 +1,19 @@
|
|
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_plugin "sigar::filesystem"
|
@@ -0,0 +1,19 @@
|
|
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_plugin "sigar::hostname"
|
@@ -0,0 +1,19 @@
|
|
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_plugin "sigar::memory"
|
@@ -0,0 +1,19 @@
|
|
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_plugin "sigar::network"
|
@@ -0,0 +1,19 @@
|
|
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_plugin "sigar::platform"
|
@@ -0,0 +1,23 @@
|
|
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
|
+
provides "command/ps"
|
20
|
+
|
21
|
+
require_plugin 'command'
|
22
|
+
|
23
|
+
command[:ps] = 'ps -ef'
|
@@ -0,0 +1,26 @@
|
|
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
|
+
provides "keys/ssh"
|
20
|
+
|
21
|
+
require_plugin "keys"
|
22
|
+
|
23
|
+
keys[:ssh] = Mash.new
|
24
|
+
|
25
|
+
keys[:ssh][:host_dsa_public] = IO.read("/opt/ssh/etc/ssh_host_dsa_key.pub").split[1]
|
26
|
+
keys[:ssh][:host_rsa_public] = IO.read("/opt/ssh/etc/ssh_host_rsa_key.pub").split[1]
|
@@ -0,0 +1,19 @@
|
|
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_plugin "sigar::uptime"
|
data/lib/ohai/plugins/ohai.rb
CHANGED
data/lib/ohai/plugins/os.rb
CHANGED
data/lib/ohai/plugins/perl.rb
CHANGED
@@ -22,8 +22,8 @@ require_plugin "languages"
|
|
22
22
|
output = nil
|
23
23
|
|
24
24
|
perl = Mash.new
|
25
|
-
status =
|
26
|
-
|
25
|
+
status, stdout, stderr = run_command(:no_status_check => true, :command => "perl -V:version -V:archname")
|
26
|
+
if status == 0
|
27
27
|
stdout.each_line do |line|
|
28
28
|
case line
|
29
29
|
when /^version=\'(.+)\';$/
|
data/lib/ohai/plugins/ruby.rb
CHANGED
@@ -49,20 +49,21 @@ values = {
|
|
49
49
|
# Create a query string from above hash
|
50
50
|
env_string = ""
|
51
51
|
values.keys.each do |v|
|
52
|
-
env_string << "#{v}
|
52
|
+
env_string << "#{v}=\#{#{values[v]}},"
|
53
53
|
end
|
54
54
|
|
55
55
|
# Query the system ruby
|
56
|
-
result = run_ruby "puts
|
56
|
+
result = run_ruby "puts %Q(#{env_string})"
|
57
57
|
|
58
58
|
# Parse results to plugin hash
|
59
59
|
result.split(',').each do |entry|
|
60
|
-
key, value = entry.split('
|
60
|
+
key, value = entry.split('=')
|
61
61
|
languages[:ruby][key.to_sym] = value
|
62
62
|
end
|
63
63
|
|
64
64
|
# Perform one more (conditional) query
|
65
65
|
bin_dir = languages[:ruby][:bin_dir]
|
66
|
+
ruby_bin = languages[:ruby][:ruby_bin]
|
66
67
|
if File.exist?("#{bin_dir}\/gem")
|
67
|
-
languages[:ruby][:gems_dir] = run_ruby "puts %x{#{bin_dir}\/gem env gemdir}.chomp!"
|
68
|
+
languages[:ruby][:gems_dir] = run_ruby "puts %x{#{ruby_bin} #{bin_dir}\/gem env gemdir}.chomp!"
|
68
69
|
end
|
@@ -0,0 +1,40 @@
|
|
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 "sigar"
|
20
|
+
|
21
|
+
sigar = Sigar.new
|
22
|
+
|
23
|
+
provides "cpu"
|
24
|
+
|
25
|
+
cpuinfo = Mash.new
|
26
|
+
ix = 0
|
27
|
+
|
28
|
+
sigar.cpu_info_list.each do |info|
|
29
|
+
current_cpu = ix.to_s
|
30
|
+
ix += 1
|
31
|
+
cpuinfo[current_cpu] = Mash.new
|
32
|
+
cpuinfo[current_cpu]["vendor_id"] = info.vendor
|
33
|
+
cpuinfo[current_cpu]["model"] = info.model
|
34
|
+
cpuinfo[current_cpu]["mhz"] = info.mhz.to_s
|
35
|
+
cpuinfo[current_cpu]["cache_size"] = info.cache_size.to_s
|
36
|
+
cpuinfo[:total] = info.total_cores
|
37
|
+
cpuinfo[:real] = info.total_sockets
|
38
|
+
end
|
39
|
+
|
40
|
+
cpu cpuinfo
|
@@ -0,0 +1,45 @@
|
|
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
|
+
provides "filesystem"
|
20
|
+
|
21
|
+
require "sigar"
|
22
|
+
|
23
|
+
fs = Mash.new
|
24
|
+
|
25
|
+
sigar = Sigar.new
|
26
|
+
|
27
|
+
sigar.file_system_list.each do |fsys|
|
28
|
+
filesystem = fsys.dev_name
|
29
|
+
fs[filesystem] = Mash.new
|
30
|
+
fs[filesystem][:mount] = fsys.dir_name
|
31
|
+
fs[filesystem][:fs_type] = fsys.sys_type_name
|
32
|
+
fs[filesystem][:mount_options] = fsys.options
|
33
|
+
begin
|
34
|
+
usage = sigar.file_system_usage(fsys.dir_name)
|
35
|
+
fs[filesystem][:kb_size] = (usage.total / 1024).to_s
|
36
|
+
fs[filesystem][:kb_used] = ((usage.total - usage.free) / 1024).to_s
|
37
|
+
fs[filesystem][:kb_available] = (usage.free / 1024).to_s
|
38
|
+
fs[filesystem][:percent_used] = (usage.use_percent * 100).to_s + '%'
|
39
|
+
rescue Exception => e
|
40
|
+
#e.g. floppy or cdrom drive
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# Set the filesystem data
|
45
|
+
filesystem fs
|
@@ -0,0 +1,28 @@
|
|
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 'sigar'
|
20
|
+
|
21
|
+
provides "hostname", "fqdn"
|
22
|
+
|
23
|
+
sigar = Sigar.new
|
24
|
+
|
25
|
+
hostname sigar.net_info.host_name
|
26
|
+
|
27
|
+
fqdn sigar.fqdn
|
28
|
+
|
@@ -0,0 +1,36 @@
|
|
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 "sigar"
|
20
|
+
|
21
|
+
sigar = Sigar.new
|
22
|
+
|
23
|
+
provides "memory"
|
24
|
+
|
25
|
+
memory Mash.new
|
26
|
+
memory[:swap] = Mash.new
|
27
|
+
|
28
|
+
mem = sigar.mem
|
29
|
+
swap = sigar.swap
|
30
|
+
|
31
|
+
memory[:total] = (mem.total / 1024).to_s + "kB"
|
32
|
+
memory[:free] = (mem.free / 1024).to_s + "kB"
|
33
|
+
memory[:used] = (mem.used / 1024).to_s + "kB"
|
34
|
+
memory[:swap][:total] = (swap.total / 1024).to_s + "kB"
|
35
|
+
memory[:swap][:free] = (swap.free / 1024).to_s + "kB"
|
36
|
+
memory[:swap][:used] = (swap.used / 1024).to_s + "kB"
|
@@ -0,0 +1,102 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Matthew Kent (<mkent@magoazul.com>)
|
3
|
+
# Copyright:: Copyright (c) 2009 Matthew Kent
|
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
|
+
#http://github.com/mdkent/ohai/commit/92f51aa18b6add9682510a87dcf94835ea72b04d
|
20
|
+
|
21
|
+
require "sigar"
|
22
|
+
|
23
|
+
sigar = Sigar.new
|
24
|
+
|
25
|
+
provides "network", "counters/network"
|
26
|
+
|
27
|
+
ninfo = sigar.net_info
|
28
|
+
|
29
|
+
network[:default_interface] = ninfo.default_gateway_interface
|
30
|
+
|
31
|
+
network[:default_gateway] = ninfo.default_gateway
|
32
|
+
|
33
|
+
def encaps_lookup(encap)
|
34
|
+
return "Loopback" if encap.eql?("Local Loopback")
|
35
|
+
return "PPP" if encap.eql?("Point-to-Point Protocol")
|
36
|
+
return "SLIP" if encap.eql?("Serial Line IP")
|
37
|
+
return "VJSLIP" if encap.eql?("VJ Serial Line IP")
|
38
|
+
return "IPIP" if encap.eql?("IPIP Tunnel")
|
39
|
+
return "6to4" if encap.eql?("IPv6-in-IPv4")
|
40
|
+
encap
|
41
|
+
end
|
42
|
+
|
43
|
+
iface = Mash.new
|
44
|
+
|
45
|
+
net_counters = Mash.new
|
46
|
+
|
47
|
+
sigar.net_interface_list.each do |cint|
|
48
|
+
iface[cint] = Mash.new
|
49
|
+
if cint =~ /^(\w+)(\d+.*)/
|
50
|
+
iface[cint][:type] = $1
|
51
|
+
iface[cint][:number] = $2
|
52
|
+
end
|
53
|
+
ifconfig = sigar.net_interface_config(cint)
|
54
|
+
iface[cint][:encapsulation] = encaps_lookup(ifconfig.type)
|
55
|
+
iface[cint][:addresses] = Mash.new
|
56
|
+
# Backwards compat: loopback has no hwaddr
|
57
|
+
if (ifconfig.flags & Sigar::IFF_LOOPBACK) == 0
|
58
|
+
iface[cint][:addresses][ifconfig.hwaddr] = { "family" => "lladdr" }
|
59
|
+
end
|
60
|
+
if ifconfig.address != "0.0.0.0"
|
61
|
+
iface[cint][:addresses][ifconfig.address] = { "family" => "inet" }
|
62
|
+
# Backwards compat: no broadcast on tunnel or loopback dev
|
63
|
+
if (((ifconfig.flags & Sigar::IFF_POINTOPOINT) == 0) &&
|
64
|
+
((ifconfig.flags & Sigar::IFF_LOOPBACK) == 0))
|
65
|
+
iface[cint][:addresses][ifconfig.address]["broadcast"] = ifconfig.broadcast
|
66
|
+
end
|
67
|
+
iface[cint][:addresses][ifconfig.address]["netmask"] = ifconfig.netmask
|
68
|
+
end
|
69
|
+
iface[cint][:flags] = Sigar.net_interface_flags_to_s(ifconfig.flags).split(' ')
|
70
|
+
iface[cint][:mtu] = ifconfig.mtu.to_s
|
71
|
+
iface[cint][:queuelen] = ifconfig.tx_queue_len.to_s
|
72
|
+
if ifconfig.prefix6_length != 0
|
73
|
+
iface[cint][:addresses][ifconfig.address6] = { "family" => "inet6" }
|
74
|
+
iface[cint][:addresses][ifconfig.address6]["prefixlen"] = ifconfig.prefix6_length.to_s
|
75
|
+
iface[cint][:addresses][ifconfig.address6]["scope"] = Sigar.net_scope_to_s(ifconfig.scope6)
|
76
|
+
end
|
77
|
+
net_counters[cint] = Mash.new unless net_counters[cint]
|
78
|
+
if (!cint.include?(":"))
|
79
|
+
ifstat = sigar.net_interface_stat(cint)
|
80
|
+
net_counters[cint][:rx] = { "packets" => ifstat.rx_packets.to_s, "errors" => ifstat.rx_errors.to_s,
|
81
|
+
"drop" => ifstat.rx_dropped.to_s, "overrun" => ifstat.rx_overruns.to_s,
|
82
|
+
"frame" => ifstat.rx_frame.to_s, "bytes" => ifstat.rx_bytes.to_s }
|
83
|
+
net_counters[cint][:tx] = { "packets" => ifstat.tx_packets.to_s, "errors" => ifstat.tx_errors.to_s,
|
84
|
+
"drop" => ifstat.tx_dropped.to_s, "overrun" => ifstat.tx_overruns.to_s,
|
85
|
+
"carrier" => ifstat.tx_carrier.to_s, "collisions" => ifstat.tx_collisions.to_s,
|
86
|
+
"bytes" => ifstat.tx_bytes.to_s }
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
begin
|
91
|
+
sigar.arp_list.each do |arp|
|
92
|
+
next unless iface[arp.ifname] # this should never happen
|
93
|
+
iface[arp.ifname][:arp] = Mash.new unless iface[arp.ifname][:arp]
|
94
|
+
iface[arp.ifname][:arp][arp.address] = arp.hwaddr
|
95
|
+
end
|
96
|
+
rescue
|
97
|
+
#64-bit AIX for example requires 64-bit caller
|
98
|
+
end
|
99
|
+
|
100
|
+
counters[:network][:interfaces] = net_counters
|
101
|
+
|
102
|
+
network["interfaces"] = iface
|
@@ -0,0 +1,26 @@
|
|
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 "sigar"
|
20
|
+
|
21
|
+
provides "platform", "platform_version"
|
22
|
+
|
23
|
+
sys = Sigar.new.sys_info
|
24
|
+
|
25
|
+
platform sys.name.downcase
|
26
|
+
platform_version sys.version
|
@@ -0,0 +1,27 @@
|
|
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 "sigar"
|
20
|
+
|
21
|
+
sigar = Sigar.new
|
22
|
+
|
23
|
+
provides "uptime", "uptime_seconds"
|
24
|
+
|
25
|
+
uptime = sigar.uptime.uptime
|
26
|
+
uptime_seconds uptime.to_i * 1000
|
27
|
+
uptime self._seconds_to_human(uptime.to_i)
|
data/lib/ohai/system.rb
CHANGED
@@ -127,10 +127,12 @@ module Ohai
|
|
127
127
|
end
|
128
128
|
end
|
129
129
|
end
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
130
|
+
unless RUBY_PLATFORM =~ /mswin|mingw32|windows/
|
131
|
+
# Catch any errant children who need to be reaped
|
132
|
+
begin
|
133
|
+
true while Process.wait(-1, Process::WNOHANG)
|
134
|
+
rescue Errno::ECHILD
|
135
|
+
end
|
134
136
|
end
|
135
137
|
true
|
136
138
|
end
|
@@ -19,6 +19,7 @@
|
|
19
19
|
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
|
20
20
|
|
21
21
|
describe Ohai::Mixin::Command, "popen4" do
|
22
|
+
break if RUBY_PLATFORM =~ /(win|w)32$/
|
22
23
|
|
23
24
|
it "should default all commands to be run in the POSIX standard C locale" do
|
24
25
|
Ohai::Mixin::Command.popen4("echo $LC_ALL") do |pid, stdin, stdout, stderr|
|
@@ -28,9 +28,9 @@ describe Ohai::System, "plugin chef" do
|
|
28
28
|
@ohai.stub!(:require_plugin).and_return(true)
|
29
29
|
end
|
30
30
|
|
31
|
-
it "should set chef[:version] to the current chef version" do
|
31
|
+
it "should set [:chef_packages][:chef][:version] to the current chef version" do
|
32
32
|
@ohai._require_plugin("chef")
|
33
|
-
@ohai[:chef][:version].should == Chef::VERSION
|
33
|
+
@ohai[:chef_packages][:chef][:version].should == Chef::VERSION
|
34
34
|
end
|
35
35
|
end
|
36
36
|
rescue LoadError
|
@@ -26,8 +26,8 @@ describe Ohai::System, "plugin ohai" do
|
|
26
26
|
@ohai.stub!(:require_plugin).and_return(true)
|
27
27
|
end
|
28
28
|
|
29
|
-
it "should set ohai[:version] to the current version" do
|
29
|
+
it "should set [:chef_packages][:ohai][:version] to the current version" do
|
30
30
|
@ohai._require_plugin("ohai")
|
31
|
-
@ohai[:ohai][:version].should == Ohai::VERSION
|
31
|
+
@ohai[:chef_packages][:ohai][:version].should == Ohai::VERSION
|
32
32
|
end
|
33
33
|
end
|
@@ -53,7 +53,7 @@ describe Ohai::System, "plugin os" do
|
|
53
53
|
|
54
54
|
describe "on darwin" do
|
55
55
|
before(:each) do
|
56
|
-
|
56
|
+
::Config::CONFIG['host_os'] = "darwin"
|
57
57
|
end
|
58
58
|
|
59
59
|
it "should set the os to darwin" do
|
@@ -72,4 +72,4 @@ describe Ohai::System, "plugin os" do
|
|
72
72
|
@ohai[:os].should == "solaris2"
|
73
73
|
end
|
74
74
|
end
|
75
|
-
end
|
75
|
+
end
|
@@ -30,21 +30,15 @@ describe Ohai::System, "plugin perl" do
|
|
30
30
|
and_yield("archname='darwin-thread-multi-2level';")
|
31
31
|
@stdin = mock("STDIN", :null_object => true)
|
32
32
|
@status = 0
|
33
|
-
@ohai.stub!(:
|
34
|
-
@
|
35
|
-
@stdin,
|
33
|
+
@ohai.stub!(:run_command).with({:no_status_check=>true, :command=>"perl -V:version -V:archname"}).and_return([
|
34
|
+
@status,
|
36
35
|
@stdout,
|
37
36
|
@stderr
|
38
|
-
)
|
37
|
+
])
|
39
38
|
end
|
40
39
|
|
41
40
|
it "should run perl -V:version -V:archname" do
|
42
|
-
@ohai.should_receive(:
|
43
|
-
@ohai._require_plugin("perl")
|
44
|
-
end
|
45
|
-
|
46
|
-
it "should close perl command's stdin" do
|
47
|
-
@stdin.should_receive(:close)
|
41
|
+
@ohai.should_receive(:run_command).with({:no_status_check=>true, :command=>"perl -V:version -V:archname"}).and_return(true)
|
48
42
|
@ohai._require_plugin("perl")
|
49
43
|
end
|
50
44
|
|
@@ -65,24 +59,22 @@ describe Ohai::System, "plugin perl" do
|
|
65
59
|
|
66
60
|
it "should set languages[:perl] if perl command succeeds" do
|
67
61
|
@status = 0
|
68
|
-
@ohai.stub!(:
|
69
|
-
@
|
70
|
-
@stdin,
|
62
|
+
@ohai.stub!(:run_command).with({:no_status_check=>true, :command=>"perl -V:version -V:archname"}).and_return([
|
63
|
+
@status,
|
71
64
|
@stdout,
|
72
65
|
@stderr
|
73
|
-
)
|
66
|
+
])
|
74
67
|
@ohai._require_plugin("perl")
|
75
68
|
@ohai.languages.should have_key(:perl)
|
76
69
|
end
|
77
70
|
|
78
71
|
it "should not set languages[:perl] if perl command fails" do
|
79
72
|
@status = 1
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
).and_return(@status)
|
73
|
+
@ohai.stub!(:run_command).with({:no_status_check=>true, :command=>"perl -V:version -V:archname"}).and_return([
|
74
|
+
@status,
|
75
|
+
@stdout,
|
76
|
+
@stderr
|
77
|
+
])
|
86
78
|
@ohai._require_plugin("perl")
|
87
79
|
@ohai.languages.should_not have_key(:perl)
|
88
80
|
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.join(File.dirname(__FILE__), '..', '..', '/spec_helper.rb'))
|
20
20
|
|
21
21
|
describe Ohai::System, "plugin php" do
|
22
22
|
|
@@ -19,6 +19,8 @@
|
|
19
19
|
|
20
20
|
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
|
21
21
|
|
22
|
+
ruby_bin = File.join(::Config::CONFIG['bindir'], ::Config::CONFIG['ruby_install_name'])
|
23
|
+
|
22
24
|
describe Ohai::System, "plugin ruby" do
|
23
25
|
|
24
26
|
before(:each) do
|
@@ -39,8 +41,8 @@ describe Ohai::System, "plugin ruby" do
|
|
39
41
|
:host_cpu => ::Config::CONFIG['host_cpu'],
|
40
42
|
:host_os => ::Config::CONFIG['host_os'],
|
41
43
|
:host_vendor => ::Config::CONFIG['host_vendor'],
|
42
|
-
:gems_dir => %x{#{::Config::CONFIG['bindir']}/gem env gemdir}.chomp!,
|
43
|
-
:ruby_bin =>
|
44
|
+
:gems_dir => %x{#{ruby_bin} #{::Config::CONFIG['bindir']}/gem env gemdir}.chomp!,
|
45
|
+
:ruby_bin => ruby_bin
|
44
46
|
}.each do |attribute, value|
|
45
47
|
it "should have #{attribute} set" do
|
46
48
|
@ohai._require_plugin("ruby")
|
@@ -48,4 +50,4 @@ describe Ohai::System, "plugin ruby" do
|
|
48
50
|
end
|
49
51
|
end
|
50
52
|
|
51
|
-
end
|
53
|
+
end
|
data/spec/ohai/system_spec.rb
CHANGED
@@ -90,9 +90,11 @@ describe Ohai::System, "get_attribute" do
|
|
90
90
|
end
|
91
91
|
|
92
92
|
describe Ohai::System, "require_plugin" do
|
93
|
+
tmp = ENV['TMPDIR'] || ENV['TMP'] || ENV['TEMP'] || '/tmp'
|
94
|
+
|
93
95
|
before(:each) do
|
94
96
|
@plugin_path = Ohai::Config[:plugin_path]
|
95
|
-
Ohai::Config[:plugin_path] = ["
|
97
|
+
Ohai::Config[:plugin_path] = ["#{tmp}/plugins"]
|
96
98
|
File.stub!(:exists?).and_return(true)
|
97
99
|
@ohai = Ohai::System.new
|
98
100
|
@ohai.stub!(:from_file).and_return(true)
|
@@ -109,7 +111,7 @@ describe Ohai::System, "require_plugin" do
|
|
109
111
|
end
|
110
112
|
|
111
113
|
it "should check each part of the Ohai::Config[:plugin_path] for the plugin_filename.rb" do
|
112
|
-
@ohai.should_receive(:from_file).with("
|
114
|
+
@ohai.should_receive(:from_file).with(File.expand_path("#{tmp}/plugins/foo.rb")).and_return(true)
|
113
115
|
@ohai.require_plugin("foo")
|
114
116
|
end
|
115
117
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 5
|
8
|
-
-
|
9
|
-
version: 0.5.
|
8
|
+
- 4
|
9
|
+
version: 0.5.4
|
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-
|
17
|
+
date: 2010-05-11 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -117,6 +117,15 @@ files:
|
|
117
117
|
- lib/ohai/mixin/command.rb
|
118
118
|
- lib/ohai/mixin/from_file.rb
|
119
119
|
- lib/ohai/mixin/string.rb
|
120
|
+
- lib/ohai/plugins/aix/cpu.rb
|
121
|
+
- lib/ohai/plugins/aix/filesystem.rb
|
122
|
+
- lib/ohai/plugins/aix/hostname.rb
|
123
|
+
- lib/ohai/plugins/aix/memory.rb
|
124
|
+
- lib/ohai/plugins/aix/network.rb
|
125
|
+
- lib/ohai/plugins/aix/platform.rb
|
126
|
+
- lib/ohai/plugins/aix/ps.rb
|
127
|
+
- lib/ohai/plugins/aix/ssh_host_key.rb
|
128
|
+
- lib/ohai/plugins/aix/uptime.rb
|
120
129
|
- lib/ohai/plugins/chef.rb
|
121
130
|
- lib/ohai/plugins/cloud.rb
|
122
131
|
- lib/ohai/plugins/command.rb
|
@@ -145,6 +154,15 @@ files:
|
|
145
154
|
- lib/ohai/plugins/freebsd/virtualization.rb
|
146
155
|
- lib/ohai/plugins/groovy.rb
|
147
156
|
- lib/ohai/plugins/hostname.rb
|
157
|
+
- lib/ohai/plugins/hpux/cpu.rb
|
158
|
+
- lib/ohai/plugins/hpux/filesystem.rb
|
159
|
+
- lib/ohai/plugins/hpux/hostname.rb
|
160
|
+
- lib/ohai/plugins/hpux/memory.rb
|
161
|
+
- lib/ohai/plugins/hpux/network.rb
|
162
|
+
- lib/ohai/plugins/hpux/platform.rb
|
163
|
+
- lib/ohai/plugins/hpux/ps.rb
|
164
|
+
- lib/ohai/plugins/hpux/ssh_host_key.rb
|
165
|
+
- lib/ohai/plugins/hpux/uptime.rb
|
148
166
|
- lib/ohai/plugins/java.rb
|
149
167
|
- lib/ohai/plugins/kernel.rb
|
150
168
|
- lib/ohai/plugins/keys.rb
|
@@ -198,6 +216,13 @@ files:
|
|
198
216
|
- lib/ohai/plugins/python.rb
|
199
217
|
- lib/ohai/plugins/rackspace.rb
|
200
218
|
- lib/ohai/plugins/ruby.rb
|
219
|
+
- lib/ohai/plugins/sigar/cpu.rb
|
220
|
+
- lib/ohai/plugins/sigar/filesystem.rb
|
221
|
+
- lib/ohai/plugins/sigar/hostname.rb
|
222
|
+
- lib/ohai/plugins/sigar/memory.rb
|
223
|
+
- lib/ohai/plugins/sigar/network.rb
|
224
|
+
- lib/ohai/plugins/sigar/platform.rb
|
225
|
+
- lib/ohai/plugins/sigar/uptime.rb
|
201
226
|
- lib/ohai/plugins/solaris2/cpu.rb
|
202
227
|
- lib/ohai/plugins/solaris2/hostname.rb
|
203
228
|
- lib/ohai/plugins/solaris2/kernel.rb
|