summaryrefslogtreecommitdiffstats
path: root/lib/puppet/provider/package
diff options
context:
space:
mode:
authorMarkus Roberts <Markus@reality.com>2009-12-12 10:56:37 -0800
committerJames Turnbull <james@lovedthanlost.net>2009-12-15 23:34:44 +1100
commitb96b757f1d091130b06542856c5b5b3a683a8e39 (patch)
tree2ef69c0d8eb46f9fc515ff404cc81ff9c74b1294 /lib/puppet/provider/package
parentd685f446ef88c2273a5e3f310d2ebb2bff9091f8 (diff)
downloadpuppet-b96b757f1d091130b06542856c5b5b3a683a8e39.tar.gz
puppet-b96b757f1d091130b06542856c5b5b3a683a8e39.tar.xz
puppet-b96b757f1d091130b06542856c5b5b3a683a8e39.zip
Fix for #887 (safely setting pager to cat for blastwave)
This is Luke's suggested fix, from the ticket.
Diffstat (limited to 'lib/puppet/provider/package')
-rwxr-xr-xlib/puppet/provider/package/blastwave.rb13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/puppet/provider/package/blastwave.rb b/lib/puppet/provider/package/blastwave.rb
index a2f86aa5a..cf2c87bfe 100755
--- a/lib/puppet/provider/package/blastwave.rb
+++ b/lib/puppet/provider/package/blastwave.rb
@@ -10,8 +10,9 @@ Puppet::Type.type(:package).provide :blastwave, :parent => :sun, :source => :sun
commands :pkgget => pkgget
- # This is so stupid, but then, so is blastwave.
- ENV["PAGER"] = "/usr/bin/cat"
+ def pkgget_with_cat(*args)
+ withenv(:PAGER => "/usr/bin/cat") { pkgget(*args) }
+ end
def self.extended(mod)
unless command(:pkgget) != "pkg-get"
@@ -40,7 +41,7 @@ Puppet::Type.type(:package).provide :blastwave, :parent => :sun, :source => :sun
command << hash[:justme]
end
- output = pkgget command
+ output = pkgget_with_cat command
list = output.split("\n").collect do |line|
next if line =~ /^#/
@@ -88,7 +89,7 @@ Puppet::Type.type(:package).provide :blastwave, :parent => :sun, :source => :sun
end
def install
- pkgget "-f", :install, @resource[:name]
+ pkgget_with_cat "-f", :install, @resource[:name]
end
# Retrieve the version from the current package file.
@@ -107,11 +108,11 @@ Puppet::Type.type(:package).provide :blastwave, :parent => :sun, :source => :sun
# Remove the old package, and install the new one
def update
- pkgget "-f", :upgrade, @resource[:name]
+ pkgget_with_cat "-f", :upgrade, @resource[:name]
end
def uninstall
- pkgget "-f", :remove, @resource[:name]
+ pkgget_with_cat "-f", :remove, @resource[:name]
end
end