Skip to content

Instantly share code, notes, and snippets.

Created August 24, 2013 17:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/6329465 to your computer and use it in GitHub Desktop.
Save anonymous/6329465 to your computer and use it in GitHub Desktop.
Patched freebsd package provider vs unpatched
# 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