Try the attached file. Put it in a module named pkgutil and put it in
pkgutil/plugins/puppet/provider/package/pkgutil.rb
Make sure you have plugin syncing on. I haven't tested it. I just
modified a different provider. Should be a starting point for you.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---
# Packaging using Blastwave's pkg-get program.
Puppet::Type.type(:package).provide :pkgutil, :parent => :sun, :source => :sun do
desc "Package management using Blastwave.org's ``pkgutil`` command on Solaris."
pkgget = "pkgutil"
if FileTest.executable?("/opt/csw/bin/pkgutil")
pkgget = "/opt/csw/bin/pkgutil"
end
confine :operatingsystem => :solaris
commands :pkgget => pkgget
# This is so stupid, but then, so is blastwave.
ENV["PAGER"] = "/usr/bin/cat"
def self.extended(mod)
unless command(:pkgget) != "pkgutil"
raise Puppet::Error,
"The pkgutil command is missing; blastwave packaging unavailable"
end
unless FileTest.exists?("/var/opt/csw/pkgutil/admin")
Puppet.notice "It is highly recommended you create '/var/opt/csw/pkgutil/admin'."
end
end
def self.instances(hash = {})
blastlist(hash).collect do |bhash|
bhash.delete(:avail)
new(bhash)
end
end
# Turn our blastwave listing into a bunch of hashes.
def self.blastlist(hash)
command = ["-c"]
if hash[:justme]
command << hash[:justme]
end
output = pkgget command
list = output.split("\n").collect do |line|
next if line =~ /^#/
next if line =~ /^WARNING/
next if line =~ /localrev\s+remoterev/
next if line =~ /^package\s+installed\s+catalog/
blastsplit(line)
end.reject { |h| h.nil? }
if hash[:justme]
return list[0]
else
list.reject! { |h|
h[:ensure] == :absent
}
return list
end
end
# Split the different lines into hashes.
def self.blastsplit(line)
if line =~ /\s*(\S+)\s+((\[Not installed\])|(\S+))\s+(\S+)/
hash = {}
hash[:name] = $1
hash[:ensure] = if $2 == "[Not installed]"
:absent
else
$2
end
hash[:avail] = $5
if hash[:avail] == "SAME"
hash[:avail] = hash[:ensure]
end
# Use the name method, so it works with subclasses.
hash[:provider] = self.name
return hash
else
Puppet.warning "Cannot match %s" % line
return nil
end
end
def install
$output = pkgget "-y", "-i", @resource[:name]
Puppet.warning $output
end
# Retrieve the version from the current package file.
def latest
hash = self.class.blastlist(:justme => @resource[:name])
hash[:avail]
end
def query
if hash = self.class.blastlist(:justme => @resource[:name])
hash
else
{:ensure => :absent}
end
end
# Remove the old package, and install the new one
def update
pkgget "-y", "-u", @resource[:name]
end
def uninstall
pkgget "-y", "-r", @resource[:name]
end
end
On Oct 21, 2009, at 12:03 AM, Luke Kanies wrote:
>
> On Oct 19, 2009, at 7:24 PM, windowsrefund wrote:
>
>>
>> Seems that blastwave is all about pkgutil now. Are there any plans to
>> support this?
>
> We don't really target specific providers - in general, people who
> want the support provide it (heh heh). We've got enough package
> providers at this point it should be pretty darn easy to write a new
> one, tests and everything.
>
> --
> If a `religion' is defined to be a system of ideas that contains
> unprovable statements, then Godel taught us that mathematics is not
> only a religion, it is the only religion that can prove itself to be
> one. -- John Barrow
> ---------------------------------------------------------------------
> Luke Kanies | http://reductivelabs.com | http://madstop.com
>
>
> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google
> Groups "Puppet Users" 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-users?hl=en
> -~----------~----~----~----~------~----~------~--~---
>