ohai 16.3.2 → 16.5.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +6 -4
- data/bin/ohai +1 -1
- data/lib/ohai.rb +1 -1
- data/lib/ohai/application.rb +2 -2
- data/lib/ohai/config.rb +2 -3
- data/lib/ohai/dsl.rb +1 -1
- data/lib/ohai/dsl/plugin.rb +5 -5
- data/lib/ohai/dsl/plugin/versionvii.rb +1 -1
- data/lib/ohai/exception.rb +1 -1
- data/lib/ohai/hints.rb +1 -1
- data/lib/ohai/loader.rb +2 -3
- data/lib/ohai/log.rb +2 -2
- data/lib/ohai/mixin/azure_metadata.rb +1 -1
- data/lib/ohai/mixin/chef_utils_wiring.rb +39 -0
- data/lib/ohai/mixin/command.rb +3 -54
- data/lib/ohai/mixin/constant_helper.rb +1 -1
- data/lib/ohai/mixin/dmi_decode.rb +1 -1
- data/lib/ohai/mixin/do_metadata.rb +1 -1
- data/lib/ohai/mixin/ec2_metadata.rb +3 -3
- data/lib/ohai/mixin/http_helper.rb +1 -1
- data/lib/ohai/mixin/network_helper.rb +1 -1
- data/lib/ohai/mixin/os.rb +2 -2
- data/lib/ohai/mixin/scaleway_metadata.rb +1 -1
- data/lib/ohai/mixin/seconds_to_human.rb +1 -1
- data/lib/ohai/mixin/shell_out.rb +50 -0
- data/lib/ohai/mixin/softlayer_metadata.rb +1 -1
- data/lib/ohai/mixin/string.rb +1 -1
- data/lib/ohai/mixin/which.rb +38 -0
- data/lib/ohai/plugin_config.rb +1 -1
- data/lib/ohai/plugins/aix/kernel.rb +1 -1
- data/lib/ohai/plugins/aix/memory.rb +3 -3
- data/lib/ohai/plugins/aix/network.rb +3 -2
- data/lib/ohai/plugins/aix/platform.rb +1 -1
- data/lib/ohai/plugins/aix/uptime.rb +2 -2
- data/lib/ohai/plugins/aix/virtualization.rb +1 -1
- data/lib/ohai/plugins/azure.rb +1 -1
- data/lib/ohai/plugins/bsd/virtualization.rb +2 -2
- data/lib/ohai/plugins/cloud.rb +2 -2
- data/lib/ohai/plugins/command.rb +1 -1
- data/lib/ohai/plugins/cpu.rb +3 -3
- data/lib/ohai/plugins/darwin/memory.rb +1 -1
- data/lib/ohai/plugins/darwin/network.rb +1 -1
- data/lib/ohai/plugins/darwin/platform.rb +2 -2
- data/lib/ohai/plugins/darwin/virtualization.rb +1 -1
- data/lib/ohai/plugins/docker.rb +3 -3
- data/lib/ohai/plugins/dragonflybsd/platform.rb +2 -4
- data/lib/ohai/plugins/ec2.rb +4 -3
- data/lib/ohai/plugins/erlang.rb +1 -1
- data/lib/ohai/plugins/eucalyptus.rb +1 -1
- data/lib/ohai/plugins/filesystem.rb +8 -14
- data/lib/ohai/plugins/fips.rb +2 -6
- data/lib/ohai/plugins/freebsd/platform.rb +2 -4
- data/lib/ohai/plugins/gce.rb +1 -1
- data/lib/ohai/plugins/hostname.rb +5 -5
- data/lib/ohai/plugins/init_package.rb +1 -1
- data/lib/ohai/plugins/java.rb +1 -1
- data/lib/ohai/plugins/kernel.rb +3 -3
- data/lib/ohai/plugins/keys.rb +1 -1
- data/lib/ohai/plugins/languages.rb +1 -1
- data/lib/ohai/plugins/libvirt.rb +1 -1
- data/lib/ohai/plugins/linode.rb +1 -1
- data/lib/ohai/plugins/linux/block_device.rb +1 -1
- data/lib/ohai/plugins/linux/hostnamectl.rb +1 -2
- data/lib/ohai/plugins/linux/ipc.rb +1 -1
- data/lib/ohai/plugins/linux/lsb.rb +2 -3
- data/lib/ohai/plugins/linux/lspci.rb +1 -2
- data/lib/ohai/plugins/linux/machineid.rb +2 -2
- data/lib/ohai/plugins/linux/memory.rb +1 -1
- data/lib/ohai/plugins/linux/network.rb +21 -13
- data/lib/ohai/plugins/linux/platform.rb +15 -18
- data/lib/ohai/plugins/linux/virtualization.rb +1 -1
- data/lib/ohai/plugins/netbsd/network.rb +4 -8
- data/lib/ohai/plugins/netbsd/platform.rb +2 -4
- data/lib/ohai/plugins/network.rb +5 -4
- data/lib/ohai/plugins/ohai_time.rb +1 -1
- data/lib/ohai/plugins/openbsd/network.rb +4 -8
- data/lib/ohai/plugins/openbsd/platform.rb +2 -4
- data/lib/ohai/plugins/openstack.rb +3 -2
- data/lib/ohai/plugins/os.rb +1 -1
- data/lib/ohai/plugins/packages.rb +21 -1
- data/lib/ohai/plugins/passwd.rb +2 -1
- data/lib/ohai/plugins/perl.rb +1 -1
- data/lib/ohai/plugins/platform.rb +1 -1
- data/lib/ohai/plugins/powershell.rb +1 -1
- data/lib/ohai/plugins/ps.rb +1 -1
- data/lib/ohai/plugins/python.rb +1 -1
- data/lib/ohai/plugins/rackspace.rb +5 -4
- data/lib/ohai/plugins/root_group.rb +1 -1
- data/lib/ohai/plugins/ruby.rb +4 -15
- data/lib/ohai/plugins/scaleway.rb +1 -1
- data/lib/ohai/plugins/shard.rb +2 -2
- data/lib/ohai/plugins/shells.rb +1 -1
- data/lib/ohai/plugins/softlayer.rb +1 -1
- data/lib/ohai/plugins/solaris2/dmi.rb +2 -3
- data/lib/ohai/plugins/solaris2/memory.rb +1 -2
- data/lib/ohai/plugins/solaris2/network.rb +8 -14
- data/lib/ohai/plugins/solaris2/platform.rb +2 -3
- data/lib/ohai/plugins/solaris2/virtualization.rb +3 -6
- data/lib/ohai/plugins/ssh_host_key.rb +1 -1
- data/lib/ohai/plugins/uptime.rb +2 -2
- data/lib/ohai/plugins/virtualbox.rb +1 -1
- data/lib/ohai/plugins/vmware.rb +1 -1
- data/lib/ohai/plugins/windows/dmi.rb +2 -2
- data/lib/ohai/plugins/windows/drivers.rb +2 -2
- data/lib/ohai/plugins/windows/memory.rb +1 -1
- data/lib/ohai/plugins/windows/network.rb +3 -3
- data/lib/ohai/plugins/windows/platform.rb +1 -1
- data/lib/ohai/plugins/windows/system_enclosure.rb +1 -1
- data/lib/ohai/plugins/windows/virtualization.rb +2 -2
- data/lib/ohai/plugins/zpools.rb +1 -1
- data/lib/ohai/provides_map.rb +1 -1
- data/lib/ohai/runner.rb +2 -2
- data/lib/ohai/system.rb +2 -3
- data/lib/ohai/util/file_helper.rb +4 -37
- data/lib/ohai/util/ip_helper.rb +2 -2
- data/lib/ohai/util/win32.rb +1 -1
- data/lib/ohai/version.rb +3 -3
- data/ohai.gemspec +5 -7
- metadata +62 -73
@@ -17,7 +17,7 @@
|
|
17
17
|
# See the License for the specific language governing permissions and
|
18
18
|
# limitations under the License.
|
19
19
|
|
20
|
-
require "net/
|
20
|
+
require "net/http" unless defined?(Net::HTTP)
|
21
21
|
require "uri" unless defined?(URI)
|
22
22
|
|
23
23
|
# https://softlayer.github.io/reference/services/SoftLayer_Resource_Metadata/
|
data/lib/ohai/mixin/string.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: James Gartrell (<jgartrel@gmail.com>)
|
3
|
-
# Copyright:: Copyright (c)
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -0,0 +1,38 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
require "chef-utils/dsl/which" unless defined?(ChefUtils::DSL::Which)
|
18
|
+
require "chef-utils/dsl/default_paths" unless defined?(ChefUtils::DSL::DefaultPaths)
|
19
|
+
require_relative "chef_utils_wiring" unless defined?(Ohai::Mixin::ChefUtilsWiring)
|
20
|
+
|
21
|
+
module Ohai
|
22
|
+
module Mixin
|
23
|
+
module Which
|
24
|
+
include ChefUtils::DSL::Which
|
25
|
+
include ChefUtils::DSL::DefaultPaths
|
26
|
+
include ChefUtilsWiring
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
# we dep-inject default paths into this API for historical reasons
|
31
|
+
#
|
32
|
+
# @api private
|
33
|
+
def __extra_path
|
34
|
+
__default_paths
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/ohai/plugin_config.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Joshua Timberman <joshua@chef.io>
|
3
3
|
# Author:: Isa Farnik (<isa@chef.io>)
|
4
|
-
# Copyright:: Copyright (c)
|
4
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
5
5
|
# License:: Apache License, Version 2.0
|
6
6
|
#
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Joshua Timberman <joshua@chef.io>
|
3
3
|
# Author:: Isa Farnik (<isa@chef.io>)
|
4
|
-
# Copyright:: Copyright (c)
|
4
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
5
5
|
# License:: Apache License, Version 2.0
|
6
6
|
#
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -30,7 +30,7 @@ Ohai.plugin(:Memory) do
|
|
30
30
|
memory[:free] = "#{free_in_mb.to_i * 1024}kB"
|
31
31
|
|
32
32
|
swap_info = shell_out("swap -s").stdout.split # returns swap info in 4K blocks
|
33
|
-
memory[:swap]["total"] = "#{
|
34
|
-
memory[:swap]["free"] = "#{
|
33
|
+
memory[:swap]["total"] = "#{swap_info[2].to_i * 4}kB"
|
34
|
+
memory[:swap]["free"] = "#{swap_info[10].to_i * 4}kB"
|
35
35
|
end
|
36
36
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>)
|
3
3
|
# Author:: Prabhu Das (<prabhu.das@clogeny.com>)
|
4
4
|
# Author:: Isa Farnik (<isa@chef.io>)
|
5
|
-
# Copyright:: Copyright (c)
|
5
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
6
6
|
# License:: Apache License, Version 2.0
|
7
7
|
#
|
8
8
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -19,7 +19,6 @@
|
|
19
19
|
#
|
20
20
|
|
21
21
|
Ohai.plugin(:Network) do
|
22
|
-
require "ipaddr"
|
23
22
|
require_relative "../../mixin/network_helper"
|
24
23
|
|
25
24
|
provides "network", "counters/network", "macaddress"
|
@@ -27,6 +26,8 @@ Ohai.plugin(:Network) do
|
|
27
26
|
include Ohai::Mixin::NetworkHelper
|
28
27
|
|
29
28
|
collect_data(:aix) do
|
29
|
+
require "ipaddr" unless defined?(IPAddr)
|
30
|
+
|
30
31
|
# Loads following information.
|
31
32
|
# :default_interface, :default_gateway - route -n get 0
|
32
33
|
# :interfaces
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Joshua Timberman <joshua@chef.io>
|
3
3
|
# Author:: Isa Farnik (<isa@chef.io>)
|
4
|
-
# Copyright:: Copyright (c)
|
4
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
5
5
|
# License:: Apache License, Version 2.0
|
6
6
|
#
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Kurt Yoder (<ktyopscode@yoderhome.com>)
|
3
3
|
# Author:: Isa Farnik (<isa@chef.io>)
|
4
|
-
# Copyright:: Copyright (c)
|
4
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
5
5
|
# License:: Apache License, Version 2.0
|
6
6
|
#
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -21,7 +21,7 @@ Ohai.plugin(:Uptime) do
|
|
21
21
|
provides "uptime", "uptime_seconds"
|
22
22
|
|
23
23
|
collect_data(:aix) do
|
24
|
-
require "date"
|
24
|
+
require "date" unless defined?(DateTime)
|
25
25
|
# below we're going to assume that PID 1 is init (this is true 99.99999% of the time)
|
26
26
|
# output will look like this
|
27
27
|
# 1148-20:54:50
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Julian C. Dunn (<jdunn@chef.io>)
|
3
3
|
# Author:: Isa Farnik (<isa@chef.io>)
|
4
|
-
# Copyright:: Copyright (c)
|
4
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
5
5
|
# License:: Apache License, Version 2.0
|
6
6
|
#
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
data/lib/ohai/plugins/azure.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Bryan McLellan (btm@loftninjas.org)
|
3
3
|
# Copyright:: Copyright (c) 2009 Bryan McLellan
|
4
|
-
# Copyright:: Copyright (c)
|
4
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
5
5
|
# License:: Apache License, Version 2.0
|
6
6
|
#
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -49,7 +49,7 @@ Ohai.plugin(:Virtualization) do
|
|
49
49
|
end
|
50
50
|
|
51
51
|
# detect from modules
|
52
|
-
so = shell_out(
|
52
|
+
so = shell_out(Ohai.abs_path("/sbin/kldstat").to_s)
|
53
53
|
so.stdout.lines do |line|
|
54
54
|
case line
|
55
55
|
when /vboxdrv/
|
data/lib/ohai/plugins/cloud.rb
CHANGED
@@ -100,7 +100,7 @@ Ohai.plugin(:Cloud) do
|
|
100
100
|
@cloud[:local_ipv6] = @cloud[:local_ipv6_addrs][0] if @cloud[:local_ipv6_addrs]
|
101
101
|
|
102
102
|
# if empty, return nil
|
103
|
-
|
103
|
+
@cloud.empty? ? nil : @cloud
|
104
104
|
end
|
105
105
|
|
106
106
|
private
|
@@ -320,7 +320,7 @@ Ohai.plugin(:Cloud) do
|
|
320
320
|
end
|
321
321
|
|
322
322
|
collect_data do
|
323
|
-
require "ipaddr"
|
323
|
+
require "ipaddr" unless defined?(IPAddr)
|
324
324
|
|
325
325
|
@cloud_attr_obj = CloudAttrs.new
|
326
326
|
|
data/lib/ohai/plugins/command.rb
CHANGED
data/lib/ohai/plugins/cpu.rb
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
# Author:: Prabhu Das (<prabhu.das@clogeny.com>)
|
9
9
|
# Author:: Isa Farnik (<isa@chef.io>)
|
10
10
|
# Author:: Doug MacEachern <dougm@vmware.com>
|
11
|
-
# Copyright:: Copyright (c)
|
11
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
12
12
|
# License:: Apache License, Version 2.0
|
13
13
|
#
|
14
14
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -61,7 +61,7 @@ Ohai.plugin(:CPU) do
|
|
61
61
|
cpu_number += 1
|
62
62
|
when /vendor_id\s+:\s(.+)/
|
63
63
|
vendor_id = $1
|
64
|
-
if vendor_id
|
64
|
+
if vendor_id.include?("IBM/S390")
|
65
65
|
cpuinfo["vendor_id"] = vendor_id
|
66
66
|
else
|
67
67
|
cpuinfo[current_cpu]["vendor_id"] = vendor_id
|
@@ -377,7 +377,7 @@ Ohai.plugin(:CPU) do
|
|
377
377
|
end
|
378
378
|
|
379
379
|
collect_data(:windows) do
|
380
|
-
require "wmi-lite/wmi"
|
380
|
+
require "wmi-lite/wmi" unless defined?(WmiLite::Wmi)
|
381
381
|
|
382
382
|
cpu Mash.new
|
383
383
|
cores = 0
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Patrick Collins (<pat@burned.com>)
|
3
|
-
# Copyright:: Copyright (c)
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
-
# Copyright:: Copyright (c) Chef Software
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -20,7 +20,7 @@ Ohai.plugin(:Platform) do
|
|
20
20
|
provides "platform", "platform_version", "platform_build", "platform_family"
|
21
21
|
|
22
22
|
collect_data(:darwin) do
|
23
|
-
so = shell_out(
|
23
|
+
so = shell_out(Ohai.abs_path( "/usr/bin/sw_vers" ).to_s)
|
24
24
|
so.stdout.lines do |line|
|
25
25
|
case line
|
26
26
|
when /^ProductVersion:\s+(.+)$/
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Author:: Pavel Yudin (<pyudin@parallels.com>)
|
3
3
|
# Author:: Tim Smith (<tsmith@chef.io>)
|
4
4
|
# Copyright:: Copyright (c) 2015 Pavel Yudin
|
5
|
-
# Copyright:: Copyright (c)
|
5
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
6
6
|
# License:: Apache License, Version 2.0
|
7
7
|
#
|
8
8
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
data/lib/ohai/plugins/docker.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright::
|
2
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
3
3
|
# License:: Apache License, Version 2.0
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -16,8 +16,6 @@
|
|
16
16
|
#
|
17
17
|
|
18
18
|
Ohai.plugin(:Docker) do
|
19
|
-
require "json"
|
20
|
-
|
21
19
|
provides "docker"
|
22
20
|
depends "virtualization"
|
23
21
|
|
@@ -50,6 +48,8 @@ Ohai.plugin(:Docker) do
|
|
50
48
|
end
|
51
49
|
|
52
50
|
collect_data do
|
51
|
+
require "json" unless defined?(JSON)
|
52
|
+
|
53
53
|
if virtualization[:systems][:docker]
|
54
54
|
docker_ohai_data(docker_info_json)
|
55
55
|
end
|
@@ -20,10 +20,8 @@ Ohai.plugin(:Platform) do
|
|
20
20
|
provides "platform", "platform_version", "platform_family"
|
21
21
|
|
22
22
|
collect_data(:dragonflybsd) do
|
23
|
-
|
24
|
-
|
25
|
-
so = shell_out("uname -r")
|
26
|
-
platform_version so.stdout.split($/)[0]
|
23
|
+
platform shell_out("uname -s").stdout.split($/)[0].downcase
|
24
|
+
platform_version shell_out("uname -r").stdout.split($/)[0]
|
27
25
|
platform_family "dragonflybsd"
|
28
26
|
end
|
29
27
|
end
|
data/lib/ohai/plugins/ec2.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# Author:: Benjamin Black (<bb@chef.io>)
|
4
4
|
# Author:: Christopher Brown (<cb@chef.io>)
|
5
5
|
# Author:: Tim Smith (<tsmith@chef.io>)
|
6
|
-
# Copyright:: Copyright (c)
|
6
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
7
7
|
# License:: Apache License, Version 2.0
|
8
8
|
#
|
9
9
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -28,7 +28,6 @@
|
|
28
28
|
Ohai.plugin(:EC2) do
|
29
29
|
require_relative "../mixin/ec2_metadata"
|
30
30
|
require_relative "../mixin/http_helper"
|
31
|
-
require "base64"
|
32
31
|
|
33
32
|
include Ohai::Mixin::Ec2Metadata
|
34
33
|
include Ohai::Mixin::HttpHelper
|
@@ -82,7 +81,7 @@ Ohai.plugin(:EC2) do
|
|
82
81
|
# @return [Boolean] do we have a Xen Identifying Number or not?
|
83
82
|
def has_ec2_identifying_number?
|
84
83
|
if RUBY_PLATFORM.match?(/mswin|mingw32|windows/)
|
85
|
-
require "wmi-lite/wmi"
|
84
|
+
require "wmi-lite/wmi" unless defined?(WmiLite::Wmi)
|
86
85
|
wmi = WmiLite::Wmi.new
|
87
86
|
if /^ec2/.match?(wmi.first_of("Win32_ComputerSystemProduct")["identifyingnumber"])
|
88
87
|
logger.trace("Plugin EC2: has_ec2_identifying_number? == true")
|
@@ -115,6 +114,8 @@ Ohai.plugin(:EC2) do
|
|
115
114
|
end
|
116
115
|
|
117
116
|
collect_data do
|
117
|
+
require "base64" unless defined?(Base64)
|
118
|
+
|
118
119
|
if looks_like_ec2?
|
119
120
|
logger.trace("Plugin EC2: looks_like_ec2? == true")
|
120
121
|
ec2 Mash.new
|
data/lib/ohai/plugins/erlang.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Joe Williams (<joe@joetify.com>)
|
3
|
-
# Copyright:: Copyright (c)
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Author:: Tim Dysinger (<tim@dysinger.net>)
|
3
3
|
# Author:: Benjamin Black (<bb@chef.io>)
|
4
4
|
# Author:: Christopher Brown (<cb@chef.io>)
|
5
|
-
# Copyright:: Copyright (c)
|
5
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
6
6
|
# License:: Apache License, Version 2.0
|
7
7
|
#
|
8
8
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -6,7 +6,7 @@
|
|
6
6
|
# Author:: Prabhu Das (<prabhu.das@clogeny.com>)
|
7
7
|
# Author:: Isa Farnik (<isa@chef.io>)
|
8
8
|
# Author:: James Gartrell (<jgartrel@gmail.com>)
|
9
|
-
# Copyright:: Copyright (c)
|
9
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
10
10
|
# Copyright:: Copyright (c) 2015 Facebook, Inc.
|
11
11
|
# License:: Apache License, Version 2.0
|
12
12
|
#
|
@@ -23,8 +23,6 @@
|
|
23
23
|
# limitations under the License.
|
24
24
|
#
|
25
25
|
|
26
|
-
require "set"
|
27
|
-
|
28
26
|
Ohai.plugin(:Filesystem) do
|
29
27
|
provides "filesystem"
|
30
28
|
|
@@ -286,12 +284,10 @@ Ohai.plugin(:Filesystem) do
|
|
286
284
|
|
287
285
|
# Grab filesystem data from df
|
288
286
|
run_with_check("df") do
|
289
|
-
|
290
|
-
fs.merge!(parse_common_df(so.stdout))
|
287
|
+
fs.merge!(parse_common_df(shell_out("df -P").stdout))
|
291
288
|
|
292
289
|
# Grab filesystem inode data from df
|
293
|
-
|
294
|
-
so.stdout.each_line do |line|
|
290
|
+
shell_out("df -iP").stdout.each_line do |line|
|
295
291
|
case line
|
296
292
|
when /^Filesystem\s+Inodes/
|
297
293
|
next
|
@@ -310,8 +306,7 @@ Ohai.plugin(:Filesystem) do
|
|
310
306
|
|
311
307
|
# Grab mount information from /bin/mount
|
312
308
|
run_with_check("mount") do
|
313
|
-
|
314
|
-
so.stdout.each_line do |line|
|
309
|
+
shell_out("mount").stdout.each_line do |line|
|
315
310
|
if line =~ /^(.+?) on (.+?) type (.+?) \((.+?)\)$/
|
316
311
|
key = "#{$1},#{$2}"
|
317
312
|
fs[key] ||= Mash.new
|
@@ -346,8 +341,7 @@ Ohai.plugin(:Filesystem) do
|
|
346
341
|
# this is to allow machines with large amounts of attached LUNs
|
347
342
|
# to respond back to the command successfully
|
348
343
|
run_with_check(cmdtype) do
|
349
|
-
|
350
|
-
so.stdout.each_line do |line|
|
344
|
+
shell_out(cmd, timeout: 60).stdout.each_line do |line|
|
351
345
|
parsed = parse_line(line, cmdtype)
|
352
346
|
next if parsed.nil?
|
353
347
|
|
@@ -383,7 +377,6 @@ Ohai.plugin(:Filesystem) do
|
|
383
377
|
# we have to non-block read dev files. Ew.
|
384
378
|
f = File.open("/proc/mounts")
|
385
379
|
loop do
|
386
|
-
|
387
380
|
data = f.read_nonblock(4096)
|
388
381
|
mounts << data
|
389
382
|
# We should just catch EOFError, but the kernel had a period of
|
@@ -392,9 +385,9 @@ Ohai.plugin(:Filesystem) do
|
|
392
385
|
# whatever data we might have
|
393
386
|
rescue Exception
|
394
387
|
break
|
395
|
-
|
396
388
|
end
|
397
389
|
f.close
|
390
|
+
|
398
391
|
mounts.each_line do |line|
|
399
392
|
if line =~ /^(\S+) (\S+) (\S+) (\S+) \S+ \S+$/
|
400
393
|
key = "#{$1},#{$2}"
|
@@ -718,7 +711,8 @@ Ohai.plugin(:Filesystem) do
|
|
718
711
|
end
|
719
712
|
|
720
713
|
collect_data(:windows) do
|
721
|
-
require "
|
714
|
+
require "set" unless defined?(Set)
|
715
|
+
require "wmi-lite/wmi" unless defined?(WmiLite::Wmi)
|
722
716
|
require_relative "../mash"
|
723
717
|
|
724
718
|
fs = merge_info(logical_info, encryptable_info)
|