ohai 13.9.2 → 13.10.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3f400446fd8d86f4e2985744e12ca32a7b85859c7817edf01cdf9e5c79dbc8a1
4
- data.tar.gz: 7fc73a4140957c5c78fb3c5a314275c99da0b7615cc5b208f7899727b7004f94
3
+ metadata.gz: 4cd47e40a9d7e2877d2422f47a12fce95026eb3ed7670e40bb82d8b9a398007f
4
+ data.tar.gz: ae75e45d6f59c30f0abfc4e74f6af12a771edfd36f6d9acf41ea54ead46a8402
5
5
  SHA512:
6
- metadata.gz: 594b82a931b294a8fdca9eb9bb866013d70e7601bc09bf1e8a99410223470fcb981bc83294092ec4dacb961d9502c80c6451bb1362b1e16300d7bef1950808d7
7
- data.tar.gz: 68a89b951d8f5135e94098fef59125ef4fb011b9ec6912efaafcb09a1a069063391e44031714cb2d3e648b01c5697072059d726aefa5ef484d3c7c640244aeaf
6
+ metadata.gz: 926724f586f794cef84f2f95efe705e09a7a953dfb050502571039a4bedf871c3cb89a128e34453fe2e3d5887ec1f18904a418398ca58640728ef8d5668a0e24
7
+ data.tar.gz: 0f3a7b330e5c23c25e02fe383692aa7bc57280dc94aec1b641fae36318546dc7c72d58c2bb0b30a5ec5b0fd5a1cbfa0887f41601723179499103e192f0470631
@@ -24,8 +24,14 @@ Ohai.plugin(:Platform) do
24
24
  contents[/^Red Hat/i] ? "redhat" : contents[/(\w+)/i, 1].downcase
25
25
  end
26
26
 
27
+ # Amazon Linux AMI release 2013.09
28
+ # Amazon Linux 2
29
+ # Fedora release 28 (Twenty Eight)
30
+ # CentOS release 5.8 (Final)
31
+ # CentOS release 6.7 (Final)
32
+ # Red Hat Enterprise Linux Server release 7.5 (Maipo)
27
33
  def get_redhatish_version(contents)
28
- contents[/Rawhide/i] ? contents[/((\d+) \(Rawhide\))/i, 1].downcase : contents[/release ([\d\.]+)/, 1]
34
+ contents[/Rawhide/i] ? contents[/((\d+) \(Rawhide\))/i, 1].downcase : contents[/(release)? ([\d\.]+)/, 2]
29
35
  end
30
36
 
31
37
  #
@@ -32,6 +32,9 @@ Ohai.plugin(:Openstack) do
32
32
  if get_attribute(:dmi, :system, :all_records, 0, :Manufacturer) =~ /OpenStack/
33
33
  Ohai::Log.debug("Plugin Openstack: has_openstack_dmi? == true")
34
34
  true
35
+ elsif get_attribute(:dmi, :system, :product_name) == "OpenStack Compute"
36
+ logger.trace("Plugin Openstack: has_openstack_dmi? == true")
37
+ true
35
38
  else
36
39
  Ohai::Log.debug("Plugin Openstack: has_openstack_dmi? == false")
37
40
  false
@@ -18,5 +18,5 @@
18
18
 
19
19
  module Ohai
20
20
  OHAI_ROOT = File.expand_path(File.dirname(__FILE__))
21
- VERSION = "13.9.2"
21
+ VERSION = "13.10.0"
22
22
  end
@@ -458,6 +458,22 @@ OS_RELEASE
458
458
  expect(@plugin[:platform_version].to_f).to eq(7.3)
459
459
  end
460
460
 
461
+ it "should read the platform as amazon and version as 2 on the RC release" do
462
+ expect(File).to receive(:read).with("/etc/redhat-release").and_return("Amazon Linux release 2 (2017.12) LTS Release Candidate")
463
+ @plugin.run
464
+ expect(@plugin[:platform]).to eq("amazon")
465
+ expect(@plugin[:platform_family]).to eq("amazon")
466
+ expect(@plugin[:platform_version].to_f).to eq(2)
467
+ end
468
+
469
+ it "should read the platform as amazon and version as 2 on the final release" do
470
+ expect(File).to receive(:read).with("/etc/redhat-release").and_return("Amazon Linux 2")
471
+ @plugin.run
472
+ expect(@plugin[:platform]).to eq("amazon")
473
+ expect(@plugin[:platform_family]).to eq("amazon")
474
+ expect(@plugin[:platform_version].to_f).to eq(2)
475
+ end
476
+
461
477
  # https://github.com/chef/ohai/issues/560
462
478
  # Issue is seen on EL7, so that's what we're testing.
463
479
  context "on versions that have /etc/os-release" do
@@ -40,16 +40,35 @@ describe Ohai::System, "plugin openstack" do
40
40
  allow(plugin).to receive(:can_socket_connect?).
41
41
  with(Ohai::Mixin::Ec2Metadata::EC2_METADATA_ADDR, 80).
42
42
  and_return(false)
43
- plugin[:dmi] = { :system => { :all_records => [ { :Manufacturer => "OpenStack Foundation" } ] } }
43
+ plugin[:dmi] = dmi_data
44
44
  plugin.run
45
45
  end
46
46
 
47
- it "sets openstack attribute" do
48
- expect(plugin[:openstack][:provider]).to eq("openstack")
47
+ context "with normal openstack metadata" do
48
+ let(:dmi_data) do
49
+ { :system => { :all_records => [ { :Manufacturer => "OpenStack Foundation" } ] } }
50
+ end
51
+
52
+ it "sets openstack attribute" do
53
+ expect(plugin[:openstack][:provider]).to eq("openstack")
54
+ end
55
+
56
+ it "doesn't set metadata attributes" do
57
+ expect(plugin[:openstack][:instance_id]).to be_nil
58
+ end
49
59
  end
60
+ context "with Red Hat openstack metadata" do
61
+ let(:dmi_data) do
62
+ { :system => { :manufacturer => "Red Hat", :product_name => "OpenStack Compute" } }
63
+ end
50
64
 
51
- it "doesn't set metadata attributes" do
52
- expect(plugin[:openstack][:instance_id]).to be_nil
65
+ it "sets openstack attribute" do
66
+ expect(plugin[:openstack][:provider]).to eq("openstack")
67
+ end
68
+
69
+ it "doesn't set metadata attributes" do
70
+ expect(plugin[:openstack][:instance_id]).to be_nil
71
+ end
53
72
  end
54
73
  end
55
74
  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: 13.9.2
4
+ version: 13.10.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: 2018-06-04 00:00:00.000000000 Z
11
+ date: 2018-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: systemu
@@ -543,7 +543,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
543
543
  version: '0'
544
544
  requirements: []
545
545
  rubyforge_project:
546
- rubygems_version: 2.7.6
546
+ rubygems_version: 2.7.5
547
547
  signing_key:
548
548
  specification_version: 4
549
549
  summary: Ohai profiles your system and emits JSON