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
data/spec/unit/runner_spec.rb
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
# limitations under the License
|
18
18
|
#
|
19
19
|
|
20
|
-
require File.expand_path(File.dirname(__FILE__) +
|
20
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper.rb")
|
21
21
|
|
22
22
|
describe Ohai::Runner, "run_plugin" do
|
23
23
|
let(:safe_run) { true }
|
@@ -137,11 +137,11 @@ describe Ohai::Runner, "run_plugin" do
|
|
137
137
|
end
|
138
138
|
|
139
139
|
it "should raise Ohai::Excpetions::AttributeNotFound" do
|
140
|
-
expect{ @runner.run_plugin(@plugin) }.to raise_error(Ohai::Exceptions::AttributeNotFound)
|
140
|
+
expect { @runner.run_plugin(@plugin) }.to raise_error(Ohai::Exceptions::AttributeNotFound)
|
141
141
|
end
|
142
142
|
|
143
143
|
it "should not run the plugin" do
|
144
|
-
expect{ @runner.run_plugin(@plugin) }.to raise_error(Ohai::Exceptions::AttributeNotFound)
|
144
|
+
expect { @runner.run_plugin(@plugin) }.to raise_error(Ohai::Exceptions::AttributeNotFound)
|
145
145
|
expect(@plugin.has_run?).to be false
|
146
146
|
end
|
147
147
|
end
|
@@ -244,8 +244,8 @@ describe Ohai::Runner, "run_plugin" do
|
|
244
244
|
@plugins << klass.new(@ohai.data)
|
245
245
|
end
|
246
246
|
@plugin1, @plugin2, @plugin3 = @plugins
|
247
|
-
@ohai.provides_map.set_providers_for(@plugin1,
|
248
|
-
@ohai.provides_map.set_providers_for(@plugin2,
|
247
|
+
@ohai.provides_map.set_providers_for(@plugin1, %w{one two})
|
248
|
+
@ohai.provides_map.set_providers_for(@plugin2, %w{one two})
|
249
249
|
end
|
250
250
|
|
251
251
|
it "should run the plugins" do
|
@@ -322,16 +322,16 @@ describe Ohai::Runner, "run_plugin" do
|
|
322
322
|
klassA = Ohai.plugin(:A) {
|
323
323
|
provides("A")
|
324
324
|
depends("B", "C")
|
325
|
-
collect_data {
|
325
|
+
collect_data {}
|
326
326
|
}
|
327
327
|
klassB = Ohai.plugin(:B) {
|
328
328
|
provides("B")
|
329
329
|
depends("C")
|
330
|
-
collect_data {
|
330
|
+
collect_data {}
|
331
331
|
}
|
332
332
|
klassC = Ohai.plugin(:C) {
|
333
333
|
provides("C")
|
334
|
-
collect_data {
|
334
|
+
collect_data {}
|
335
335
|
}
|
336
336
|
|
337
337
|
@plugins = []
|
@@ -373,7 +373,7 @@ describe Ohai::Runner, "fetch_plugins" do
|
|
373
373
|
before(:each) do
|
374
374
|
@provides_map = Ohai::ProvidesMap.new
|
375
375
|
@data = Mash.new
|
376
|
-
@ohai = double(
|
376
|
+
@ohai = double("Ohai::System", :data => @data, :provides_map => @provides_map)
|
377
377
|
@runner = Ohai::Runner.new(@ohai, true)
|
378
378
|
end
|
379
379
|
|
@@ -397,7 +397,7 @@ describe Ohai::Runner, "fetch_plugins" do
|
|
397
397
|
describe "and no parent attribute has providers" do
|
398
398
|
it "should raise Ohai::Exceptions::AttributeNotFound exception" do
|
399
399
|
# provides map is empty
|
400
|
-
expect{ @runner.fetch_plugins(["false/attribute"]) }.to raise_error(Ohai::Exceptions::AttributeNotFound, "No such attribute: 'false/attribute'")
|
400
|
+
expect { @runner.fetch_plugins(["false/attribute"]) }.to raise_error(Ohai::Exceptions::AttributeNotFound, "No such attribute: 'false/attribute'")
|
401
401
|
end
|
402
402
|
end
|
403
403
|
end
|
data/spec/unit/system_spec.rb
CHANGED
@@ -17,8 +17,8 @@
|
|
17
17
|
# limitations under the License.
|
18
18
|
#
|
19
19
|
|
20
|
-
require File.expand_path(File.dirname(__FILE__) +
|
21
|
-
require
|
20
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper.rb")
|
21
|
+
require "ohai/mixin/os"
|
22
22
|
|
23
23
|
describe "Ohai::System" do
|
24
24
|
extend IntegrationSupport
|
@@ -38,7 +38,7 @@ describe "Ohai::System" do
|
|
38
38
|
expect(ohai.v6_dependency_solver).to be_a_kind_of(Hash)
|
39
39
|
end
|
40
40
|
|
41
|
-
it
|
41
|
+
it "merges deprecated config settings into the ohai config context" do
|
42
42
|
expect(Ohai::Log).to receive(:warn).
|
43
43
|
with(/Ohai::Config\[:disabled_plugins\] is deprecated/)
|
44
44
|
Ohai::Config[:disabled_plugins] = [ :Foo, :Baz ]
|
@@ -48,10 +48,10 @@ describe "Ohai::System" do
|
|
48
48
|
expect(Ohai.config[:disabled_plugins]).to eq([ :Foo, :Baz ])
|
49
49
|
end
|
50
50
|
|
51
|
-
it
|
51
|
+
it "merges provided configuration options into the ohai config context" do
|
52
52
|
config = {
|
53
53
|
disabled_plugins: [ :Foo, :Baz ],
|
54
|
-
directory:
|
54
|
+
directory: "/some/extra/plugins",
|
55
55
|
}
|
56
56
|
allow(Ohai::Config).to receive(:merge_deprecated_config)
|
57
57
|
expect(Ohai.config).to receive(:merge!).with(config).and_call_original
|
@@ -61,18 +61,18 @@ describe "Ohai::System" do
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
context
|
65
|
-
let(:directory) {
|
64
|
+
context "when directory is configured" do
|
65
|
+
let(:directory) { "/some/fantastic/plugins" }
|
66
66
|
|
67
|
-
it
|
67
|
+
it "adds directory to plugin_path" do
|
68
68
|
Ohai.config[:directory] = directory
|
69
69
|
Ohai::System.new
|
70
70
|
expect(Ohai.config[:plugin_path]).to include(directory)
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
|
-
shared_examples_for
|
75
|
-
it
|
74
|
+
shared_examples_for "appendable deprecated configuration option" do
|
75
|
+
it "logs a warning and configures the option on the ohai config context" do
|
76
76
|
Ohai::Config[option] << value
|
77
77
|
expect(Ohai::Log).to receive(:warn).
|
78
78
|
with(/Ohai::Config\[:#{option}\] is deprecated/)
|
@@ -81,21 +81,21 @@ describe "Ohai::System" do
|
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
|
-
context
|
85
|
-
include_examples
|
84
|
+
context "when a top-level hints_path is configured" do
|
85
|
+
include_examples "appendable deprecated configuration option" do
|
86
86
|
let(:option) { :hints_path }
|
87
|
-
let(:value) {
|
87
|
+
let(:value) { "/path/to/hints" }
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
|
-
context
|
92
|
-
include_examples
|
91
|
+
context "when a top-level plugin_path is configured" do
|
92
|
+
include_examples "appendable deprecated configuration option" do
|
93
93
|
let(:option) { :plugin_path }
|
94
|
-
let(:value) {
|
94
|
+
let(:value) { "/path/to/plugins" }
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
98
|
-
it
|
98
|
+
it "configures logging" do
|
99
99
|
log_level = :debug
|
100
100
|
Ohai.config[:log_level] = log_level
|
101
101
|
expect(Ohai::Log).to receive(:init).with(Ohai.config[:log_location])
|
@@ -103,7 +103,7 @@ describe "Ohai::System" do
|
|
103
103
|
Ohai::System.new
|
104
104
|
end
|
105
105
|
|
106
|
-
it
|
106
|
+
it "resolves log_level when set to :auto" do
|
107
107
|
expect(Ohai::Log).to receive(:level=).with(:info)
|
108
108
|
Ohai::System.new
|
109
109
|
end
|
@@ -394,7 +394,7 @@ EOF
|
|
394
394
|
|
395
395
|
describe "when using :disabled_plugins" do
|
396
396
|
before do
|
397
|
-
Ohai.config[:disabled_plugins] = [ :Zoo,
|
397
|
+
Ohai.config[:disabled_plugins] = [ :Zoo, "my_plugins::park" ]
|
398
398
|
end
|
399
399
|
|
400
400
|
after do
|
@@ -16,14 +16,13 @@
|
|
16
16
|
# See the License for the specific language governing permissions and
|
17
17
|
# limitations under the License.
|
18
18
|
|
19
|
-
require
|
20
|
-
require
|
19
|
+
require "spec_helper"
|
20
|
+
require "ohai/util/file_helper"
|
21
21
|
|
22
22
|
class FileHelperMock
|
23
23
|
include Ohai::Util::FileHelper
|
24
24
|
end
|
25
25
|
|
26
|
-
|
27
26
|
describe "Ohai::Util::FileHelper" do
|
28
27
|
let(:file_helper) { FileHelperMock.new }
|
29
28
|
|
@@ -33,13 +32,13 @@ describe "Ohai::Util::FileHelper" do
|
|
33
32
|
|
34
33
|
describe "which" do
|
35
34
|
it "returns the path to an executable that is in the path" do
|
36
|
-
allow(File).to receive(:executable?).with(
|
35
|
+
allow(File).to receive(:executable?).with("/usr/bin/skyhawk").and_return(true)
|
37
36
|
|
38
|
-
expect(file_helper.which(
|
37
|
+
expect(file_helper.which("skyhawk")).to eql "/usr/bin/skyhawk"
|
39
38
|
end
|
40
39
|
|
41
40
|
it "returns false if the executable is not in the path" do
|
42
|
-
expect(file_helper.which(
|
41
|
+
expect(file_helper.which("the_cake")).to be false
|
43
42
|
end
|
44
43
|
end
|
45
44
|
end
|
@@ -14,9 +14,9 @@
|
|
14
14
|
# See the License for the specific language governing permissions and
|
15
15
|
# limitations under the License.
|
16
16
|
|
17
|
-
require
|
18
|
-
require
|
19
|
-
require
|
17
|
+
require "ipaddress"
|
18
|
+
require "spec_helper"
|
19
|
+
require "ohai/util/ip_helper"
|
20
20
|
|
21
21
|
class IpHelperMock
|
22
22
|
include Ohai::Util::IpHelper
|
@@ -25,54 +25,54 @@ end
|
|
25
25
|
describe "Ohai::Util::IpHelper" do
|
26
26
|
let(:ip_helper) { IpHelperMock.new }
|
27
27
|
|
28
|
-
shared_examples
|
29
|
-
context
|
30
|
-
context
|
31
|
-
let(:address) {
|
28
|
+
shared_examples "ip address types" do
|
29
|
+
context "with an IPv4 address" do
|
30
|
+
context "that is private" do
|
31
|
+
let(:address) { "10.128.142.89" }
|
32
32
|
|
33
|
-
it
|
33
|
+
it "identifies the address as private" do
|
34
34
|
expect(ip_helper.private_address?(address)).to be_truthy
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
context
|
39
|
-
let(:address) {
|
38
|
+
context "that is public" do
|
39
|
+
let(:address) { "74.125.224.72" }
|
40
40
|
|
41
|
-
it
|
41
|
+
it "identifies the address as public" do
|
42
42
|
expect(ip_helper.private_address?(address)).to be_falsey
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
context
|
48
|
-
context
|
49
|
-
let(:address) {
|
47
|
+
context "with an IPv6 address" do
|
48
|
+
context "that is an RFC 4193 unique local address" do
|
49
|
+
let(:address) { "fdf8:f53b:82e4::53" }
|
50
50
|
|
51
|
-
it
|
51
|
+
it "identifies the address as a unique local address" do
|
52
52
|
expect(ip_helper.private_address?(address)).to be_truthy
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
context
|
57
|
-
let(:address) {
|
56
|
+
context "that is a RFC 4291 Link-Local unicast address" do
|
57
|
+
let(:address) { "FE80::0202:B3FF:FE1E:8329" }
|
58
58
|
|
59
|
-
it
|
59
|
+
it "does identify the address as a link-local address" do
|
60
60
|
expect(ip_helper.private_address?(address)).to be_truthy
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
-
describe
|
67
|
-
include_examples
|
66
|
+
describe "private_address?" do
|
67
|
+
include_examples "ip address types"
|
68
68
|
end
|
69
69
|
|
70
|
-
describe
|
71
|
-
include_examples
|
70
|
+
describe "unique_local_address?" do
|
71
|
+
include_examples "ip address types"
|
72
72
|
end
|
73
73
|
|
74
|
-
describe
|
75
|
-
let(:address) {
|
74
|
+
describe "public_address?" do
|
75
|
+
let(:address) { "10.128.142.89" }
|
76
76
|
|
77
77
|
before do
|
78
78
|
allow(ip_helper).to receive(:private_address?)
|
@@ -88,38 +88,38 @@ describe "Ohai::Util::IpHelper" do
|
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
|
-
describe
|
92
|
-
context
|
93
|
-
context
|
94
|
-
let(:address) {
|
91
|
+
describe "loopback?" do
|
92
|
+
context "with an IPv4 address" do
|
93
|
+
context "that is a loopback address" do
|
94
|
+
let(:address) { "127.0.0.1" }
|
95
95
|
|
96
|
-
it
|
96
|
+
it "should identify the address as a loopback address" do
|
97
97
|
expect(ip_helper.loopback?(address)).to be_truthy
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
101
|
-
context
|
102
|
-
let(:address) {
|
101
|
+
context "that is not a loopback address" do
|
102
|
+
let(:address) { "1.2.3.4" }
|
103
103
|
|
104
|
-
it
|
104
|
+
it "should not identify the address as a loopback address" do
|
105
105
|
expect(ip_helper.loopback?(address)).to be_falsey
|
106
106
|
end
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
110
|
-
context
|
111
|
-
context
|
112
|
-
let(:address) {
|
110
|
+
context "with an IPv6 address" do
|
111
|
+
context "that is a loopback address" do
|
112
|
+
let(:address) { "0:0:0:0:0:0:0:1" }
|
113
113
|
|
114
|
-
it
|
114
|
+
it "should identify the address as a loopback address" do
|
115
115
|
expect(ip_helper.loopback?(address)).to be_truthy
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
119
|
-
context
|
120
|
-
let(:address) {
|
119
|
+
context "that is not a loopback address" do
|
120
|
+
let(:address) { "2400:6180:0000:00D0:0000:0000:0009:7001" }
|
121
121
|
|
122
|
-
it
|
122
|
+
it "should not identify the address as a loopback address" do
|
123
123
|
expect(ip_helper.loopback?(address)).to be_falsey
|
124
124
|
end
|
125
125
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ohai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.
|
4
|
+
version: 8.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Jacob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: systemu
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '2.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: plist
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: ipaddress
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -240,6 +254,20 @@ dependencies:
|
|
240
254
|
- - ">="
|
241
255
|
- !ruby/object:Gem::Version
|
242
256
|
version: '0'
|
257
|
+
- !ruby/object:Gem::Dependency
|
258
|
+
name: github_changelog_generator
|
259
|
+
requirement: !ruby/object:Gem::Requirement
|
260
|
+
requirements:
|
261
|
+
- - '='
|
262
|
+
- !ruby/object:Gem::Version
|
263
|
+
version: 1.11.3
|
264
|
+
type: :development
|
265
|
+
prerelease: false
|
266
|
+
version_requirements: !ruby/object:Gem::Requirement
|
267
|
+
requirements:
|
268
|
+
- - '='
|
269
|
+
- !ruby/object:Gem::Version
|
270
|
+
version: 1.11.3
|
243
271
|
description: Ohai profiles your system and emits JSON
|
244
272
|
email: adam@chef.io
|
245
273
|
executables:
|
@@ -582,9 +610,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
582
610
|
version: '0'
|
583
611
|
requirements: []
|
584
612
|
rubyforge_project:
|
585
|
-
rubygems_version: 2.
|
613
|
+
rubygems_version: 2.6.1
|
586
614
|
signing_key:
|
587
615
|
specification_version: 4
|
588
616
|
summary: Ohai profiles your system and emits JSON
|
589
617
|
test_files: []
|
590
|
-
has_rdoc:
|