Philip Brown
2012-Sep-19 18:04 UTC
[Puppet Users] patch for puppet 2.7.18, pkg.rb to work in solaris 11
The currently existing ruby gems version of puppet (2.7.18) is not fully compatible with solaris 11 packages. It whines about some packages not matching the regular expression. I hunted around, and found a patch in the ruby bug database... which doesnt work. I found a new version of pkg.rb in puppet 3.0... .which is not backwards compatible. So, I decided to make a new version. Specifically, I just recoded the parse_line() routine, to be along the lines of the puppet 3.0 version, yet compatible with current release. Not sure if I should cross post this to puppet-dev or whatever. but here it is inline, since its short-ish. Disclaimer #1: This *appears* to work for me: I have not done extensive testing yet. Disclaimer #2: This is for *officially shipping solaris 11*. It would probably break if you''re using the old "opensolaris" junk To use this, hand-edit /var/ruby/1.8/gem_home/gems/puppet-2.7.18/lib/puppet/provider/package/pkg.rb and replace the existing parse_line definition, with this one. def self.parse_line(line) hash = {} case when line =~ /^(\S+) +(\S+) +(...)$/ hash[:name] = $1 hash[:version] = $2 hash[:flags] = $3 when line =~ /^(\S+) \((.+)\) +(\S+) +(\S+)$/ hash[:name] = $1 hash[:version] = $3 hash[:flags] = $4 else warning "Failed to match ''pkg list'' line #{line.inspect}" return nil end hash[:provider] = self.name hash[:status] = case hash[:flags] when /^i/ ''installed'' when /^-/ ''known'' else warning "unknown package state for #{hash[:name]}: #{hash[:flags]}" ''unknown'' end if hash[:status] == "installed" hash[:ensure] = :present else hash[:ensure] = :absent end return hash end -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/Zz1-vPnir-8J. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.