Please review pull request #135: Ticket/1.6.x/10271 identifying amazon opened by (mv)

Description:

Ken,

Hello again!

I did it following your instructions. Now I have just 1 commit against 1.6.x. You were right, I was working directly from master and did not pay attention to that. I apologize because this flux of work was not familiar to me. But now I understand it and any new request will be done in this fashion.

Thanks for the help.

Marcus

  • Opened: Mon Jan 02 14:02:17 UTC 2012
  • Based on: puppetlabs:1.6.x (531f4d8c54a2c0196d25cae09771c17688006345)
  • Requested merge: mv:ticket/1.6.x/10271-identifying_amazon (f8473b050500a74109bf5eca0b3b3f29bdc3cc96)

Diff follows:

diff --git a/lib/facter/operatingsystem.rb b/lib/facter/operatingsystem.rb
index cf15a8d..32fa746 100644
--- a/lib/facter/operatingsystem.rb
+++ b/lib/facter/operatingsystem.rb
@@ -14,13 +14,7 @@
 
 Facter.add(:operatingsystem) do
   confine :kernel => :sunos
-  setcode do
-    if FileTest.exists?("/etc/debian_version")
-      "Nexenta"
-    else
-      "Solaris"
-    end
-  end
+  setcode do "Solaris" end
 end
 
 Facter.add(:operatingsystem) do
@@ -88,7 +82,9 @@
       "Slackware"
     elsif FileTest.exists?("/etc/alpine-release")
       "Alpine"
-    elsif Facter.value(:lsbdistdescription) =~ /Amazon Linux/
+    elsif FileTest.exists?("/etc/mageia-release")
+      "Mageia"
+    elsif FileTest.exists?("/etc/system-release")
       "Amazon"
     end
   end
diff --git a/spec/unit/operatingsystem_spec.rb b/spec/unit/operatingsystem_spec.rb
index d00b1a9..2a2c259 100755
--- a/spec/unit/operatingsystem_spec.rb
+++ b/spec/unit/operatingsystem_spec.rb
@@ -13,25 +13,17 @@
 
     Facter.fact(:operatingsystem).value.should == "Nutmeg"
   end
-  it "should be ESXi for VMkernel" do
-     Facter.fact(:kernel).stubs(:value).returns("VMkernel")
 
-     Facter.fact(:operatingsystem).value.should == "ESXi"
-  end
+  it "should be Solaris for SunOS" do
+     Facter.fact(:kernel).stubs(:value).returns("SunOS")
 
-  describe "on Solaris variants" do
-    before :each do
-      Facter.fact(:kernel).stubs(:value).returns("SunOS")
-    end
+     Facter.fact(:operatingsystem).value.should == "Solaris"
+  end
 
-    it "should be Nexenta if /etc/debian_version is present" do
-      FileTest.expects(:exists?).with("/etc/debian_version").returns true
-      Facter.fact(:operatingsystem).value.should == "Nexenta"
-    end
+  it "should be ESXi for VMkernel" do
+     Facter.fact(:kernel).stubs(:value).returns("VMkernel")
 
-    it "should be Solaris for SunOS if no other variants match" do
-      Facter.fact(:operatingsystem).value.should == "Solaris"
-    end
+     Facter.fact(:operatingsystem).value.should == "ESXi"
   end
 
   describe "on Linux" do
@@ -53,6 +45,7 @@
       "Bluewhite64" => "/etc/bluewhite64-version",
       "Slamd64"     => "/etc/slamd64-version",
       "Slackware"   => "/etc/slackware-version",
+      "Amazon"      => "/etc/system-release",
     }.each_pair do |distribution, releasefile|
       it "should be #{distribution} if #{releasefile} exists" do
         FileTest.expects(:exists?).with(releasefile).returns true
@@ -72,10 +65,6 @@
         Facter.fact(:operatingsystem).value.should == "Ubuntu"
       end
 
-      it "on Amazon Linux should use the lsbdistdescription fact" do
-        Facter.fact(:lsbdistdescription).stubs(:value).returns "Amazon Linux"
-        Facter.fact(:operatingsystem).value.should == "Amazon"
-      end
     end
 
 

    

--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to puppet-dev@googlegroups.com.
To unsubscribe from this group, send email to puppet-dev+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to