Date: Wed, 27 Jun 2012 11:38:28 +0200 (CEST) From: Romain Tartiere <romain@FreeBSD.org> To: FreeBSD-gnats-submit@FreeBSD.org Cc: swills@FreeBSD.org Subject: ports/169481: [patch] sysutils/puppet fails to install packages Message-ID: <20120627093828.3B2BD41998@marvin.blogreen.org> Resent-Message-ID: <201206270940.q5R9e8pg007984@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 169481 >Category: ports >Synopsis: [patch] sysutils/puppet fails to install packages >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 Jun 27 09:40:08 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Romain Tartiere >Release: FreeBSD 9.0-STABLE amd64 >Organization: >Environment: System: FreeBSD marvin.blogreen.org 9.0-STABLE FreeBSD 9.0-STABLE #31 r237367: Thu Jun 21 11:52:53 CEST 2012 root@marvin.blogreen.org:/usr/obj/usr/src/sys/MARVIN amd64 >Description: When using puppet with the default options, trying to install a package with a manifest including for example the following lines will fail: ------ [beginning of manifest] ------ [...] package { "sysutils/tmux": ensure => installed, } [...] --------- [end of manifest] --------- ------ [beginning of failure details] ------ # puppet agent --test --debug [...] debug: Prefetching freebsd resources for package debug: Puppet::Type::Package::ProviderFreebsd: Executing '/usr/sbin/pkg_info -aoQ' debug: Puppet::Type::Package::ProviderFreebsd: Executing '/usr/sbin/pkg_info -aoQ' debug: Package: sysutils/tmux: origin => {:port_category=>"sysutils", :port_name=>"tmux"} debug: Package: sysutils/tmux: source => #<URI::HTTP:0x805cf55f0 URL:http://packages.blogreen.org/> debug: Fetching INDEX: #<URI::HTTP:0x805cf4290 URL:http://packages.blogreen.org/INDEX.bz2> err: /Stage[main]/XXXX/Package[sysutils/tmux]/ensure: change from absent to present failed: Could not set 'present on ensure: can't convert nil into String at /usr/local/etc/puppet/manifests/site.pp:27 --------- [end of failure details] --------- The file /usr/local/lib/ruby/site_ruby/1.8/puppet/provider/package/freebsd.rb is patched from the origninal one by the port, but the error is tied into it. Relevant code: ------ [beginning of failing code] ------ 77 Puppet.debug "Fetching INDEX: #{uri.inspect}" 78 begin 79 open(uri, "r") do |f| 80 Bzip2::Reader.open(f.path) do |f| 81 while (line = f.gets) 82 fields = line.split("|") 83 pkg_info = self.class.parse_pkg_string(fields[0]) 84 origin = self.class.parse_origin(fields[1]) 85 @@ports_index[origin] = pkg_info 86 end 87 end 88 end 89 rescue IOError, OpenURI::HTTPError, Net::FTPError 90 @@ports_index = nil 91 raise Puppet::Error.new "Could not fetch ports INDEX: #{$!}" 92 end --------- [end of failing code] --------- >From IRB, the object provided by open at line 79 has no #path:: ------ [beginning of failing code] ------ irb(main):001:0> require 'open-uri' => true irb(main):002:0> open("http://packages.blogreen.org/INDEX-9.bz2", "r") do |f| irb(main):003:1* f.path irb(main):004:1> end => nil --------- [end of failing code] --------- Maybe this is a regression or something... AFAICR, this code used to work a while ago. >How-To-Repeat: Try to install a package. >Fix: Bzip2::Reader.open seems to accept URIs, so we can just apply this change: ------ [beginning of fix] ------ --- files/optpatch-package_origin.orig 2012-06-27 11:34:23.466621862 +0200 +++ files/optpatch-package_origin 2012-06-27 11:34:53.903314301 +0200 @@ -96,14 +96,12 @@ + uri = source.merge "INDEX.bz2" + Puppet.debug "Fetching INDEX: #{uri.inspect}" + begin -+ open(uri, "r") do |f| -+ Bzip2::Reader.open(f.path) do |f| -+ while (line = f.gets) -+ fields = line.split("|") -+ pkg_info = self.class.parse_pkg_string(fields[0]) -+ origin = self.class.parse_origin(fields[1]) -+ @@ports_index[origin] = pkg_info -+ end ++ Bzip2::Reader.open(uri) do |f| ++ while (line = f.gets) ++ fields = line.split("|") ++ pkg_info = self.class.parse_pkg_string(fields[0]) ++ origin = self.class.parse_origin(fields[1]) ++ @@ports_index[origin] = pkg_info + end + end + rescue IOError, OpenURI::HTTPError, Net::FTPError --------- [end of fix] --------- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120627093828.3B2BD41998>