Issue #11004 has been updated by Ben Hughes.

I've been suffering this myself on our Solaris 11 box.

They have indeed changed the output of pkg -H, because that's useful.

So, I've written something quite quite horrible which kinda works.

<pre>
diff --git i/lib/puppet/provider/package/pkg.rb 
w/lib/puppet/provider/package/pkg.rb
index 399a9df..6e71689 100644
--- i/lib/puppet/provider/package/pkg.rb
+++ w/lib/puppet/provider/package/pkg.rb
@@ -22,7 +22,12 @@ Puppet::Type.type(:package).provide :pkg, :parent => 
Puppet::Provider::Package d
     packages
   end
 
+  # Sol 11 version
+  # x11/library/libxcb  1.7-0.175.0.0.0.0.1215     i--
+  #
+
   self::REGEX = /^(\S+)(?:\s+\(.*?\))?\s+(\S+)\s+(\S+)\s+\S+$/
+  self::BACKUPREGEX = /^(\S+)\s+(\S+)\s+(\S+)$/
   self::FIELDS = [:name, :version, :status]
 
   def self.parse_line(line)
@@ -35,14 +40,29 @@ Puppet::Type.type(:package).provide :pkg, :parent => 
Puppet::Provider::Package d
 
       hash[:provider] = self.name
 
-      if hash[:status] == "installed"
+      if hash[:status] == "installed" or hash[:status] == "i--"
         hash[:ensure] = :present
       else
         hash[:ensure] = :absent
       end
     else
-      warning "Failed to match 'pkg list' line #{line.inspect}"
-      return nil
+      if match = self::BACKUPREGEX.match(line)
+
+        self::FIELDS.zip(match.captures) { |field,value|
+          hash[field] = value
+        }
+
+        hash[:provider] = self.name
+
+        if hash[:status] == "installed" or hash[:status] == "i--"
+          hash[:ensure] = :present
+        else
+          hash[:ensure] = :absent
+        end
+      else
+        warning "Failed to match smelly 'pkg list' line #{line.inspect}"
+        return nil
+      end
     end
 
     hash
@@ -59,6 +79,8 @@ Puppet::Type.type(:package).provide :pkg, :parent => 
Puppet::Provider::Package d
         return v
       when "installed"
         version = v
+      when "i--"
+        version = v
       else
         Puppet.warn "unknown package state for #{@resource[:name]}: #{v}"
       end
</pre>

Which is utterly filthy, but means package/pkg works on my solaris install. I 
tried to work out if I can just combine that regex, but man was it ugly. If the 
good Mr. Van Veelan doesn't sign the CLA, shall I work this in to a better 
patch? I've not looked at his diff, so legally we're above board there I think.
----------------------------------------
Feature #11004: Solaris 11 GA & pkg
https://projects.puppetlabs.com/issues/11004#change-61438

Author: Robert van Veelen
Status: Requires CLA to be signed
Priority: Normal
Assignee: 
Category: package
Target version: 
Affected Puppet version: 
Keywords: 
Branch: 


Oracle has changed the output format of pkg again for the final release of s11. 
The "status" field is no longer present in the output of "pkg list -H". There 
is now an IFO field that has the following status flags (from the man page):

         The last column contains a set of flags  that  show  the
         status of the package:

             o    An i in the I column shows that the package  is
                  installed.

             o    An f in the F column shows that the package  is
                  frozen.

             o    An o in the O column shows that the package  is
                  obsolete.  An  r in the O column shows that the
                  package has been renamed  (a  form  of  obsole-
                  tion).

Using the work done for Bug #7986 , I have tried the following with some 
success (though this only uses the 'I' column):



-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to