ports/158681: sysutils/puppet: Fix for optpatched 'freebsd' package provider
Romain Tartiere
romain at FreeBSD.org
Wed Jul 6 07:30:10 UTC 2011
>Number: 158681
>Category: ports
>Synopsis: sysutils/puppet: Fix for optpatched 'freebsd' package provider
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Wed Jul 06 07:30:10 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator: Romain Tartiere
>Release: FreeBSD 8.2-STABLE amd64
>Organization:
>Environment:
System: FreeBSD marvin.blogreen.org 8.2-STABLE FreeBSD 8.2-STABLE #7 r222417: Sat May 28 13:23:35 CEST 2011 root at marvin.blogreen.org:/usr/obj/usr/src/sys/MARVIN amd64
>Description:
The puppet port will patch the 'freebsd' packages provider if the
PACKAGE_ORIGIN is set (default). The resulting provider will fail to start
with message:
err: Could not retrieve catalog from remote server: Could not intern from pson: Could not autoload package: Could not autoload /usr/local/lib/ruby/site_ruby/1.8/puppet/provider/package/freebsd.rb: Could not find parent provider Puppet::Util::Package of freebsd
(and BTW, why is this option enabled by default, and could not the patch just
add a new provider with a different name?)
>How-To-Repeat:
1. Build puppet package with default options;
2. Install on a master and client machine;
3. Edit puppetmaster manifests to install software on clients;
4. Run the agent
>Fix:
Adding the following require line fix the error:
require 'puppet/provider/package'
Please note that the modified implementation do not fit my environment and I
could not test beyond a 404 error when fetching '/Latest/INDEX.bz2'.
Here is a patch (git and patchtool do things slightly differently hence the
quite big patch whole not much change):
--- puppet.diff begins here ---
diff -Nur /var/cache/portshaker/ports/sysutils/puppet/files/optpatch-package_origin ./files/optpatch-package_origin
--- /var/cache/portshaker/ports/sysutils/puppet/files/optpatch-package_origin 2011-04-10 18:11:49.000000000 +0200
+++ ./files/optpatch-package_origin 2011-07-06 02:33:21.902540033 +0200
@@ -1,8 +1,9 @@
-diff --git lib/puppet/provider/package/freebsd.rb lib/puppet/provider/package/freebsd.rb
-index e10a20b..f36e29e 100755
---- lib/puppet/provider/package/freebsd.rb
+
+$FreeBSD$
+
+--- lib/puppet/provider/package/freebsd.rb.orig
+++ lib/puppet/provider/package/freebsd.rb
-@@ -1,37 +1,165 @@
+@@ -1,37 +1,166 @@
-Puppet::Type.type(:package).provide :freebsd, :parent => :openbsd do
- desc "The specific form of package management on FreeBSD. This is an
- extremely quirky packaging system, in that it freely mixes between
@@ -12,6 +13,7 @@
+require 'open-uri'
+require 'net/ftp'
+require 'bz2'
++require 'puppet/provider/package'
- commands :pkginfo => "/usr/sbin/pkg_info",
- :pkgadd => "/usr/sbin/pkg_add",
@@ -28,12 +30,12 @@
confine :operatingsystem => :freebsd
+ defaultfor :operatingsystem => :freebsd
-+
-+ @@lock = Mutex.new
-+ @@ports_index = nil
- def self.listcmd
- command(:pkginfo)
++ @@lock = Mutex.new
++ @@ports_index = nil
++
+ # fix bug in URI::FTP merge method that tries to set typecode
+ # even when other is a string.
+ class URI::FTP
@@ -54,7 +56,11 @@
+ :pkg_version => pkg_string.split("-")[-1],
+ }
+ end
-+
+
+- if @resource[:source] =~ /\/$/
+- if @resource[:source] =~ /^(ftp|https?):/
+- Puppet::Util::Execution::withenv :PACKAGESITE => @resource[:source] do
+- pkgadd "-r", @resource[:name]
+ def self.unparse_pkg_info(pkg_info)
+ [:pkg_name, :pkg_version].map { |key| pkg_info[key] }.join("-")
+ end
@@ -70,11 +76,7 @@
+ end
+ origin
+ end
-
-- if @resource[:source] =~ /\/$/
-- if @resource[:source] =~ /^(ftp|https?):/
-- Puppet::Util::Execution::withenv :PACKAGESITE => @resource[:source] do
-- pkgadd "-r", @resource[:name]
++
+ def self.instances
+ packages = []
+ output = pkginfo "-aoQ"
@@ -190,7 +192,7 @@
end
def query
-@@ -44,7 +172,7 @@ Puppet::Type.type(:package).provide :freebsd, :parent => :openbsd do
+@@ -44,7 +173,7 @@
end
def uninstall
--- puppet.diff ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list