ohai 15.1.5 → 15.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -1
  3. data/lib/ohai/common/dmi.rb +3 -0
  4. data/lib/ohai/dsl/plugin.rb +3 -0
  5. data/lib/ohai/dsl/plugin/versionvii.rb +4 -2
  6. data/lib/ohai/hints.rb +3 -1
  7. data/lib/ohai/loader.rb +7 -4
  8. data/lib/ohai/mash.rb +1 -1
  9. data/lib/ohai/mixin/constant_helper.rb +1 -0
  10. data/lib/ohai/mixin/ec2_metadata.rb +4 -3
  11. data/lib/ohai/mixin/gce_metadata.rb +2 -3
  12. data/lib/ohai/plugins/aix/kernel.rb +1 -1
  13. data/lib/ohai/plugins/aix/network.rb +3 -3
  14. data/lib/ohai/plugins/aix/virtualization.rb +4 -0
  15. data/lib/ohai/plugins/azure.rb +1 -0
  16. data/lib/ohai/plugins/cloud.rb +7 -4
  17. data/lib/ohai/plugins/cpu.rb +6 -6
  18. data/lib/ohai/plugins/darwin/network.rb +9 -4
  19. data/lib/ohai/plugins/digital_ocean.rb +2 -0
  20. data/lib/ohai/plugins/dmi.rb +1 -0
  21. data/lib/ohai/plugins/dragonflybsd/memory.rb +1 -1
  22. data/lib/ohai/plugins/dragonflybsd/network.rb +1 -0
  23. data/lib/ohai/plugins/ec2.rb +1 -0
  24. data/lib/ohai/plugins/eucalyptus.rb +1 -0
  25. data/lib/ohai/plugins/filesystem.rb +12 -2
  26. data/lib/ohai/plugins/freebsd/memory.rb +1 -1
  27. data/lib/ohai/plugins/freebsd/network.rb +1 -0
  28. data/lib/ohai/plugins/haskell.rb +4 -4
  29. data/lib/ohai/plugins/hostname.rb +2 -1
  30. data/lib/ohai/plugins/java.rb +1 -0
  31. data/lib/ohai/plugins/kernel.rb +10 -5
  32. data/lib/ohai/plugins/linode.rb +1 -1
  33. data/lib/ohai/plugins/linux/lspci.rb +3 -2
  34. data/lib/ohai/plugins/linux/network.rb +18 -7
  35. data/lib/ohai/plugins/linux/platform.rb +4 -8
  36. data/lib/ohai/plugins/netbsd/memory.rb +1 -1
  37. data/lib/ohai/plugins/netbsd/network.rb +1 -0
  38. data/lib/ohai/plugins/network.rb +2 -0
  39. data/lib/ohai/plugins/openbsd/memory.rb +1 -1
  40. data/lib/ohai/plugins/openbsd/network.rb +1 -0
  41. data/lib/ohai/plugins/openstack.rb +8 -14
  42. data/lib/ohai/plugins/packages.rb +29 -1
  43. data/lib/ohai/plugins/rackspace.rb +1 -0
  44. data/lib/ohai/plugins/scaleway.rb +1 -0
  45. data/lib/ohai/plugins/shard.rb +1 -1
  46. data/lib/ohai/plugins/solaris2/network.rb +3 -1
  47. data/lib/ohai/plugins/virtualbox.rb +5 -3
  48. data/lib/ohai/plugins/windows/network.rb +6 -0
  49. data/lib/ohai/provides_map.rb +26 -3
  50. data/lib/ohai/runner.rb +18 -5
  51. data/lib/ohai/system.rb +8 -0
  52. data/lib/ohai/util/win32.rb +4 -4
  53. data/lib/ohai/version.rb +1 -1
  54. data/spec/data/plugins/rpmquery.output +2 -0
  55. data/spec/functional/application_spec.rb +1 -1
  56. data/spec/functional/loader_spec.rb +1 -1
  57. data/spec/unit/dsl/plugin_spec.rb +15 -15
  58. data/spec/unit/plugin_config_spec.rb +3 -3
  59. data/spec/unit/plugins/docker_spec.rb +11 -11
  60. data/spec/unit/plugins/ec2_spec.rb +4 -2
  61. data/spec/unit/plugins/erlang_spec.rb +2 -2
  62. data/spec/unit/plugins/hostname_spec.rb +14 -10
  63. data/spec/unit/plugins/linux/filesystem_spec.rb +1 -0
  64. data/spec/unit/plugins/linux/lspci_spec.rb +2 -1
  65. data/spec/unit/plugins/linux/platform_spec.rb +5 -0
  66. data/spec/unit/plugins/network_spec.rb +3 -2
  67. data/spec/unit/plugins/openstack_spec.rb +31 -30
  68. data/spec/unit/plugins/packages_spec.rb +20 -0
  69. data/spec/unit/plugins/ruby_spec.rb +1 -1
  70. data/spec/unit/plugins/scsi_spec.rb +2 -1
  71. data/spec/unit/plugins/shard_spec.rb +1 -1
  72. data/spec/unit/plugins/windows/filesystem_spec.rb +2 -2
  73. data/spec/unit/plugins/windows/kernel_spec.rb +2 -2
  74. data/spec/unit/runner_spec.rb +2 -2
  75. data/spec/unit/system_spec.rb +3 -3
  76. metadata +2 -2
