[Pkg-puppet-devel] [facter] 328/352: (fact-155) Fix operatingsystemrelease for Solaris 11

Stig Sandbeck Mathisen ssm at debian.org
Sun Apr 6 22:21:58 UTC 2014


This is an automated email from the git hooks/post-receive script.

ssm pushed a commit to branch master
in repository facter.

commit b58108ec2be0bf8ee719f4c583faaf83efe79044
Author: Stefan Schulte <stefan.schulte at taunusstein.net>
Date:   Thu Jan 9 22:32:17 2014 +0100

    (fact-155) Fix operatingsystemrelease for Solaris 11
    
    The /etc/release file has changed from Solaris 10 to Solaris 11 and
    because the regular expression does not match anymore the
    operatingsystemrelease shows the kernelrelease fact on Solaris 11.
    
    Change the regular expression to also identify Solaris 11
---
 lib/facter/operatingsystemrelease.rb     | 5 +++++
 spec/unit/operatingsystemrelease_spec.rb | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/lib/facter/operatingsystemrelease.rb b/lib/facter/operatingsystemrelease.rb
index a57abe7..8d94ffc 100644
--- a/lib/facter/operatingsystemrelease.rb
+++ b/lib/facter/operatingsystemrelease.rb
@@ -181,8 +181,13 @@ Facter.add(:operatingsystemrelease) do
   setcode do
     if release = Facter::Util::FileRead.read('/etc/release')
       line = release.split("\n").first.chomp
+      # Solaris 10: Solaris 10 10/09 s10x_u8wos_08a X86
+      # Solaris 11 (old naming scheme): Oracle Solaris 11 11/11 X86
+      # Solaris 11 (new naming scheme): Oracle Solaris 11.1 SPARC
       if match = /\s+s(\d+)[sx]?(_u\d+)?.*(?:SPARC|X86)/.match(line)
         match.captures.join('')
+      elsif match = /Solaris ([0-9\.]+(?:\s*[0-9\.\/]+))\s*(?:SPARC|X86)/.match(line)
+        match.captures[0]
       end
     end
   end
diff --git a/spec/unit/operatingsystemrelease_spec.rb b/spec/unit/operatingsystemrelease_spec.rb
index 9a77dac..93c4c87 100755
--- a/spec/unit/operatingsystemrelease_spec.rb
+++ b/spec/unit/operatingsystemrelease_spec.rb
@@ -119,6 +119,8 @@ describe "Operating System Release fact" do
       'Solaris 10 10/09 s10x_u8wos_08a X86'          => '10_u8',
       'Oracle Solaris 10 9/10 s10x_u9wos_14a X86'    => '10_u9',
       'Oracle Solaris 10 8/11 s10x_u10wos_17b X86'   => '10_u10',
+      'Oracle Solaris 11 11/11 X86'                  => '11 11/11',
+      'Oracle Solaris 11.1 SPARC'                    => '11.1'
     }.each do |fakeinput,expected_output|
       it "should be able to parse a release of #{fakeinput}" do
         Facter::Util::FileRead.stubs(:read).with('/etc/release').returns fakeinput

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-puppet/facter.git



More information about the Pkg-puppet-devel mailing list