Skip to content

Commit

Permalink
Updates based on feeback
Browse files Browse the repository at this point in the history
  • Loading branch information
tas50 committed Apr 7, 2016
1 parent 572dc05 commit 509c105
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions lib/ohai/plugins/ec2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
# How we detect EC2 from easiest to hardest & least reliable
# 1. Ohai ec2 hint exists. This always works
# 2. Xen hypervisor UUID starts with 'ec2'. This catches Linux HVM & paravirt instances
# 2. DMI data mentions amazon. This catches HVM instances in a VPC
# 3. Kernel data mentioned Amazon. This catches Windows HVM & paravirt instances
# 3. DMI data mentions amazon. This catches HVM instances in a VPC
# 4. Kernel data mentioned Amazon. This catches Windows HVM & paravirt instances

require "ohai/mixin/ec2_metadata"
require "base64"
Expand Down
14 changes: 7 additions & 7 deletions spec/unit/plugins/ec2_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -259,23 +259,23 @@
end # shared examples for ec2

describe "with ec2 dmi data" do
it_should_behave_like "ec2"
it_behaves_like "ec2"

before(:each) do
plugin[:dmi] = { :bios => { :all_records => [ { :Version => "4.2.amazon" } ] } }
end
end

describe "with amazon kernel data" do
it_should_behave_like "ec2"
it_behaves_like "ec2"

before(:each) do
plugin[:kernel] = { :os_info => { :organization => "Amazon.com" } }
end
end

describe "with EC2 Xen UUID" do
it_should_behave_like "ec2"
it_behaves_like "ec2"

before(:each) do
allow(File).to receive(:exist?).with("/sys/hypervisor/uuid").and_return(true)
Expand All @@ -284,7 +284,7 @@
end

describe "with non-EC2 Xen UUID" do
it_should_behave_like "!ec2"
it_behaves_like "!ec2"

before(:each) do
allow(File).to receive(:exist?).with("/sys/hypervisor/uuid").and_return(true)
Expand All @@ -293,7 +293,7 @@
end

describe "with ec2 hint file" do
it_should_behave_like "ec2"
it_behaves_like "ec2"

before(:each) do
if windows?
Expand All @@ -307,7 +307,7 @@
end

describe "with rackspace hint file" do
it_should_behave_like "!ec2"
it_behaves_like "!ec2"

before(:each) do
allow(File).to receive(:exist?).with("/etc/chef/ohai/hints/rackspace.json").and_return(true)
Expand All @@ -318,7 +318,7 @@
end

describe "without any hints that it is an ec2 system" do
it_should_behave_like "!ec2"
it_behaves_like "!ec2"

before(:each) do
allow(File).to receive(:exist?).with("/etc/chef/ohai/hints/ec2.json").and_return(false)
Expand Down

0 comments on commit 509c105

Please sign in to comment.