Permalink
Browse files

OHAI-304: Detect lsb id of 'AmazonAMI' as amazon

  • Loading branch information...
btm committed Oct 21, 2011
1 parent 72d010a commit 817b2a3802ca0ab1fd87365e669ebe0496fdecf3
Showing with 17 additions and 0 deletions.
  1. +3 −0 lib/ohai/plugins/linux/platform.rb
  2. +14 −0 spec/ohai/plugins/linux/platform_spec.rb
@@ -33,6 +33,9 @@ def get_redhatish_version(contents)
if lsb[:id] =~ /RedHat/i
platform "redhat"
platform_version lsb[:release]
+elsif lsb[:id] =~ /Amazon/i
+ platform "amazon"
+ platform_version lsb[:release]
elsif lsb[:id]
platform lsb[:id].downcase
platform_version lsb[:release]
@@ -56,6 +56,20 @@
@ohai._require_plugin("linux::platform")
@ohai[:platform_version].should == "8.04"
end
+
+ it "should set platform to redhat when [:lsb][:id] contains Redhat" do
+ @ohai[:lsb][:id] = "RedHatEnterpriseServer"
+ @ohai[:lsb][:release] = "5.7"
+ @ohai._require_plugin("linux::platform")
+ @ohai[:platform].should == "redhat"
+ end
+
+ it "should set platform to amazon when [:lsb][:id] contains Amazon" do
+ @ohai[:lsb][:id] = "AmazonAMI"
+ @ohai[:lsb][:release] = "2011.09"
+ @ohai._require_plugin("linux::platform")
+ @ohai[:platform].should == "amazon"
+ end
end
describe "on debian" do

0 comments on commit 817b2a3

Please sign in to comment.