diff options
author | Tim Smith <tsmith84@gmail.com> | 2019-09-04 16:19:17 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2019-09-04 16:19:17 -0700 |
commit | af0c84f52bd80da323d565a07b8cee3fd85939b8 (patch) | |
tree | 80dba2e40d15523584b1fdaf11c00b04838415bf | |
parent | 20032b91d18b8534e99c4181f4bda8e4d8c84a37 (diff) | |
download | ohai-openstack_ohaii.tar.gz |
Use the more reliable systems virtualization attribute for Openstackopenstack_ohaii
If we're on openstack we'll have this even if the order of detection doesn't make it the main virt platform.
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r-- | lib/ohai/plugins/openstack.rb | 2 | ||||
-rw-r--r-- | spec/unit/plugins/openstack_spec.rb | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/ohai/plugins/openstack.rb b/lib/ohai/plugins/openstack.rb index 22dd1920..6b794975 100644 --- a/lib/ohai/plugins/openstack.rb +++ b/lib/ohai/plugins/openstack.rb @@ -28,7 +28,7 @@ Ohai.plugin(:Openstack) do # use virtualization data def openstack_virtualization? - if get_attribute(:virtualization, :system, :guest) == "openstack" + if get_attribute(:virtualization, :systems, :openstack) logger.trace("Plugin Openstack: has_openstack_virtualization? == true") true end diff --git a/spec/unit/plugins/openstack_spec.rb b/spec/unit/plugins/openstack_spec.rb index bbfe6a5b..cb67402a 100644 --- a/spec/unit/plugins/openstack_spec.rb +++ b/spec/unit/plugins/openstack_spec.rb @@ -26,7 +26,7 @@ describe Ohai::System, "plugin openstack" do before do PasswdEntry = Struct.new(:name, :uid, :gid, :dir, :shell, :gecos) allow(plugin).to receive(:hint?).with("openstack").and_return(false) - plugin[:virtualization] = { system: {} } + plugin[:virtualization] = { systems: {} } end context "when there is no relevant hint or virtualization data" do @@ -42,7 +42,7 @@ describe Ohai::System, "plugin openstack" do allow(plugin).to receive(:can_socket_connect?) .with(Ohai::Mixin::Ec2Metadata::EC2_METADATA_ADDR, 80, default_timeout) .and_return(false) - plugin[:virtualization] = { system: { guest: "openstack" } } + plugin[:virtualization] = { systems: { openstack: "guest" } } expect(Etc).to receive(:getpwnam).and_raise(ArgumentError) plugin.run end @@ -63,7 +63,7 @@ describe Ohai::System, "plugin openstack" do allow(plugin).to receive(:can_socket_connect?) .with(Ohai::Mixin::Ec2Metadata::EC2_METADATA_ADDR, 80, default_timeout) .and_return(false) - plugin[:virtualization] = { system: { guest: "openstack" } } + plugin[:virtualization] = { systems: { openstack: "guest" } } expect(Etc).to receive(:getpwnam).and_return(PasswdEntry.new("dhc-user", 800, 800, "/var/www", "/bin/false", "The dreamhost user")) plugin.run expect(plugin[:openstack][:provider]).to eq("dreamhost") @@ -295,7 +295,7 @@ describe Ohai::System, "plugin openstack" do allow(plugin).to receive(:can_socket_connect?) .with(Ohai::Mixin::Ec2Metadata::EC2_METADATA_ADDR, 80, default_timeout) .and_return(false) - plugin[:virtualization] = { system: { guest: "openstack" } } + plugin[:virtualization] = { systems: { openstack: "guest" } } plugin.run end |