ohai 8.26.1 → 13.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +3 -4
- data/Rakefile +14 -0
- data/lib/ohai/application.rb +1 -0
- data/lib/ohai/config.rb +2 -88
- data/lib/ohai/dsl/plugin.rb +0 -4
- data/lib/ohai/exception.rb +0 -1
- data/lib/ohai/loader.rb +11 -2
- data/lib/ohai/log.rb +3 -1
- data/lib/ohai/mixin/command.rb +1 -318
- data/lib/ohai/mixin/do_metadata.rb +47 -0
- data/lib/ohai/mixin/ec2_metadata.rb +2 -29
- data/lib/ohai/mixin/gce_metadata.rb +0 -37
- data/lib/ohai/mixin/http_helper.rb +56 -0
- data/lib/ohai/mixin/network_constants.rb +0 -5
- data/lib/ohai/plugins/cloud.rb +144 -157
- data/lib/ohai/plugins/darwin/filesystem.rb +68 -22
- data/lib/ohai/plugins/digital_ocean.rb +24 -42
- data/lib/ohai/plugins/dmi.rb +81 -77
- data/lib/ohai/plugins/ec2.rb +33 -60
- data/lib/ohai/plugins/gce.rb +3 -1
- data/lib/ohai/plugins/hostname.rb +1 -16
- data/lib/ohai/plugins/linux/filesystem.rb +130 -81
- data/lib/ohai/plugins/linux/mdadm.rb +3 -45
- data/lib/ohai/plugins/linux/network.rb +1 -26
- data/lib/ohai/plugins/linux/platform.rb +4 -2
- data/lib/ohai/plugins/linux/virtualization.rb +1 -5
- data/lib/ohai/plugins/scala.rb +1 -13
- data/lib/ohai/plugins/solaris2/network.rb +1 -2
- data/lib/ohai/plugins/uptime.rb +0 -9
- data/lib/ohai/plugins/windows/cpu.rb +2 -1
- data/lib/ohai/plugins/windows/network.rb +1 -1
- data/lib/ohai/runner.rb +0 -5
- data/lib/ohai/system.rb +38 -8
- data/lib/ohai/version.rb +2 -2
- data/ohai.gemspec +1 -1
- data/spec/functional/application_spec.rb +0 -40
- data/spec/functional/plugins/powershell_spec.rb +1 -1
- data/spec/functional/plugins/root_group_spec.rb +1 -1
- data/spec/functional/plugins/windows/uptime_spec.rb +1 -1
- data/spec/ohai_spec.rb +1 -1
- data/spec/support/integration_helper.rb +17 -0
- data/spec/support/platform_helpers.rb +17 -0
- data/spec/unit/application_spec.rb +0 -1
- data/spec/unit/config_spec.rb +0 -111
- data/spec/unit/dsl/plugin_spec.rb +1 -1
- data/spec/unit/hints_spec.rb +1 -1
- data/spec/unit/loader_spec.rb +26 -1
- data/spec/unit/mixin/command_spec.rb +1 -69
- data/spec/unit/mixin/ec2_metadata_spec.rb +1 -1
- data/spec/unit/mixin/softlayer_metadata_spec.rb +1 -1
- data/spec/unit/plugin_config_spec.rb +0 -1
- data/spec/unit/plugins/abort_spec.rb +1 -1
- data/spec/unit/plugins/aix/cpu_spec.rb +1 -1
- data/spec/unit/plugins/aix/filesystem_spec.rb +2 -1
- data/spec/unit/plugins/aix/hostname_spec.rb +1 -1
- data/spec/unit/plugins/aix/kernel_spec.rb +1 -1
- data/spec/unit/plugins/aix/memory_spec.rb +1 -1
- data/spec/unit/plugins/aix/network_spec.rb +1 -1
- data/spec/unit/plugins/aix/os_spec.rb +1 -1
- 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 +1 -1
- data/spec/unit/plugins/azure_spec.rb +1 -1
- data/spec/unit/plugins/bsd/filesystem_spec.rb +1 -1
- data/spec/unit/plugins/bsd/virtualization_spec.rb +1 -1
- data/spec/unit/plugins/c_spec.rb +1 -1
- data/spec/unit/plugins/chef_spec.rb +1 -2
- data/spec/unit/plugins/cloud_spec.rb +210 -50
- data/spec/unit/plugins/darwin/cpu_spec.rb +1 -1
- data/spec/unit/plugins/darwin/filesystem_spec.rb +62 -13
- data/spec/unit/plugins/darwin/hardware_spec.rb +2 -2
- data/spec/unit/plugins/darwin/hostname_spec.rb +1 -1
- data/spec/unit/plugins/darwin/kernel_spec.rb +1 -1
- data/spec/unit/plugins/darwin/memory_spec.rb +1 -1
- data/spec/unit/plugins/darwin/network_spec.rb +1 -1
- data/spec/unit/plugins/darwin/platform_spec.rb +1 -1
- data/spec/unit/plugins/darwin/system_profiler_spec.rb +2 -9
- data/spec/unit/plugins/darwin/virtualization_spec.rb +1 -1
- data/spec/unit/plugins/digital_ocean_spec.rb +39 -110
- data/spec/unit/plugins/dmi_spec.rb +1 -1
- data/spec/unit/plugins/ec2_spec.rb +10 -62
- data/spec/unit/plugins/elixir_spec.rb +1 -1
- data/spec/unit/plugins/erlang_spec.rb +1 -1
- data/spec/unit/plugins/eucalyptus_spec.rb +1 -1
- data/spec/unit/plugins/fail_spec.rb +1 -1
- data/spec/unit/plugins/freebsd/cpu_spec.rb +1 -1
- data/spec/unit/plugins/freebsd/hostname_spec.rb +1 -1
- data/spec/unit/plugins/freebsd/kernel_spec.rb +1 -1
- data/spec/unit/plugins/freebsd/os_spec.rb +1 -1
- data/spec/unit/plugins/freebsd/platform_spec.rb +1 -1
- data/spec/unit/plugins/gce_spec.rb +1 -1
- data/spec/unit/plugins/go_spec.rb +1 -1
- data/spec/unit/plugins/groovy_spec.rb +1 -1
- data/spec/unit/plugins/haskell_spec.rb +1 -1
- data/spec/unit/plugins/hostname_spec.rb +16 -41
- data/spec/unit/plugins/init_package_spec.rb +1 -1
- data/spec/unit/plugins/ip_scopes_spec.rb +18 -6
- data/spec/unit/plugins/java_spec.rb +1 -1
- data/spec/unit/plugins/joyent_spec.rb +17 -1
- data/spec/unit/plugins/kernel_spec.rb +1 -1
- data/spec/unit/plugins/linode_spec.rb +1 -1
- data/spec/unit/plugins/linux/block_device_spec.rb +1 -1
- data/spec/unit/plugins/linux/cpu_spec.rb +1 -2
- data/spec/unit/plugins/linux/filesystem_spec.rb +207 -201
- data/spec/unit/plugins/linux/fips_spec.rb +1 -1
- data/spec/unit/plugins/linux/hostname_spec.rb +1 -1
- data/spec/unit/plugins/linux/hostnamectl_spec.rb +1 -1
- data/spec/unit/plugins/linux/kernel_spec.rb +1 -1
- data/spec/unit/plugins/linux/lsb_spec.rb +1 -1
- data/spec/unit/plugins/linux/machineid_spec.rb +1 -1
- data/spec/unit/plugins/linux/mdadm_spec.rb +2 -68
- data/spec/unit/plugins/linux/memory_spec.rb +1 -1
- data/spec/unit/plugins/linux/network_spec.rb +3 -44
- data/spec/unit/plugins/linux/platform_spec.rb +4 -4
- data/spec/unit/plugins/linux/sessions_spec.rb +1 -1
- data/spec/unit/plugins/linux/uptime_spec.rb +1 -1
- data/spec/unit/plugins/linux/virtualization_spec.rb +1 -28
- data/spec/unit/plugins/lua_spec.rb +1 -1
- data/spec/unit/plugins/mono_spec.rb +1 -1
- data/spec/unit/plugins/netbsd/hostname_spec.rb +1 -1
- data/spec/unit/plugins/netbsd/kernel_spec.rb +1 -1
- data/spec/unit/plugins/netbsd/platform_spec.rb +1 -1
- data/spec/unit/plugins/network_spec.rb +1 -1
- 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 -1
- data/spec/unit/plugins/openbsd/hostname_spec.rb +1 -1
- data/spec/unit/plugins/openbsd/kernel_spec.rb +1 -1
- data/spec/unit/plugins/openbsd/platform_spec.rb +1 -1
- data/spec/unit/plugins/openstack_spec.rb +2 -3
- data/spec/unit/plugins/os_spec.rb +1 -1
- data/spec/unit/plugins/packages_spec.rb +1 -1
- data/spec/unit/plugins/passwd_spec.rb +17 -1
- data/spec/unit/plugins/perl_spec.rb +1 -1
- data/spec/unit/plugins/php_spec.rb +1 -1
- data/spec/unit/plugins/platform_spec.rb +1 -1
- data/spec/unit/plugins/powershell_spec.rb +1 -1
- data/spec/unit/plugins/python_spec.rb +1 -1
- data/spec/unit/plugins/rackspace_spec.rb +1 -2
- data/spec/unit/plugins/root_group_spec.rb +2 -2
- data/spec/unit/plugins/ruby_spec.rb +1 -1
- data/spec/unit/plugins/rust_spec.rb +1 -1
- data/spec/unit/plugins/scala_spec.rb +3 -37
- data/spec/unit/plugins/shard_spec.rb +1 -1
- data/spec/unit/plugins/shells_spec.rb +1 -1
- data/spec/unit/plugins/softlayer_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/cpu_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/dmi_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/hostname_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/kernel_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/memory_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/network_spec.rb +7 -4
- data/spec/unit/plugins/solaris2/platform_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/virtualization_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/zpools_spec.rb +1 -1
- data/spec/unit/plugins/ssh_host_keys_spec.rb +1 -1
- data/spec/unit/plugins/sysconf_spec.rb +1 -1
- data/spec/unit/plugins/timezone_spec.rb +1 -1
- data/spec/unit/plugins/virtualbox_spec.rb +1 -1
- data/spec/unit/plugins/vmware_spec.rb +2 -1
- data/spec/unit/plugins/windows/cpu_spec.rb +9 -2
- data/spec/unit/plugins/windows/fips_spec.rb +1 -1
- data/spec/unit/plugins/windows/memory_spec.rb +1 -1
- data/spec/unit/plugins/windows/uptime_spec.rb +1 -1
- data/spec/unit/plugins/windows/virtualization_spec.rb +1 -1
- data/spec/unit/provides_map_spec.rb +1 -1
- data/spec/unit/runner_spec.rb +1 -1
- data/spec/unit/system_spec.rb +68 -76
- data/spec/unit/util/file_helper_spec.rb +1 -1
- data/spec/unit/util/ip_helper_spec.rb +1 -1
- metadata +6 -20
- data/lib/ohai/plugins/cloud_v2.rb +0 -315
- data/lib/ohai/plugins/darwin/filesystem2.rb +0 -107
- data/lib/ohai/plugins/linux/filesystem2.rb +0 -223
- data/lib/ohai/plugins/linux/lspci.rb +0 -76
- data/lib/ohai/plugins/network_listeners.rb +0 -60
- data/lib/ohai/plugins/sigar/cpu.rb +0 -44
- data/lib/ohai/plugins/sigar/filesystem.rb +0 -50
- data/lib/ohai/plugins/sigar/memory.rb +0 -39
- data/lib/ohai/plugins/sigar/network.rb +0 -168
- data/lib/ohai/plugins/sigar/network_route.rb +0 -64
- data/lib/ohai/plugins/sigar/platform.rb +0 -30
- data/spec/unit/plugins/cloud_v2_spec.rb +0 -389
- data/spec/unit/plugins/darwin/filesystem2_spec.rb +0 -139
- data/spec/unit/plugins/linux/filesystem2_spec.rb +0 -437
- data/spec/unit/plugins/linux/lspci_spec.rb +0 -133
- data/spec/unit/plugins/sigar/network_route_spec.rb +0 -148
@@ -1,148 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Toomas Pelberg (<toomas.pelberg@playtech.com>)
|
3
|
-
# Copyright:: Copyright (c) 2011-2016 Chef Software, Inc.
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
|
19
|
-
require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
|
20
|
-
|
21
|
-
sigar_available = begin
|
22
|
-
require "sigar"
|
23
|
-
true
|
24
|
-
rescue LoadError
|
25
|
-
false
|
26
|
-
end
|
27
|
-
|
28
|
-
require "ohai"
|
29
|
-
|
30
|
-
describe Ohai::System, "Sigar network route plugin" do
|
31
|
-
|
32
|
-
if sigar_available
|
33
|
-
|
34
|
-
before(:each) do
|
35
|
-
@ohai = Ohai::System.new
|
36
|
-
@plugin = get_plugin("sigar/network", @ohai)
|
37
|
-
allow(@plugin).to receive(:collect_os).and_return(:sigar)
|
38
|
-
@sigar = double("Sigar")
|
39
|
-
@net_info_conf = {
|
40
|
-
:default_gateway => "192.168.1.254",
|
41
|
-
:default_gateway_interface => "eth0",
|
42
|
-
:primary_dns => "192.168.1.254",
|
43
|
-
:secondary_dns => "8.8.8.8",
|
44
|
-
:host_name => "localhost",
|
45
|
-
}
|
46
|
-
net_info = double("Sigar::NetInfo")
|
47
|
-
@net_info_conf.each_pair do |k, v|
|
48
|
-
allow(net_info).to receive(k).and_return(v)
|
49
|
-
end
|
50
|
-
@net_route_conf = {
|
51
|
-
:destination => "192.168.1.0",
|
52
|
-
:gateway => "0.0.0.0",
|
53
|
-
:mask => "255.255.255.0",
|
54
|
-
:flags => 1,
|
55
|
-
:refcnt => 0,
|
56
|
-
:use => 0,
|
57
|
-
:metric => 0,
|
58
|
-
:mtu => 0,
|
59
|
-
:window => 0,
|
60
|
-
:irtt => 0,
|
61
|
-
:ifname => "eth0",
|
62
|
-
}
|
63
|
-
net_route = double("Sigar::NetRoute")
|
64
|
-
@net_route_conf.each_pair do |k, v|
|
65
|
-
allow(net_route).to receive(k).and_return(v)
|
66
|
-
end
|
67
|
-
@net_interface_conf = {
|
68
|
-
:flags => 2115,
|
69
|
-
:destination => "192.168.1.1",
|
70
|
-
:mtu => 1500,
|
71
|
-
:type => "Ethernet",
|
72
|
-
:hwaddr => "00:11:22:33:44:55:66",
|
73
|
-
:address => "192.168.1.1",
|
74
|
-
:broadcast => "192.168.1.255",
|
75
|
-
:netmask => "255.255.255.0",
|
76
|
-
:address6 => nil,
|
77
|
-
:tx_queue_len => 1000,
|
78
|
-
:prefix6_length => 0,
|
79
|
-
}
|
80
|
-
net_conf = double("Sigar::NetConf")
|
81
|
-
@net_interface_conf.each_pair do |k, v|
|
82
|
-
allow(net_conf).to receive(k).and_return(v)
|
83
|
-
end
|
84
|
-
@net_interface_stat = {
|
85
|
-
:rx_bytes => 1369035618,
|
86
|
-
:rx_dropped => 0,
|
87
|
-
:rx_errors => 0,
|
88
|
-
:rx_frame => 0,
|
89
|
-
:rx_overruns => 0,
|
90
|
-
:rx_packets => 7271669,
|
91
|
-
:speed => -1,
|
92
|
-
:tx_bytes => 3482843666,
|
93
|
-
:tx_carrier => 0,
|
94
|
-
:tx_collisions => 0,
|
95
|
-
:tx_dropped => 0,
|
96
|
-
:tx_errors => 0,
|
97
|
-
:tx_overruns => 0,
|
98
|
-
:tx_packets => 4392794,
|
99
|
-
}
|
100
|
-
net_stat = double("Sigar::NetStat")
|
101
|
-
@net_interface_stat.each_pair do |k, v|
|
102
|
-
allow(net_stat).to receive(k).and_return(v)
|
103
|
-
end
|
104
|
-
@net_arp_conf = {
|
105
|
-
:address => "192.168.1.5",
|
106
|
-
:flags => 2,
|
107
|
-
:hwaddr => "00:15:62:96:01:D0",
|
108
|
-
:ifname => "eth0",
|
109
|
-
:type => "ether",
|
110
|
-
}
|
111
|
-
net_arp = double("Sigar::NetArp")
|
112
|
-
@net_arp_conf.each_pair do |k, v|
|
113
|
-
allow(net_arp).to receive(k).and_return(v)
|
114
|
-
end
|
115
|
-
allow(@sigar).to receive(:fqdn).and_return("localhost.localdomain")
|
116
|
-
expect(@sigar).to receive(:net_info).once.times.and_return(net_info)
|
117
|
-
expect(@sigar).to receive(:net_interface_list).once.and_return(["eth0"])
|
118
|
-
expect(@sigar).to receive(:net_interface_config).with("eth0").and_return(net_conf)
|
119
|
-
expect(@sigar).to receive(:net_interface_stat).with("eth0").and_return(net_stat)
|
120
|
-
expect(@sigar).to receive(:arp_list).once.and_return([net_arp])
|
121
|
-
|
122
|
-
# Since we double net_route_list here, flags never gets called
|
123
|
-
expect(@sigar).to receive(:net_route_list).once.and_return([net_route])
|
124
|
-
expect(Sigar).to receive(:new).once.and_return(@sigar)
|
125
|
-
|
126
|
-
@plugin.run
|
127
|
-
end
|
128
|
-
|
129
|
-
it "should set the routes" do
|
130
|
-
expect(@plugin[:network][:interfaces][:eth0]).to have_key(:route)
|
131
|
-
end
|
132
|
-
|
133
|
-
it "should set the route details" do
|
134
|
-
@net_route_conf.each_pair do |k, v|
|
135
|
-
# Work around the above doubleing of net_route_list skipping the call to flags()
|
136
|
-
if k == :flags
|
137
|
-
v = "U"
|
138
|
-
@plugin[:network][:interfaces][:eth0][:route]["192.168.1.0"][k] = v
|
139
|
-
end
|
140
|
-
expect(@plugin[:network][:interfaces][:eth0][:route]["192.168.1.0"]).to have_key(k)
|
141
|
-
expect(@plugin[:network][:interfaces][:eth0][:route]["192.168.1.0"][k]).to eql(v)
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
|
-
else
|
146
|
-
pending "Sigar not available, skipping sigar tests"
|
147
|
-
end
|
148
|
-
end
|