@@ -100,6 +100,26 @@ describe Ohai::System, "plugin packages" do
100
100
  expect(plugin[:packages]["tzdata"][:installdate]).to eq("1463486618")
101
101
  expect(plugin[:packages]["tzdata"][:arch]).to eq("noarch")
102
102
  end
103
+
104
+ it "handles multiple packages with the same name" do
105
+ expect(plugin[:packages]["kernel"][:version]).to eq("3.10.0")
106
+ expect(plugin[:packages]["kernel"][:release]).to eq("862.el7")
107
+ expect(plugin[:packages]["kernel"][:epoch]).to eq("0")
108
+ expect(plugin[:packages]["kernel"][:installdate]).to eq("1521745632")
109
+ expect(plugin[:packages]["kernel"][:arch]).to eq("x86_64")
110
+ # and now the version list:
111
+ expect(plugin[:packages]["kernel"]["versions"].first[:version]).to eq("3.10.0")
112
+ expect(plugin[:packages]["kernel"]["versions"].first[:release]).to eq("862.2.3.el7")
113
+ expect(plugin[:packages]["kernel"]["versions"].first[:epoch]).to eq("0")
114
+ expect(plugin[:packages]["kernel"]["versions"].first[:installdate]).to eq("1526310781")
115
+ expect(plugin[:packages]["kernel"]["versions"].first[:arch]).to eq("x86_64")
116
+ expect(plugin[:packages]["kernel"]["versions"].last[:version]).to eq("3.10.0")
117
+ expect(plugin[:packages]["kernel"]["versions"].last[:release]).to eq("862.el7")
118
+ expect(plugin[:packages]["kernel"]["versions"].last[:epoch]).to eq("0")
119
+ expect(plugin[:packages]["kernel"]["versions"].last[:installdate]).to eq("1521745632")
120
+ expect(plugin[:packages]["kernel"]["versions"].last[:arch]).to eq("x86_64")
121
+
122
+ end
103
123
  end
104
124
 
105
125
  context "on arch" do
@@ -48,7 +48,7 @@ describe Ohai::System, "plugin ruby" do
48
48
  host_vendor: ::RbConfig::CONFIG["host_vendor"],
49
49
  gems_dir: `#{ruby_bin} #{::RbConfig::CONFIG["bindir"]}/gem env gemdir`.chomp,
50
50
  gem_bin: [ ::Gem.default_exec_format % "gem", "gem" ].map do |bin|
51
- "#{::RbConfig::CONFIG['bindir']}/#{bin}"
51
+ "#{::RbConfig::CONFIG["bindir"]}/#{bin}"
52
52
  end.find { |bin| ::File.exist? bin },
53
53
  ruby_bin: ruby_bin,
54
54
  }.each do |attribute, value|
@@ -31,7 +31,8 @@ describe Ohai::System, "lsscsi plugin" do
31
31
  [6:2:4:0] disk LSI MR9286CV-8e 3.41 /dev/sdf
32
32
  LSSCSI
33
33
  allow(plugin).to receive(:shell_out).with("lsscsi").and_return(
34
- mock_shell_out(0, @stdout, ""))
34
+ mock_shell_out(0, @stdout, "")
35
+ )
35
36
  plugin.run
