Created
August 24, 2013 17:52
-
-
Save anonymous/6329465 to your computer and use it in GitHub Desktop.
Patched freebsd package provider vs unpatched
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PATCHED #install | |
def install | |
should = @resource.should(:ensure) | |
origin # call origin so we check the package name for correctness early | |
# Source URI is for local file path. | |
if !source.absolute? or source.scheme == "file" | |
pkgadd source.path | |
# Source URI is to specific package file | |
elsif source.absolute? && source.path.end_with?(".tbz") | |
pkgadd source.to_s | |
# Source URI is to a package repository | |
else | |
pkgadd "-f", package_uri.to_s | |
end | |
nil | |
end | |
# UNPATCHED #install | |
def install | |
should = @resource.should(:ensure) | |
if @resource[:source] =~ /\/$/ | |
if @resource[:source] =~ /^(ftp|https?):/ | |
Puppet::Util.withenv :PACKAGESITE => @resource[:source] do | |
pkgadd "-r", @resource[:name] | |
end | |
else | |
Puppet::Util.withenv :PKG_PATH => @resource[:source] do | |
pkgadd @resource[:name] | |
end | |
end | |
else | |
Puppet.warning "source is defined but does not have trailing slash, ignoring #{@resource[:source]}" if @resource[:source] | |
pkgadd "-r", @resource[:name] | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment