Closed rtyler closed 8 years ago
The log from a puppet apply
on a machine running 10.0-RELEASE
Info: Loading facts in /usr/home/ec2-user/puppet/modules/stdlib/lib/facter/facter_dot_d.rb
Info: Loading facts in /usr/home/ec2-user/puppet/modules/stdlib/lib/facter/pe_version.rb
Info: Loading facts in /usr/home/ec2-user/puppet/modules/stdlib/lib/facter/puppet_vardir.rb
Info: Loading facts in /usr/home/ec2-user/puppet/modules/stdlib/lib/facter/root_home.rb
Info: Loading facts in /usr/home/ec2-user/puppet/modules/pkgng/lib/facter/pkgng.rb
Warning: Config file /usr/local/etc/puppet/hiera.yaml not found, using Hiera defaults
/usr/local/lib/ruby/site_ruby/1.9/puppet/provider/package/freebsd.rb:18: warning: class variable access from toplevel
/usr/local/lib/ruby/site_ruby/1.9/puppet/provider/package/freebsd.rb:19: warning: class variable access from toplevel
Error: Duplicate declaration: File[/usr/local/etc/pkg.conf] is already declared in file /usr/home/ec2-user/puppet/manifests/site.pp:8; cannot redeclare at /usr/home/ec2-user/puppet/modules/pkgng/manifests/init.pp:29 on node ip-10-238-16-244.us-west-2.compute.internal
Error: Duplicate declaration: File[/usr/local/etc/pkg.conf] is already declared in file /usr/home/ec2-user/puppet/manifests/site.pp:8; cannot redeclare at /usr/home/ec2-user/puppet/modules/pkgng/manifests/init.pp:29 on node ip-10-238-16-244.us-west-2.compute.internal
r
May I see /usr/home/ec2-user/puppet/manifests/site.pp please?
I don't believe this to be the case. My 10-RELEASE machine running pkg version 1.2.6 has the following line in the manpage:
The default location of this file is /usr/local/etc/pkg.conf
The duplicate declaration you are seeing could be caused by something in the manifest.
A 10.0 test machine here works fine with the current file locations, so I don't think there's a problem in that. However, the 10.0 pkg does tries to use /etc/pkg/FreeBSD.conf
which was installed by default. Personally, I just do the following in my own manifest:
# FreeBSD 10.0 installs this file, which activates the official FreeBSD
# package repository. It conflicts with our repository, so remove it.
file { '/etc/pkg/FreeBSD.conf':
ensure => absent,
}
I haven't created a pull request, as it might be a little scary to put this in a public module. But, if I delete this file, pkg works just the same as on 8.x and 9.x. On these versions, the deletion is a no-op.
Having the file in one place does seem saner - the module should probably say if it's managing the config that it always goes in one place and /usr/local makes more sense anyway. I would probably consider rm'ing the folder as whole. Seems a sensible default - and then an option to not do it.
If the only thing contained in /etc/pkg
are repo configurations, you can do something like:
file { '/etc/pkg':
ensure => directory,
purge => true,
recurse => true,
}
This will basically remove all files under the directory that are not managed with Puppet. This is an approach you may find elsewhere in Debian and others where the authoritative source for repository lists come from Puppet. I find this super useful and would +1 a merge of something that added this ability to the pkgng
class.
I do not believe this to be an issue any longer, and was resolved long ago.
Thanks Zach On Apr 18, 2016 2:27 PM, "Zach Leslie" notifications@github.com wrote:
I do not believe this to be an issue any longer, and was resolved long ago.
— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/xaque208/puppet-pkgng/issues/27#issuecomment-211590074
The configuration is now in
/etc/pkg/FreeBSD.conf
, so all the logic inmanifests/init.pp
and the provider around tracking/usr/local/etc/pkg.conf
needs to be updated