ohai 8.14.0 → 8.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/ohai +0 -0
- data/lib/ohai/hints.rb +16 -14
- data/lib/ohai/plugins/c.rb +1 -1
- data/lib/ohai/plugins/elixir.rb +15 -9
- data/lib/ohai/plugins/erlang.rb +32 -14
- data/lib/ohai/plugins/linux/fips.rb +38 -0
- data/lib/ohai/plugins/mono.rb +22 -13
- data/lib/ohai/plugins/scala.rb +21 -14
- data/lib/ohai/plugins/windows/fips.rb +50 -0
- data/lib/ohai/version.rb +1 -1
- data/spec/unit/plugins/azure_spec.rb +43 -51
- data/spec/unit/plugins/c_spec.rb +4 -4
- data/spec/unit/plugins/digital_ocean_spec.rb +51 -88
- data/spec/unit/plugins/ec2_spec.rb +5 -35
- data/spec/unit/plugins/elixir_spec.rb +25 -15
- data/spec/unit/plugins/erlang_spec.rb +29 -23
- data/spec/unit/plugins/eucalyptus_spec.rb +21 -42
- data/spec/unit/plugins/gce_spec.rb +16 -22
- data/spec/unit/plugins/linode_spec.rb +27 -50
- data/spec/unit/plugins/linux/fips_spec.rb +59 -0
- data/spec/unit/plugins/mono_spec.rb +27 -12
- data/spec/unit/plugins/rackspace_spec.rb +14 -44
- data/spec/unit/plugins/scala_spec.rb +24 -15
- data/spec/unit/plugins/softlayer_spec.rb +1 -1
- data/spec/unit/plugins/windows/fips_spec.rb +86 -0
- metadata +7 -3
@@ -31,20 +31,20 @@ describe Ohai::System, "plugin scala" do
|
|
31
31
|
def setup_plugin
|
32
32
|
allow(plugin).to receive(:shell_out)
|
33
33
|
.with("scala -version")
|
34
|
-
.and_return(mock_shell_out(0,
|
34
|
+
.and_return(mock_shell_out(0, "", scala_out))
|
35
35
|
allow(plugin).to receive(:shell_out)
|
36
36
|
.with("sbt --version")
|
37
37
|
.and_return(mock_shell_out(0, sbt_out, ""))
|
38
38
|
end
|
39
39
|
|
40
|
-
context "
|
40
|
+
context "if scala is installed" do
|
41
41
|
before(:each) do
|
42
42
|
setup_plugin
|
43
43
|
plugin.run
|
44
44
|
end
|
45
45
|
|
46
|
-
it "
|
47
|
-
expect(plugin
|
46
|
+
it "sets languages[:scala][:version]" do
|
47
|
+
expect(plugin[:languages][:scala][:version]).to eql("2.11.6")
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
@@ -55,29 +55,38 @@ describe Ohai::System, "plugin scala" do
|
|
55
55
|
plugin.run
|
56
56
|
end
|
57
57
|
|
58
|
-
it "
|
59
|
-
expect(plugin
|
58
|
+
it "sets languages[:scala][:sbt][:version]" do
|
59
|
+
expect(plugin[:languages][:scala][:sbt][:version]).to eql("0.13.8")
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
context "if scala
|
63
|
+
context "if scala/sbt are not installed" do
|
64
64
|
|
65
|
+
before(:each) do
|
66
|
+
allow(plugin).to receive(:shell_out)
|
67
|
+
.and_raise( Ohai::Exceptions::Exec )
|
68
|
+
plugin.run
|
69
|
+
end
|
70
|
+
|
71
|
+
it "does NOT set the languages[:scala] if scala/sbts commands fails" do
|
72
|
+
expect(plugin[:languages]).not_to have_key(:scala)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
context "if sbt is not installed" do
|
65
77
|
before(:each) do
|
66
78
|
allow(plugin).to receive(:shell_out)
|
67
79
|
.with("scala -version")
|
68
|
-
.
|
80
|
+
.and_return(mock_shell_out(0, "", scala_out))
|
69
81
|
|
70
82
|
allow(plugin).to receive(:shell_out)
|
71
83
|
.with("sbt --version")
|
72
|
-
.and_raise(
|
73
|
-
|
74
|
-
|
75
|
-
it "should not set the languages[:scala] if scala command fails" do
|
76
|
-
expect(plugin.languages).not_to have_key(:scala)
|
84
|
+
.and_raise( Ohai::Exceptions::Exec )
|
85
|
+
plugin.run
|
77
86
|
end
|
78
87
|
|
79
|
-
it "
|
80
|
-
expect(plugin
|
88
|
+
it "does NOT set the languages[:scala][:sbt] if sbt command fails" do
|
89
|
+
expect(plugin[:languages][:scala]).not_to have_key(:sbt)
|
81
90
|
end
|
82
91
|
end
|
83
92
|
end
|
@@ -23,7 +23,7 @@ describe Ohai::System, "plugin softlayer" do
|
|
23
23
|
let(:plugin) { get_plugin("softlayer") }
|
24
24
|
|
25
25
|
it "not create softlayer if hint file doesn't exists" do
|
26
|
-
allow(
|
26
|
+
allow(plugin).to receive(:hint?).with("softlayer").and_return(false)
|
27
27
|
plugin.run
|
28
28
|
expect(plugin[:softlayer]).to be_nil
|
29
29
|
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Matt Wrock (<matt@mattwrock.com>)
|
3
|
+
# Copyright:: Copyright (c) 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
|
+
describe Ohai::System, "plugin fips", :windows_only do
|
22
|
+
let(:enabled) { 0 }
|
23
|
+
let(:plugin) { get_plugin("windows/fips") }
|
24
|
+
let(:fips_key) { 'System\CurrentControlSet\Control\Lsa\FIPSAlgorithmPolicy' }
|
25
|
+
let(:win_reg_entry) { { "Enabled" => enabled } }
|
26
|
+
|
27
|
+
before(:each) do
|
28
|
+
allow(plugin).to receive(:collect_os).and_return(:windows)
|
29
|
+
allow(Win32::Registry::HKEY_LOCAL_MACHINE).to receive(:open).with(fips_key, arch).and_yield(win_reg_entry)
|
30
|
+
end
|
31
|
+
|
32
|
+
shared_examples "fips_plugin" do
|
33
|
+
context "fips enabled key is set to 1" do
|
34
|
+
let(:enabled) { 1 }
|
35
|
+
|
36
|
+
it "sets fips plugin" do
|
37
|
+
plugin.run
|
38
|
+
expect(plugin["fips"]["kernel"]["enabled"]).to be(true)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
context "fips enabled key is set to 0" do
|
43
|
+
let(:enabled) { 0 }
|
44
|
+
|
45
|
+
it "does not set fips plugin" do
|
46
|
+
plugin.run
|
47
|
+
expect(plugin["fips"]["kernel"]["enabled"]).to be(false)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
context "fips key does not exist" do
|
52
|
+
before do
|
53
|
+
allow(Win32::Registry::HKEY_LOCAL_MACHINE).to receive(:open).and_raise(Win32::Registry::Error, 50)
|
54
|
+
end
|
55
|
+
|
56
|
+
it "does not set fips plugin" do
|
57
|
+
plugin.run
|
58
|
+
expect(plugin["fips"]["kernel"]["enabled"]).to be(false)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
context "on 32 bit ruby" do
|
64
|
+
let(:arch) { Win32::Registry::KEY_READ | 0x100 }
|
65
|
+
|
66
|
+
before { stub_const("::RbConfig::CONFIG", { "target_cpu" => "i386" } ) }
|
67
|
+
|
68
|
+
it_behaves_like "fips_plugin"
|
69
|
+
end
|
70
|
+
|
71
|
+
context "on 64 bit ruby" do
|
72
|
+
let(:arch) { Win32::Registry::KEY_READ | 0x200 }
|
73
|
+
|
74
|
+
before { stub_const("::RbConfig::CONFIG", { "target_cpu" => "x86_64" } ) }
|
75
|
+
|
76
|
+
it_behaves_like "fips_plugin"
|
77
|
+
end
|
78
|
+
|
79
|
+
context "on unknown ruby" do
|
80
|
+
let(:arch) { Win32::Registry::KEY_READ }
|
81
|
+
|
82
|
+
before { stub_const("::RbConfig::CONFIG", { "target_cpu" => nil } ) }
|
83
|
+
|
84
|
+
it_behaves_like "fips_plugin"
|
85
|
+
end
|
86
|
+
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.15.0
|
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-04-
|
11
|
+
date: 2016-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: systemu
|
@@ -368,6 +368,7 @@ files:
|
|
368
368
|
- lib/ohai/plugins/linux/cpu.rb
|
369
369
|
- lib/ohai/plugins/linux/filesystem.rb
|
370
370
|
- lib/ohai/plugins/linux/filesystem2.rb
|
371
|
+
- lib/ohai/plugins/linux/fips.rb
|
371
372
|
- lib/ohai/plugins/linux/lsb.rb
|
372
373
|
- lib/ohai/plugins/linux/mdadm.rb
|
373
374
|
- lib/ohai/plugins/linux/memory.rb
|
@@ -428,6 +429,7 @@ files:
|
|
428
429
|
- lib/ohai/plugins/windows/cpu.rb
|
429
430
|
- lib/ohai/plugins/windows/drivers.rb
|
430
431
|
- lib/ohai/plugins/windows/filesystem.rb
|
432
|
+
- lib/ohai/plugins/windows/fips.rb
|
431
433
|
- lib/ohai/plugins/windows/memory.rb
|
432
434
|
- lib/ohai/plugins/windows/network.rb
|
433
435
|
- lib/ohai/plugins/windows/platform.rb
|
@@ -541,6 +543,7 @@ files:
|
|
541
543
|
- spec/unit/plugins/linux/cpu_spec.rb
|
542
544
|
- spec/unit/plugins/linux/filesystem2_spec.rb
|
543
545
|
- spec/unit/plugins/linux/filesystem_spec.rb
|
546
|
+
- spec/unit/plugins/linux/fips_spec.rb
|
544
547
|
- spec/unit/plugins/linux/hostname_spec.rb
|
545
548
|
- spec/unit/plugins/linux/kernel_spec.rb
|
546
549
|
- spec/unit/plugins/linux/lsb_spec.rb
|
@@ -593,6 +596,7 @@ files:
|
|
593
596
|
- spec/unit/plugins/virtualbox_spec.rb
|
594
597
|
- spec/unit/plugins/vmware_spec.rb
|
595
598
|
- spec/unit/plugins/windows/cpu_spec.rb
|
599
|
+
- spec/unit/plugins/windows/fips_spec.rb
|
596
600
|
- spec/unit/plugins/windows/memory_spec.rb
|
597
601
|
- spec/unit/plugins/windows/virtualization_spec.rb
|
598
602
|
- spec/unit/provides_map_spec.rb
|
@@ -620,7 +624,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
620
624
|
version: '0'
|
621
625
|
requirements: []
|
622
626
|
rubyforge_project:
|
623
|
-
rubygems_version: 2.
|
627
|
+
rubygems_version: 2.5.2
|
624
628
|
signing_key:
|
625
629
|
specification_version: 4
|
626
630
|
summary: Ohai profiles your system and emits JSON
|