diff options
| author | Dominic Cleal <dcleal@redhat.com> | 2010-11-29 12:40:19 +0000 |
|---|---|---|
| committer | Dominic Cleal <dcleal@redhat.com> | 2010-11-29 12:40:19 +0000 |
| commit | f8e9155926188f66c1918b51950686d3abad8b78 (patch) | |
| tree | b4ef9c563cd3560a801a635008d2d05aec3b4aa5 /lib | |
| parent | 485ac3865d54b8a0819a75c7d2eb06f11b7daea7 (diff) | |
| download | puppet-f8e9155926188f66c1918b51950686d3abad8b78.tar.gz puppet-f8e9155926188f66c1918b51950686d3abad8b78.tar.xz puppet-f8e9155926188f66c1918b51950686d3abad8b78.zip | |
Removing blastwave references and unused PAGER
Diffstat (limited to 'lib')
| -rwxr-xr-x | lib/puppet/provider/package/pkgutil.rb | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/puppet/provider/package/pkgutil.rb b/lib/puppet/provider/package/pkgutil.rb index 4e2c0d9f6..b9d0ea4eb 100755 --- a/lib/puppet/provider/package/pkgutil.rb +++ b/lib/puppet/provider/package/pkgutil.rb @@ -10,9 +10,6 @@ Puppet::Type.type(:package).provide :pkgutil, :parent => :sun, :source => :sun d commands :pkguti => pkguti - # This is so stupid, but then, so is blastwave. - ENV["PAGER"] = "/usr/bin/cat" - def self.extended(mod) unless command(:pkguti) != "pkgutil" raise Puppet::Error, @@ -26,14 +23,15 @@ Puppet::Type.type(:package).provide :pkgutil, :parent => :sun, :source => :sun d end def self.instances(hash = {}) - blastlist(hash).collect do |bhash| + pkglist(hash).collect do |bhash| bhash.delete(:avail) new(bhash) end end - # Turn our blastwave listing into a bunch of hashes. - def self.blastlist(hash) + # Turn our pkgutil -c listing into a bunch of hashes. + # Supports :justme => packagename, which uses the optimised --single arg + def self.pkglist(hash) command = ["-c"] if hash[:justme] @@ -53,7 +51,7 @@ Puppet::Type.type(:package).provide :pkgutil, :parent => :sun, :source => :sun d next if line =~ /^=+> / # catalog fetch next if line =~ /\d+:\d+:\d+ URL:/ # wget without -q - parsed = blastsplit(line) + parsed = pkgsplit(line) # When finding one package, ensure we picked up the package line # itself, not any pkgutil noise. @@ -74,7 +72,7 @@ Puppet::Type.type(:package).provide :pkgutil, :parent => :sun, :source => :sun d end # Split the different lines into hashes. - def self.blastsplit(line) + def self.pkgsplit(line) if line =~ /\s*(\S+)\s+(\S+)\s+(.*)/ hash = {} hash[:name] = $1 @@ -105,12 +103,12 @@ Puppet::Type.type(:package).provide :pkgutil, :parent => :sun, :source => :sun d # Retrieve the version from the current package file. def latest - hash = self.class.blastlist(:justme => @resource[:name]) + hash = self.class.pkglist(:justme => @resource[:name]) hash[:avail] end def query - if hash = self.class.blastlist(:justme => @resource[:name]) + if hash = self.class.pkglist(:justme => @resource[:name]) hash else {:ensure => :absent} |
