Freebsd + Puppet 3.2.2 pkg_add -f ?

219 views
Skip to first unread message

joel johnston

unread,
Aug 7, 2013, 11:17:33 AM8/7/13
to puppet...@googlegroups.com
Shouldn't pkg_add be using the -r option for package management?  I worked around by forcing the client to use ports instead, but it stinks.  Any thoughts? 

badgerious

unread,
Aug 8, 2013, 9:09:07 AM8/8/13
to puppet...@googlegroups.com
Did you install puppet from ports? I did a 3.2.3 install recently and noticed that there is a patch in that port that reverts back to an older version of the freebsd package provider, apparently for ruby 1.8 compatibility. I got rid of the optpatch-package_origin file and reinstalled the port to get the proper package provider, which does indeed use '-r'.

Eric

Russell Jackson

unread,
Aug 12, 2013, 4:35:41 PM8/12/13
to puppet...@googlegroups.com
The standard provider doesn't work with packages that have multiple origins (the apache ports for instance) because the package name doesn't match was is recorded in the package database. So, what will happen is that puppet will think the package isn't installed on every run and attempt to install it.

The only sane way around that was to use the package origin as a key and duplicated the '-r' functionality in the provider; this is what the patch does. Passing '-f' to pkg_add was questionable, but I remember there being problems without it.

badgerious

unread,
Aug 12, 2013, 8:54:45 PM8/12/13
to puppet...@googlegroups.com
I should disclaim that I'm not a huge FreeBSD guy, but do have a couple of FreeBSD boxes around. I've been content getting all packages with 'pkg_add -r' (which seems to work fine with the unpatched freebsd provider); no idea about the interactions with ports you've mentioned.

Couple of others things regarding the patch (semi tangential):

1) If you do an install of puppet 3.2.3 from ports with ruby 1.9.3, you get piles of warnings during puppet runs due to some class variable use in the freebsd provider. This is fixed in vanilla puppet 3.2.3, but undone by the patch.

2) If the freebsd provider is broken, seems like it should be going back upstream rather than patching in the port (forgive my ignorance if this is in fact happening and the patch is interim).

Eric

joel johnston

unread,
Aug 20, 2013, 3:15:38 PM8/20/13
to puppet...@googlegroups.com
So I think the core issue at this point is that no matter where I try
to set PACKAGESITE (on the server via rc, on the client via rc, on the
shell via overrides) the path to the ftp server always returns:

Error: /Stage[main]/Rsync/Package[net/rsync]/ensure: change from
absent to present failed: Execution of '/usr/sbin/pkg_add -f
ftp://ftp.freebsd.org/%2Fpub/FreeBSD/ports/amd64/packages-9-stable/All/rsync-3.0.9_3.tbz'
returned 1: pkg_add: unable to fetch 'ftp://ftp.freebsd.org/

The url is bad/wrong. For some reason it is injecting this %2F in
front of pub where it SHOULD just be /pub/....

How and where is this getting set and how can I change it?
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Puppet Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/puppet-users/1CqH0u84u6g/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> puppet-users...@googlegroups.com.
> To post to this group, send email to puppet...@googlegroups.com.
> Visit this group at http://groups.google.com/group/puppet-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



--
___________________
Joel Johnston
760.437.5116
www.metaband.net
www.j03l.com

Eugene Vilensky

unread,
Aug 21, 2013, 10:35:34 AM8/21/13
to puppet...@googlegroups.com
On Tue, Aug 20, 2013 at 2:15 PM, joel johnston <joeldj...@gmail.com> wrote:
> The url is bad/wrong. For some reason it is injecting this %2F in
> front of pub where it SHOULD just be /pub/....

%2F is a '/' in url encoding, maybe there is a trailing slash
somewhere you can remove which will allow a proper URL to be
constructed.

joel johnston

unread,
Aug 24, 2013, 12:22:39 PM8/24/13
to puppet...@googlegroups.com
The real isssue I seem to be having is that puppet agent is ignoring
my PACKAGESITE variable. I've set it accordingly per:
http://projects.puppetlabs.com/projects/puppet/wiki/Puppet_Free_Bsd/8

pkg_add -r <whatever> works fine from the command line in bash and sh,
but puppet runs use the url above instead of what I've set.

Any ideas where I can set the packagesite var so that puppet can pick it up?

badgerious

unread,
Aug 24, 2013, 1:55:36 PM8/24/13
to puppet...@googlegroups.com
Hi Joel,

From your copy&paste above, looks like pkg_add isn't using the '-r' switch, so PACKAGESITE is not being touched at all. My guess is that you're using the freebsd package provider with the patch I mentioned earlier. The patched provider doesn't use '-r'.

Something else you may want to look into (haven't tried it yet myself, but plan to) is this provider for pkgng:
https://github.com/xaque208/puppet-pkgng

Eric

Russell Jackson

unread,
Aug 26, 2013, 3:41:36 AM8/26/13
to puppet...@googlegroups.com
I've had a little time to look at this. What looks to be happening is that the URI class adds a hard leading slash to ftp:// uri path components which fetch(1) doesn't handle well.

You can work around this by setting the package resource's 'source' parameter to use the http:// scheme. Set it globally using a resource default in your site.pp.

if $operatingsystem == 'FreeBSD' {
  $majorversion = regsubst($kernelversion, '^([0-9]+)\.([0-9]+)$', '\1')

  $scheme = 'http'
  $host   = 'ftp2.us.freebsd.org'
  $urlpath = "/pub/FreeBSD/ports/${hardwareisa}/packages-${majorversion}-stable/"

  Package { source => "${scheme}://${host}/${urlpath}" }
}

Pawel Tomulik

unread,
Dec 9, 2013, 7:01:25 AM12/9/13
to puppet...@googlegroups.com
Hi, you may try this module: http://forge.puppetlabs.com/ptomulik/packagex which implements `portsx` provider (FreeBSD ports).
Reply all
Reply to author
Forward
0 new messages