ohai 8.10.0 → 8.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -2
- data/Rakefile +13 -4
- data/bin/ohai +3 -4
- data/lib/ohai.rb +4 -4
- data/lib/ohai/application.rb +7 -6
- data/lib/ohai/common/dmi.rb +56 -56
- data/lib/ohai/config.rb +12 -8
- data/lib/ohai/dsl.rb +3 -3
- data/lib/ohai/dsl/plugin.rb +5 -5
- data/lib/ohai/dsl/plugin/versionvi.rb +0 -1
- data/lib/ohai/dsl/plugin/versionvii.rb +1 -0
- data/lib/ohai/hints.rb +1 -1
- data/lib/ohai/loader.rb +7 -7
- data/lib/ohai/log.rb +1 -1
- data/lib/ohai/mash.rb +3 -2
- data/lib/ohai/mixin/command.rb +25 -23
- data/lib/ohai/mixin/dmi_decode.rb +10 -10
- data/lib/ohai/mixin/ec2_metadata.rb +40 -39
- data/lib/ohai/mixin/gce_metadata.rb +9 -9
- data/lib/ohai/mixin/network_constants.rb +1 -1
- data/lib/ohai/mixin/os.rb +3 -3
- data/lib/ohai/mixin/seconds_to_human.rb +0 -2
- data/lib/ohai/mixin/softlayer_metadata.rb +10 -10
- data/lib/ohai/mixin/string.rb +2 -2
- data/lib/ohai/plugin_config.rb +1 -1
- data/lib/ohai/plugins/aix/cpu.rb +2 -2
- data/lib/ohai/plugins/aix/filesystem.rb +2 -2
- data/lib/ohai/plugins/aix/memory.rb +2 -2
- data/lib/ohai/plugins/aix/network.rb +9 -10
- data/lib/ohai/plugins/aix/os.rb +2 -2
- data/lib/ohai/plugins/aix/uptime.rb +3 -3
- data/lib/ohai/plugins/aix/virtualization.rb +23 -23
- data/lib/ohai/plugins/azure.rb +32 -5
- data/lib/ohai/plugins/bsd/virtualization.rb +22 -22
- data/lib/ohai/plugins/c.rb +3 -3
- data/lib/ohai/plugins/chef.rb +1 -1
- data/lib/ohai/plugins/cloud.rb +59 -60
- data/lib/ohai/plugins/cloud_v2.rb +37 -39
- data/lib/ohai/plugins/darwin/cpu.rb +1 -1
- data/lib/ohai/plugins/darwin/filesystem2.rb +5 -5
- data/lib/ohai/plugins/darwin/memory.rb +5 -6
- data/lib/ohai/plugins/darwin/network.rb +7 -7
- data/lib/ohai/plugins/darwin/system_profiler.rb +32 -33
- data/lib/ohai/plugins/darwin/virtualization.rb +9 -9
- data/lib/ohai/plugins/digital_ocean.rb +16 -16
- data/lib/ohai/plugins/dmi.rb +6 -6
- data/lib/ohai/plugins/dragonflybsd/cpu.rb +2 -2
- data/lib/ohai/plugins/dragonflybsd/memory.rb +0 -1
- data/lib/ohai/plugins/dragonflybsd/network.rb +4 -4
- data/lib/ohai/plugins/dragonflybsd/os.rb +1 -1
- data/lib/ohai/plugins/ec2.rb +39 -15
- data/lib/ohai/plugins/elixir.rb +1 -1
- data/lib/ohai/plugins/erlang.rb +3 -3
- data/lib/ohai/plugins/eucalyptus.rb +16 -12
- data/lib/ohai/plugins/freebsd/cpu.rb +2 -2
- data/lib/ohai/plugins/freebsd/memory.rb +0 -1
- data/lib/ohai/plugins/freebsd/network.rb +4 -4
- data/lib/ohai/plugins/freebsd/os.rb +1 -1
- data/lib/ohai/plugins/gce.rb +6 -6
- data/lib/ohai/plugins/hostname.rb +7 -7
- data/lib/ohai/plugins/init_package.rb +1 -1
- data/lib/ohai/plugins/ip_scopes.rb +9 -9
- data/lib/ohai/plugins/java.rb +1 -1
- data/lib/ohai/plugins/joyent.rb +7 -7
- data/lib/ohai/plugins/kernel.rb +8 -8
- data/lib/ohai/plugins/linode.rb +7 -4
- data/lib/ohai/plugins/linux/cpu.rb +5 -5
- data/lib/ohai/plugins/linux/filesystem.rb +16 -16
- data/lib/ohai/plugins/linux/filesystem2.rb +15 -15
- data/lib/ohai/plugins/linux/mdadm.rb +3 -3
- data/lib/ohai/plugins/linux/network.rb +85 -51
- data/lib/ohai/plugins/linux/platform.rb +24 -24
- data/lib/ohai/plugins/linux/virtualization.rb +8 -8
- data/lib/ohai/plugins/mono.rb +1 -1
- data/lib/ohai/plugins/netbsd/cpu.rb +1 -1
- data/lib/ohai/plugins/netbsd/network.rb +2 -2
- data/lib/ohai/plugins/network.rb +11 -11
- data/lib/ohai/plugins/network_listeners.rb +30 -26
- data/lib/ohai/plugins/ohai.rb +3 -3
- data/lib/ohai/plugins/openbsd/cpu.rb +4 -4
- data/lib/ohai/plugins/openbsd/memory.rb +4 -4
- data/lib/ohai/plugins/openbsd/network.rb +3 -3
- data/lib/ohai/plugins/openstack.rb +12 -12
- data/lib/ohai/plugins/os.rb +2 -2
- data/lib/ohai/plugins/packages.rb +22 -22
- data/lib/ohai/plugins/passwd.rb +4 -4
- data/lib/ohai/plugins/powershell.rb +9 -9
- data/lib/ohai/plugins/ps.rb +2 -2
- data/lib/ohai/plugins/python.rb +1 -1
- data/lib/ohai/plugins/rackspace.rb +13 -13
- data/lib/ohai/plugins/root_group.rb +4 -4
- data/lib/ohai/plugins/ruby.rb +6 -6
- data/lib/ohai/plugins/rust.rb +1 -1
- data/lib/ohai/plugins/sigar/cpu.rb +1 -1
- data/lib/ohai/plugins/sigar/filesystem.rb +1 -1
- data/lib/ohai/plugins/sigar/network.rb +13 -13
- data/lib/ohai/plugins/sigar/network_route.rb +34 -29
- data/lib/ohai/plugins/softlayer.rb +8 -7
- data/lib/ohai/plugins/solaris2/cpu.rb +19 -19
- data/lib/ohai/plugins/solaris2/dmi.rb +63 -63
- data/lib/ohai/plugins/solaris2/filesystem.rb +13 -13
- data/lib/ohai/plugins/solaris2/memory.rb +2 -2
- data/lib/ohai/plugins/solaris2/network.rb +5 -5
- data/lib/ohai/plugins/solaris2/virtualization.rb +18 -18
- data/lib/ohai/plugins/solaris2/zpools.rb +1 -1
- data/lib/ohai/plugins/ssh_host_key.rb +2 -2
- data/lib/ohai/plugins/uptime.rb +4 -5
- data/lib/ohai/plugins/virtualbox.rb +2 -2
- data/lib/ohai/plugins/virtualization.rb +17 -17
- data/lib/ohai/plugins/vmware.rb +2 -2
- data/lib/ohai/plugins/windows/cpu.rb +14 -14
- data/lib/ohai/plugins/windows/drivers.rb +8 -8
- data/lib/ohai/plugins/windows/filesystem.rb +4 -4
- data/lib/ohai/plugins/windows/memory.rb +1 -1
- data/lib/ohai/plugins/windows/network.rb +10 -10
- data/lib/ohai/plugins/windows/platform.rb +1 -2
- data/lib/ohai/plugins/windows/virtualization.rb +17 -17
- data/lib/ohai/provides_map.rb +7 -7
- data/lib/ohai/runner.rb +3 -3
- data/lib/ohai/system.rb +21 -20
- data/lib/ohai/util/file_helper.rb +1 -2
- data/lib/ohai/util/ip_helper.rb +4 -4
- data/lib/ohai/util/win32.rb +5 -5
- data/lib/ohai/util/win32/group_helper.rb +4 -5
- data/lib/ohai/version.rb +1 -1
- data/ohai.gemspec +7 -5
- data/spec/functional/application_spec.rb +23 -23
- data/spec/functional/loader_spec.rb +1 -1
- data/spec/functional/plugins/powershell_spec.rb +13 -13
- data/spec/functional/plugins/root_group_spec.rb +5 -5
- data/spec/ohai_spec.rb +1 -1
- data/spec/spec_helper.rb +9 -9
- data/spec/support/integration_helper.rb +7 -7
- data/spec/support/platform_helpers.rb +1 -1
- data/spec/unit/application_spec.rb +17 -17
- data/spec/unit/config_spec.rb +2 -2
- data/spec/unit/dsl/plugin_spec.rb +28 -28
- data/spec/unit/hints_spec.rb +3 -3
- data/spec/unit/loader_spec.rb +9 -9
- data/spec/unit/mixin/command_spec.rb +5 -5
- data/spec/unit/mixin/ec2_metadata_spec.rb +6 -6
- data/spec/unit/mixin/softlayer_metadata_spec.rb +19 -23
- data/spec/unit/plugin_config_spec.rb +5 -5
- data/spec/unit/plugins/abort_spec.rb +3 -3
- data/spec/unit/plugins/aix/cpu_spec.rb +1 -1
- data/spec/unit/plugins/aix/filesystem_spec.rb +25 -25
- data/spec/unit/plugins/aix/hostname_spec.rb +1 -2
- data/spec/unit/plugins/aix/kernel_spec.rb +3 -3
- data/spec/unit/plugins/aix/memory_spec.rb +8 -8
- data/spec/unit/plugins/aix/network_spec.rb +38 -38
- data/spec/unit/plugins/aix/os_spec.rb +1 -2
- data/spec/unit/plugins/aix/platform_spec.rb +1 -1
- data/spec/unit/plugins/aix/uptime_spec.rb +1 -1
- data/spec/unit/plugins/aix/virtualization_spec.rb +11 -11
- data/spec/unit/plugins/azure_spec.rb +118 -20
- data/spec/unit/plugins/bsd/filesystem_spec.rb +1 -1
- data/spec/unit/plugins/bsd/virtualization_spec.rb +4 -4
- data/spec/unit/plugins/c_spec.rb +12 -12
- data/spec/unit/plugins/chef_spec.rb +2 -2
- data/spec/unit/plugins/cloud_spec.rb +37 -37
- data/spec/unit/plugins/cloud_v2_spec.rb +64 -65
- data/spec/unit/plugins/darwin/cpu_spec.rb +1 -2
- data/spec/unit/plugins/darwin/filesystem2_spec.rb +7 -7
- data/spec/unit/plugins/darwin/filesystem_spec.rb +5 -5
- data/spec/unit/plugins/darwin/hostname_spec.rb +1 -4
- data/spec/unit/plugins/darwin/kernel_spec.rb +6 -10
- data/spec/unit/plugins/darwin/memory_spec.rb +5 -5
- data/spec/unit/plugins/darwin/network_spec.rb +352 -353
- data/spec/unit/plugins/darwin/platform_spec.rb +1 -2
- data/spec/unit/plugins/darwin/system_profiler_spec.rb +3 -3
- data/spec/unit/plugins/darwin/virtualization_spec.rb +6 -6
- data/spec/unit/plugins/digital_ocean_spec.rb +38 -37
- data/spec/unit/plugins/dmi_spec.rb +3 -3
- data/spec/unit/plugins/ec2_spec.rb +97 -88
- data/spec/unit/plugins/elixir_spec.rb +1 -2
- data/spec/unit/plugins/erlang_spec.rb +2 -2
- data/spec/unit/plugins/eucalyptus_spec.rb +19 -19
- data/spec/unit/plugins/fail_spec.rb +2 -2
- data/spec/unit/plugins/freebsd/cpu_spec.rb +14 -14
- data/spec/unit/plugins/freebsd/hostname_spec.rb +1 -2
- data/spec/unit/plugins/freebsd/kernel_spec.rb +2 -3
- data/spec/unit/plugins/freebsd/os_spec.rb +4 -5
- data/spec/unit/plugins/freebsd/platform_spec.rb +1 -2
- data/spec/unit/plugins/gce_spec.rb +9 -9
- data/spec/unit/plugins/go_spec.rb +1 -1
- data/spec/unit/plugins/groovy_spec.rb +1 -2
- data/spec/unit/plugins/hostname_spec.rb +1 -2
- data/spec/unit/plugins/init_package_spec.rb +1 -1
- data/spec/unit/plugins/ip_scopes_spec.rb +38 -38
- data/spec/unit/plugins/java_spec.rb +52 -1
- data/spec/unit/plugins/joyent_spec.rb +9 -11
- data/spec/unit/plugins/kernel_spec.rb +11 -12
- data/spec/unit/plugins/linode_spec.rb +29 -29
- data/spec/unit/plugins/linux/block_device_spec.rb +21 -21
- data/spec/unit/plugins/linux/cpu_spec.rb +3 -3
- data/spec/unit/plugins/linux/filesystem2_spec.rb +7 -7
- data/spec/unit/plugins/linux/filesystem_spec.rb +85 -86
- data/spec/unit/plugins/linux/hostname_spec.rb +1 -3
- data/spec/unit/plugins/linux/kernel_spec.rb +1 -1
- data/spec/unit/plugins/linux/lsb_spec.rb +1 -2
- data/spec/unit/plugins/linux/mdadm_spec.rb +4 -4
- data/spec/unit/plugins/linux/memory_spec.rb +29 -33
- data/spec/unit/plugins/linux/network_spec.rb +463 -245
- data/spec/unit/plugins/linux/platform_spec.rb +64 -65
- data/spec/unit/plugins/linux/uptime_spec.rb +1 -2
- data/spec/unit/plugins/linux/virtualization_spec.rb +42 -42
- data/spec/unit/plugins/lua_spec.rb +1 -2
- data/spec/unit/plugins/mono_spec.rb +1 -2
- data/spec/unit/plugins/netbsd/hostname_spec.rb +1 -2
- data/spec/unit/plugins/netbsd/kernel_spec.rb +1 -2
- data/spec/unit/plugins/netbsd/platform_spec.rb +1 -1
- data/spec/unit/plugins/network_spec.rb +118 -118
- data/spec/unit/plugins/nodejs_spec.rb +1 -1
- data/spec/unit/plugins/ohai_spec.rb +1 -1
- data/spec/unit/plugins/ohai_time_spec.rb +1 -2
- data/spec/unit/plugins/openbsd/hostname_spec.rb +1 -2
- data/spec/unit/plugins/openbsd/kernel_spec.rb +1 -2
- data/spec/unit/plugins/openbsd/platform_spec.rb +1 -2
- data/spec/unit/plugins/openstack_spec.rb +35 -37
- data/spec/unit/plugins/os_spec.rb +7 -8
- data/spec/unit/plugins/packages_spec.rb +118 -118
- data/spec/unit/plugins/passwd_spec.rb +18 -18
- data/spec/unit/plugins/perl_spec.rb +1 -1
- data/spec/unit/plugins/php_spec.rb +4 -4
- data/spec/unit/plugins/platform_spec.rb +8 -9
- data/spec/unit/plugins/powershell_spec.rb +3 -3
- data/spec/unit/plugins/python_spec.rb +1 -1
- data/spec/unit/plugins/rackspace_spec.rb +66 -68
- data/spec/unit/plugins/root_group_spec.rb +26 -26
- data/spec/unit/plugins/ruby_spec.rb +14 -15
- data/spec/unit/plugins/rust_spec.rb +2 -2
- data/spec/unit/plugins/sigar/network_route_spec.rb +36 -36
- data/spec/unit/plugins/softlayer_spec.rb +10 -10
- data/spec/unit/plugins/solaris2/cpu_spec.rb +20 -21
- data/spec/unit/plugins/solaris2/dmi_spec.rb +5 -6
- data/spec/unit/plugins/solaris2/filesystem.rb +5 -5
- data/spec/unit/plugins/solaris2/hostname_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/kernel_spec.rb +3 -3
- data/spec/unit/plugins/solaris2/memory_spec.rb +5 -5
- data/spec/unit/plugins/solaris2/network_spec.rb +7 -8
- data/spec/unit/plugins/solaris2/platform_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/virtualization_spec.rb +3 -5
- data/spec/unit/plugins/solaris2/zpools_spec.rb +6 -6
- data/spec/unit/plugins/ssh_host_keys_spec.rb +1 -1
- data/spec/unit/plugins/virtualbox_spec.rb +19 -19
- data/spec/unit/plugins/vmware_spec.rb +28 -28
- data/spec/unit/plugins/windows/cpu_spec.rb +46 -48
- data/spec/unit/plugins/windows/memory_spec.rb +5 -5
- data/spec/unit/plugins/windows/virtualization_spec.rb +163 -163
- data/spec/unit/provides_map_spec.rb +10 -10
- data/spec/unit/runner_spec.rb +10 -10
- data/spec/unit/system_spec.rb +19 -19
- data/spec/unit/util/file_helper_spec.rb +5 -6
- data/spec/unit/util/ip_helper_spec.rb +39 -39
- metadata +31 -4
@@ -113,7 +113,6 @@ Ohai.plugin(:CloudV2) do
|
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
116
|
-
|
117
116
|
#---------------------------------------
|
118
117
|
# Google Compute Engine (gce)
|
119
118
|
#--------------------------------------
|
@@ -123,19 +122,19 @@ Ohai.plugin(:CloudV2) do
|
|
123
122
|
end
|
124
123
|
|
125
124
|
def get_gce_values
|
126
|
-
public_ips = gce[
|
127
|
-
if interface.has_key?(
|
128
|
-
interface[
|
125
|
+
public_ips = gce["instance"]["networkInterfaces"].collect do |interface|
|
126
|
+
if interface.has_key?("accessConfigs")
|
127
|
+
interface["accessConfigs"].collect { |ac| ac["externalIp"] unless ac["externalIp"] == "" }
|
129
128
|
end
|
130
129
|
end.flatten.compact
|
131
130
|
|
132
|
-
private_ips = gce[
|
133
|
-
interface[
|
131
|
+
private_ips = gce["instance"]["networkInterfaces"].collect do |interface|
|
132
|
+
interface["ip"]
|
134
133
|
end.compact
|
135
134
|
|
136
|
-
public_ips.each { |ipaddr|
|
137
|
-
private_ips.each { |ipaddr|
|
138
|
-
@cloud_attr_obj.local_hostname = gce[
|
135
|
+
public_ips.each { |ipaddr| @cloud_attr_obj.add_ipv4_addr(ipaddr, :public) }
|
136
|
+
private_ips.each { |ipaddr| @cloud_attr_obj.add_ipv4_addr(ipaddr, :private) }
|
137
|
+
@cloud_attr_obj.local_hostname = gce["instance"]["hostname"]
|
139
138
|
@cloud_attr_obj.provider = "gce"
|
140
139
|
end
|
141
140
|
|
@@ -154,10 +153,10 @@ Ohai.plugin(:CloudV2) do
|
|
154
153
|
|
155
154
|
# Fill cloud hash with ec2 values
|
156
155
|
def get_ec2_values
|
157
|
-
@cloud_attr_obj.add_ipv4_addr(ec2[
|
158
|
-
@cloud_attr_obj.add_ipv4_addr(ec2[
|
159
|
-
@cloud_attr_obj.public_hostname = ec2[
|
160
|
-
@cloud_attr_obj.local_hostname = ec2[
|
156
|
+
@cloud_attr_obj.add_ipv4_addr(ec2["public_ipv4"], :public)
|
157
|
+
@cloud_attr_obj.add_ipv4_addr(ec2["local_ipv4"], :private)
|
158
|
+
@cloud_attr_obj.public_hostname = ec2["public_hostname"]
|
159
|
+
@cloud_attr_obj.local_hostname = ec2["local_hostname"]
|
161
160
|
@cloud_attr_obj.provider = "ec2"
|
162
161
|
end
|
163
162
|
|
@@ -176,12 +175,12 @@ Ohai.plugin(:CloudV2) do
|
|
176
175
|
|
177
176
|
# Fill cloud hash with rackspace values
|
178
177
|
def get_rackspace_values
|
179
|
-
@cloud_attr_obj.add_ipv4_addr(rackspace[
|
180
|
-
@cloud_attr_obj.add_ipv4_addr(rackspace[
|
181
|
-
@cloud_attr_obj.add_ipv6_addr(rackspace[
|
182
|
-
@cloud_attr_obj.add_ipv6_addr(rackspace[
|
183
|
-
@cloud_attr_obj.public_hostname = rackspace[
|
184
|
-
@cloud_attr_obj.local_hostname = rackspace[
|
178
|
+
@cloud_attr_obj.add_ipv4_addr(rackspace["public_ipv4"], :public)
|
179
|
+
@cloud_attr_obj.add_ipv4_addr(rackspace["local_ipv4"], :private)
|
180
|
+
@cloud_attr_obj.add_ipv6_addr(rackspace["public_ipv6"], :public)
|
181
|
+
@cloud_attr_obj.add_ipv6_addr(rackspace["local_ipv6"], :private)
|
182
|
+
@cloud_attr_obj.public_hostname = rackspace["public_hostname"]
|
183
|
+
@cloud_attr_obj.local_hostname = rackspace["local_hostname"]
|
185
184
|
@cloud_attr_obj.provider = "rackspace"
|
186
185
|
end
|
187
186
|
|
@@ -200,10 +199,10 @@ Ohai.plugin(:CloudV2) do
|
|
200
199
|
|
201
200
|
# Fill cloud hash with linode values
|
202
201
|
def get_linode_values
|
203
|
-
@cloud_attr_obj.add_ipv4_addr(linode[
|
204
|
-
@cloud_attr_obj.add_ipv4_addr(linode[
|
205
|
-
@cloud_attr_obj.public_hostname = linode[
|
206
|
-
@cloud_attr_obj.local_hostname = linode[
|
202
|
+
@cloud_attr_obj.add_ipv4_addr(linode["public_ip"], :public)
|
203
|
+
@cloud_attr_obj.add_ipv4_addr(linode["private_ip"], :private)
|
204
|
+
@cloud_attr_obj.public_hostname = linode["public_hostname"]
|
205
|
+
@cloud_attr_obj.local_hostname = linode["local_hostname"]
|
207
206
|
@cloud_attr_obj.provider = "linode"
|
208
207
|
end
|
209
208
|
|
@@ -221,10 +220,10 @@ Ohai.plugin(:CloudV2) do
|
|
221
220
|
end
|
222
221
|
|
223
222
|
def get_eucalyptus_values
|
224
|
-
@cloud_attr_obj.add_ipv4_addr(eucalyptus[
|
225
|
-
@cloud_attr_obj.add_ipv4_addr(eucalyptus[
|
226
|
-
@cloud_attr_obj.public_hostname = eucalyptus[
|
227
|
-
@cloud_attr_obj.local_hostname = eucalyptus[
|
223
|
+
@cloud_attr_obj.add_ipv4_addr(eucalyptus["public_ipv4"], :public)
|
224
|
+
@cloud_attr_obj.add_ipv4_addr(eucalyptus["local_ipv4"], :private)
|
225
|
+
@cloud_attr_obj.public_hostname = eucalyptus["public_hostname"]
|
226
|
+
@cloud_attr_obj.local_hostname = eucalyptus["local_hostname"]
|
228
227
|
@cloud_attr_obj.provider = "eucalyptus"
|
229
228
|
end
|
230
229
|
|
@@ -243,10 +242,10 @@ Ohai.plugin(:CloudV2) do
|
|
243
242
|
|
244
243
|
# Fill cloud hash with openstack values
|
245
244
|
def get_openstack_values
|
246
|
-
@cloud_attr_obj.add_ipv4_addr(openstack[
|
247
|
-
@cloud_attr_obj.add_ipv4_addr(openstack[
|
248
|
-
@cloud_attr_obj.public_hostname = openstack[
|
249
|
-
@cloud_attr_obj.local_hostname = openstack[
|
245
|
+
@cloud_attr_obj.add_ipv4_addr(openstack["public_ipv4"], :public)
|
246
|
+
@cloud_attr_obj.add_ipv4_addr(openstack["local_ipv4"], :private)
|
247
|
+
@cloud_attr_obj.public_hostname = openstack["public_hostname"]
|
248
|
+
@cloud_attr_obj.local_hostname = openstack["local_hostname"]
|
250
249
|
@cloud_attr_obj.provider = "openstack"
|
251
250
|
end
|
252
251
|
|
@@ -265,13 +264,12 @@ Ohai.plugin(:CloudV2) do
|
|
265
264
|
|
266
265
|
# Fill cloud hash with azure values
|
267
266
|
def get_azure_values
|
268
|
-
@cloud_attr_obj.add_ipv4_addr(azure[
|
269
|
-
@cloud_attr_obj.add_ipv4_addr(azure[
|
270
|
-
@cloud_attr_obj.public_hostname = azure[
|
267
|
+
@cloud_attr_obj.add_ipv4_addr(azure["public_ip"], :public)
|
268
|
+
@cloud_attr_obj.add_ipv4_addr(azure["private_ip"], :private)
|
269
|
+
@cloud_attr_obj.public_hostname = azure["public_fqdn"]
|
271
270
|
@cloud_attr_obj.provider = "azure"
|
272
271
|
end
|
273
272
|
|
274
|
-
|
275
273
|
# ----------------------------------------
|
276
274
|
# digital_ocean
|
277
275
|
# ----------------------------------------
|
@@ -287,13 +285,13 @@ Ohai.plugin(:CloudV2) do
|
|
287
285
|
|
288
286
|
# Fill cloud hash with digital_ocean values
|
289
287
|
def get_digital_ocean_values
|
290
|
-
digital_ocean[
|
291
|
-
type = network ==
|
288
|
+
digital_ocean["networks"].each do |network, addresses|
|
289
|
+
type = network == "v4" ? "ipv4" : "ipv6"
|
292
290
|
addresses.each do |address|
|
293
|
-
@cloud_attr_obj.send("add_#{type}_addr", address[
|
291
|
+
@cloud_attr_obj.send("add_#{type}_addr", address["ip_address"], address["type"].to_sym)
|
294
292
|
end
|
295
293
|
end
|
296
|
-
@cloud_attr_obj.public_hostname = digital_ocean[
|
294
|
+
@cloud_attr_obj.public_hostname = digital_ocean["name"]
|
297
295
|
@cloud_attr_obj.provider = "digital_ocean"
|
298
296
|
end
|
299
297
|
|
@@ -41,6 +41,6 @@ Ohai.plugin(:CPU) do
|
|
41
41
|
so = shell_out("sysctl -n machdep.cpu.stepping")
|
42
42
|
cpu[:stepping] = so.stdout.to_i
|
43
43
|
so = shell_out("sysctl -n machdep.cpu.features")
|
44
|
-
cpu[:flags] = so.stdout.downcase.split(
|
44
|
+
cpu[:flags] = so.stdout.downcase.split(" ")
|
45
45
|
end
|
46
46
|
end
|
@@ -26,7 +26,7 @@ Ohai.plugin(:Filesystem2) do
|
|
26
26
|
fs.each_value do |entry|
|
27
27
|
view[entry[:device]] = Mash.new unless view[entry[:device]]
|
28
28
|
entry.each do |key, val|
|
29
|
-
next if
|
29
|
+
next if %w{device mount}.include?(key)
|
30
30
|
view[entry[:device]][key] = val
|
31
31
|
end
|
32
32
|
if entry[:mount]
|
@@ -43,7 +43,7 @@ Ohai.plugin(:Filesystem2) do
|
|
43
43
|
next unless entry[:mount]
|
44
44
|
view[entry[:mount]] = Mash.new unless view[entry[:mount]]
|
45
45
|
entry.each do |key, val|
|
46
|
-
next if
|
46
|
+
next if %w{mount device}.include?(key)
|
47
47
|
view[entry[:mount]][key] = val
|
48
48
|
end
|
49
49
|
if entry[:device]
|
@@ -98,9 +98,9 @@ Ohai.plugin(:Filesystem2) do
|
|
98
98
|
by_mountpoint = generate_mountpoint_view(fs)
|
99
99
|
|
100
100
|
fs2 = Mash.new
|
101
|
-
fs2[
|
102
|
-
fs2[
|
103
|
-
fs2[
|
101
|
+
fs2["by_device"] = by_device
|
102
|
+
fs2["by_mountpoint"] = by_mountpoint
|
103
|
+
fs2["by_pair"] = by_pair
|
104
104
|
|
105
105
|
filesystem2 fs2
|
106
106
|
end
|
@@ -17,7 +17,7 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
Ohai.plugin(:Memory) do
|
20
|
-
provides
|
20
|
+
provides "memory"
|
21
21
|
|
22
22
|
collect_data(:darwin) do
|
23
23
|
memory Mash.new
|
@@ -37,17 +37,17 @@ Ohai.plugin(:Memory) do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
vm_stat.split("\n").each do |line|
|
40
|
-
[
|
40
|
+
["wired down", "active", "inactive"].each do |match|
|
41
41
|
unless line.index("Pages #{match}:").nil?
|
42
42
|
pages = line.split.last.to_i
|
43
43
|
megabyte_val = (pages * page_size) / 1024 / 1024.0
|
44
44
|
total_consumed += megabyte_val
|
45
45
|
case match
|
46
|
-
when
|
46
|
+
when "wired down"
|
47
47
|
active += megabyte_val.to_i
|
48
|
-
when
|
48
|
+
when "active"
|
49
49
|
active += megabyte_val.to_i
|
50
|
-
when
|
50
|
+
when "inactive"
|
51
51
|
inactive += megabyte_val.to_i
|
52
52
|
end
|
53
53
|
end
|
@@ -61,4 +61,3 @@ Ohai.plugin(:Memory) do
|
|
61
61
|
memory[:free] = "#{free_memory.to_i}MB" if total_consumed > 0
|
62
62
|
end
|
63
63
|
end
|
64
|
-
|
@@ -22,7 +22,7 @@ Ohai.plugin(:Network) do
|
|
22
22
|
|
23
23
|
def parse_media(media_string)
|
24
24
|
media = Hash.new
|
25
|
-
line_array = media_string.split(
|
25
|
+
line_array = media_string.split(" ")
|
26
26
|
|
27
27
|
0.upto(line_array.length - 1) do |i|
|
28
28
|
unless line_array[i].eql?("none")
|
@@ -67,7 +67,7 @@ Ohai.plugin(:Network) do
|
|
67
67
|
end
|
68
68
|
|
69
69
|
def excluded_setting?(setting)
|
70
|
-
setting.match(
|
70
|
+
setting.match("_sw_cksum")
|
71
71
|
end
|
72
72
|
|
73
73
|
def locate_interface(ifaces, ifname, mac)
|
@@ -84,7 +84,7 @@ Ohai.plugin(:Network) do
|
|
84
84
|
end
|
85
85
|
|
86
86
|
collect_data(:darwin) do
|
87
|
-
require
|
87
|
+
require "scanf"
|
88
88
|
|
89
89
|
network Mash.new unless network
|
90
90
|
network[:interfaces] = Mash.new unless network[:interfaces]
|
@@ -112,7 +112,7 @@ Ohai.plugin(:Network) do
|
|
112
112
|
iface[cint] = Mash.new unless iface[cint]; iface[cint][:addresses] = Mash.new unless iface[cint][:addresses]
|
113
113
|
iface[cint][:mtu] = $2
|
114
114
|
if line =~ /\sflags\=\d+\<((UP|BROADCAST|DEBUG|SMART|SIMPLEX|LOOPBACK|POINTOPOINT|NOTRAILERS|RUNNING|NOARP|PROMISC|ALLMULTI|SLAVE|MASTER|MULTICAST|DYNAMIC|,)+)\>\s/
|
115
|
-
flags = $1.split(
|
115
|
+
flags = $1.split(",")
|
116
116
|
else
|
117
117
|
flags = Array.new
|
118
118
|
end
|
@@ -134,11 +134,11 @@ Ohai.plugin(:Network) do
|
|
134
134
|
end
|
135
135
|
if line =~ /\s+inet (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) netmask 0x(([0-9a-f]){1,8})\s*$/
|
136
136
|
iface[cint][:addresses] = Mash.new unless iface[cint][:addresses]
|
137
|
-
iface[cint][:addresses][$1] = { "family" => "inet", "netmask" => $2.scanf(
|
137
|
+
iface[cint][:addresses][$1] = { "family" => "inet", "netmask" => $2.scanf("%2x" * 4) * "." }
|
138
138
|
end
|
139
139
|
if line =~ /\s+inet (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) netmask 0x(([0-9a-f]){1,8}) broadcast (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/
|
140
140
|
iface[cint][:addresses] = Mash.new unless iface[cint][:addresses]
|
141
|
-
iface[cint][:addresses][$1] = { "family" => "inet", "netmask" => $2.scanf(
|
141
|
+
iface[cint][:addresses][$1] = { "family" => "inet", "netmask" => $2.scanf("%2x" * 4) * ".", "broadcast" => $4 }
|
142
142
|
end
|
143
143
|
if line =~ /\s+inet6 ([a-f0-9\:]+)(\s*|(\%[a-z0-9]+)\s*) prefixlen (\d+)\s*/
|
144
144
|
iface[cint][:addresses] = Mash.new unless iface[cint][:addresses]
|
@@ -190,7 +190,7 @@ Ohai.plugin(:Network) do
|
|
190
190
|
next if iface[ifname].nil? # this shouldn't happen, but just in case
|
191
191
|
net_counters[ifname] = Mash.new unless net_counters[ifname]
|
192
192
|
net_counters[ifname] = { :rx => { :bytes => $5, :packets => $3, :errors => $4, :drop => 0, :overrun => 0, :frame => 0, :compressed => 0, :multicast => 0 },
|
193
|
-
|
193
|
+
:tx => { :bytes => $8, :packets => $6, :errors => $7, :drop => 0, :overrun => 0, :collisions => $9, :carrier => 0, :compressed => 0 },
|
194
194
|
}
|
195
195
|
end
|
196
196
|
end
|
@@ -21,51 +21,50 @@ Ohai.plugin(:SystemProfile) do
|
|
21
21
|
|
22
22
|
collect_data(:darwin) do
|
23
23
|
begin
|
24
|
-
require
|
24
|
+
require "plist"
|
25
25
|
|
26
26
|
system_profile Array.new
|
27
|
-
items =
|
27
|
+
items = Array.new
|
28
28
|
detail_level = {
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
'full' => [
|
29
|
+
"mini" => %w{
|
30
|
+
SPParallelATAData
|
31
|
+
SPAudioData
|
32
|
+
SPBluetoothData
|
33
|
+
SPCardReaderData
|
34
|
+
SPDiagnosticsData
|
35
|
+
SPDiscBurningData
|
36
|
+
SPEthernetData
|
37
|
+
SPFibreChannelData
|
38
|
+
SPFireWireData
|
39
|
+
SPDisplaysData
|
40
|
+
SPHardwareRAIDData
|
41
|
+
SPMemoryData
|
42
|
+
SPModemData
|
43
|
+
SPNetworkData
|
44
|
+
SPPCIData
|
45
|
+
SPParallelSCSIData
|
46
|
+
SPPrintersSoftwareData
|
47
|
+
SPPrintersData
|
48
|
+
SPSASData
|
49
|
+
SPSerialATAData
|
50
|
+
SPSoftwareData
|
51
|
+
SPThunderboltData
|
52
|
+
SPUSBData
|
53
|
+
SPWWANData
|
54
|
+
SPAirPortData},
|
55
|
+
"full" => [
|
57
56
|
"SPHardwareDataType"
|
58
|
-
]
|
57
|
+
],
|
59
58
|
}
|
60
59
|
|
61
60
|
detail_level.each do |level, data_types|
|
62
61
|
so = shell_out("system_profiler -xml -detailLevel #{level} #{data_types.join(' ')}")
|
63
|
-
Plist
|
62
|
+
Plist.parse_xml(so.stdout).each do |e|
|
64
63
|
items << e
|
65
64
|
end
|
66
65
|
end
|
67
66
|
|
68
|
-
system_profile items.sort_by { |h| h[
|
67
|
+
system_profile items.sort_by { |h| h["_dataType"] }
|
69
68
|
rescue LoadError => e
|
70
69
|
Ohai::Log.debug("Can't load gem: #{e})")
|
71
70
|
end
|
@@ -16,7 +16,7 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
require
|
19
|
+
require "ohai/util/file_helper"
|
20
20
|
|
21
21
|
include Ohai::Util::FileHelper
|
22
22
|
|
@@ -24,11 +24,11 @@ Ohai.plugin(:Virtualization) do
|
|
24
24
|
provides "virtualization"
|
25
25
|
|
26
26
|
def prlctl_exists?
|
27
|
-
which(
|
27
|
+
which("prlctl")
|
28
28
|
end
|
29
29
|
|
30
30
|
def ioreg_exists?
|
31
|
-
which(
|
31
|
+
which("ioreg")
|
32
32
|
end
|
33
33
|
|
34
34
|
collect_data(:darwin) do
|
@@ -36,18 +36,18 @@ Ohai.plugin(:Virtualization) do
|
|
36
36
|
virtualization[:systems] = Mash.new unless virtualization[:systems]
|
37
37
|
|
38
38
|
if prlctl_exists?
|
39
|
-
virtualization[:system] =
|
40
|
-
virtualization[:role] =
|
41
|
-
virtualization[:systems][:parallels] =
|
39
|
+
virtualization[:system] = "parallels"
|
40
|
+
virtualization[:role] = "host"
|
41
|
+
virtualization[:systems][:parallels] = "host"
|
42
42
|
end
|
43
43
|
|
44
44
|
# Detect Parallels virtual machine from pci devices
|
45
45
|
if ioreg_exists?
|
46
46
|
so = shell_out("ioreg -l")
|
47
47
|
if so.stdout =~ /pci1ab8,4000/
|
48
|
-
virtualization[:system] =
|
49
|
-
virtualization[:role] =
|
50
|
-
virtualization[:systems][:parallels] =
|
48
|
+
virtualization[:system] = "parallels"
|
49
|
+
virtualization[:role] = "guest"
|
50
|
+
virtualization[:systems][:parallels] = "guest"
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
@@ -14,59 +14,59 @@
|
|
14
14
|
# See the License for the specific language governing permissions and
|
15
15
|
# limitations under the License.
|
16
16
|
|
17
|
-
require
|
17
|
+
require "ohai/util/ip_helper"
|
18
18
|
|
19
19
|
Ohai.plugin(:DigitalOcean) do
|
20
20
|
include Ohai::Util::IpHelper
|
21
21
|
|
22
|
-
DIGITALOCEAN_FILE =
|
22
|
+
DIGITALOCEAN_FILE = "/etc/digitalocean" unless defined?(DIGITALOCEAN_FILE)
|
23
23
|
|
24
24
|
provides "digital_ocean"
|
25
|
-
|
26
25
|
depends "network/interfaces"
|
27
26
|
|
28
27
|
def extract_droplet_ip_addresses
|
29
|
-
addresses = Mash.new({
|
28
|
+
addresses = Mash.new({ "v4" => [], "v6" => [] })
|
30
29
|
network[:interfaces].each_value do |iface|
|
31
30
|
iface[:addresses].each do |address, details|
|
32
|
-
next if
|
31
|
+
next if details[:family] == "lladdr" || loopback?(address)
|
33
32
|
|
34
33
|
ip = IPAddress(address)
|
35
34
|
type = digital_ocean_address_type(ip)
|
36
35
|
address_hash = build_address_hash(ip, details)
|
37
36
|
addresses[type] << address_hash
|
38
|
-
end
|
37
|
+
end
|
39
38
|
end
|
40
39
|
addresses
|
41
40
|
end
|
42
41
|
|
43
42
|
def build_address_hash(ip, details)
|
44
43
|
address_hash = Mash.new({
|
45
|
-
|
46
|
-
|
47
|
-
})
|
44
|
+
"ip_address" => ip.address,
|
45
|
+
"type" => private_address?(ip.address) ? "private" : "public",
|
46
|
+
},)
|
48
47
|
|
49
48
|
if ip.ipv4?
|
50
|
-
address_hash[
|
49
|
+
address_hash["netmask"] = details[:netmask]
|
51
50
|
elsif ip.ipv6?
|
52
|
-
address_hash[
|
51
|
+
address_hash["cidr"] = ip.prefix
|
53
52
|
end
|
54
53
|
address_hash
|
55
54
|
end
|
56
55
|
|
57
56
|
def digital_ocean_address_type(ip)
|
58
|
-
ip.ipv4? ?
|
57
|
+
ip.ipv4? ? "v4" : "v6"
|
59
58
|
end
|
60
59
|
|
61
60
|
def looks_like_digital_ocean?
|
62
|
-
hint?(
|
61
|
+
hint?("digital_ocean") || File.exist?(DIGITALOCEAN_FILE)
|
63
62
|
end
|
64
63
|
|
65
64
|
collect_data do
|
66
65
|
if looks_like_digital_ocean?
|
66
|
+
Ohai::Log.debug("digitalocean plugin: looks_like_digital_ocean? == true")
|
67
67
|
digital_ocean Mash.new
|
68
|
-
hint = hint?(
|
69
|
-
hint.each {|k, v| digital_ocean[k] = v unless k ==
|
68
|
+
hint = hint?("digital_ocean") || {}
|
69
|
+
hint.each { |k, v| digital_ocean[k] = v unless k == "ip_addresses" }
|
70
70
|
|
71
71
|
# Extract actual ip addresses
|
72
72
|
# The networks sub-hash is structured similarly to how
|
@@ -74,7 +74,7 @@ Ohai.plugin(:DigitalOcean) do
|
|
74
74
|
# https://developers.digitalocean.com/#droplets
|
75
75
|
digital_ocean[:networks] = extract_droplet_ip_addresses
|
76
76
|
else
|
77
|
-
Ohai::Log.debug("No hints present for
|
77
|
+
Ohai::Log.debug("digitalocean plugin: No hints present for and doesn't look like digitalocean")
|
78
78
|
false
|
79
79
|
end
|
80
80
|
end
|