36
37
  end
37
38
 
@@ -93,7 +93,7 @@ describe Ohai::System, "shard plugin" do
93
93
  end
94
94
 
95
95
  it "should allow os_serial source" do
96
- Ohai.config[:plugin][:shard_seed][:sources] = [:machinename, :os_serial, :uuid]
96
+ Ohai.config[:plugin][:shard_seed][:sources] = %i{machinename os_serial uuid}
97
97
  # Different from above.
98
98
  expect(subject).to eq(178738102)
99
99
  end
@@ -43,7 +43,7 @@ describe Ohai::System, "Windows Filesystem Plugin", :windows_only do
43
43
  "freespace" => "100000",
44
44
  "name" => "D:",
45
45
  # Lets not pass "volumename" for this drive
46
- }
46
+ },
47
47
  ]
48
48
  end
49
49
 
@@ -56,7 +56,7 @@ describe Ohai::System, "Windows Filesystem Plugin", :windows_only do
56
56
  {
57
57
  "conversionstatus" => 2,
58
58
  "driveletter" => "D:",
59
- }
59
+ },
60
60
  ]
61
61
  end
62
62
 
@@ -34,7 +34,7 @@ describe Ohai::System, "Windows kernel plugin", :windows_only do
34
34
  os_properties = [ caption, version, build_number, csd_version, os_type, product_type, operating_system_sku ]
35
35
 
36
36
  os = double( "WIN32OLE",
37
- properties_: os_properties)
37
+ properties_: os_properties)
38
38
 
39
39
  allow(os).to receive(:invoke).with(build_number.name).and_return("7601")
40
40
  allow(os).to receive(:invoke).with(csd_version.name).and_return("Service Pack 1")
@@ -53,7 +53,7 @@ describe Ohai::System, "Windows kernel plugin", :windows_only do
53
53
  cs_properties = [ system_type, pc_system_type, free_virtual_memory]
54
54
 
55
55
  cs = double("WIN32OLE",
56
- properties_: cs_properties)
56
+ properties_: cs_properties)
57
57
 
58
58
  allow(cs).to receive(:invoke).with(system_type.name).and_return("x64-based PC")
59
59
  allow(cs).to receive(:invoke).with(pc_system_type.name).and_return(2)
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Claire McQuin (<claire@chef.io>)
3
- # Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
3
+ # Copyright:: Copyright (c) 2013-2019, 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"); you
@@ -34,7 +34,7 @@ describe Ohai::Runner, "run_plugin" do
34
34
  end
35
35
 
36
36
  describe "when running a plugin" do
37
- let(:plugin) { double("Ohai::DSL::Plugin", kind_of?: true, version: version, name: :Test, has_run?: has_run, dependencies: [ ]) }
37
+ let(:plugin) { double("Ohai::DSL::Plugin", is_a?: true, version: version, name: :Test, has_run?: has_run, dependencies: [ ]) }
38
38
  let(:version) { :version7 }
39
39
  let(:has_run) { false }
40
40
 
@@ -37,9 +37,9 @@ describe "Ohai::System" do
37
37
 
38
38
  it "merges provided configuration options into the ohai config context" do
39
39
  config = {
40
- disabled_plugins: [ :Foo, :Baz ],
40
+ disabled_plugins: %i{Foo Baz},
41
41
  directory: ["/some/extra/plugins"],
42
- critical_plugins: [ :Foo, :Bar ],
42
+ critical_plugins: %i{Foo Bar},
43
43
  }
44
44
  Ohai::System.new(config)
45
45
  config.each do |option, value|
@@ -249,7 +249,7 @@ describe "Ohai::System" do
249
249
  it "should fail when critical plugins fail" do
250
250
  Ohai.config[:plugin_path] = [ path_to(".") ]
251
251
  expect { ohai.all_plugins }.to raise_error(Ohai::Exceptions::CriticalPluginFailure,
252
- "The following Ohai plugins marked as critical failed: [:Fails]. Failing Chef run.")
252
+ "The following Ohai plugins marked as critical failed: [:Fails]. Failing Chef run.")
253
253
  end
254
254
  end
255
255
 
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: 15.1.5
4
+ version: 15.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Jacob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-22 00:00:00.000000000 Z
11
+ date: 2019-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: systemu