C.P.A van Run [Tue, 20 Sep 2016 15:17:00 +0000 (17:17 +0200)]
On Puppet 3.7.2 the undef default for $notify_update will overwrite the default boolean setting for $notify_update in apt::settings resulting in an error 400: "" is not a boolean
(MODULES-3414) Limit non-strict parsing to pre-3.5.0 only
Puppet 3.5.0 introduced strict variables and the module handles strict
variables by using the defined() function. This does not work on prior
versions of puppet so we must gate based on that version.
Puppet 4 series has a new setting `strict` that may be set to enforce
strict variables while `strict_variables` remains unset (see PUP-6358)
which causes this conditional to erroniously use non-strict 3.5-era
parsing and fail.
The new conditional corrects the cases such that strict variable
behavior happens on versions 3.5.0 and later.
Nick Berard [Sat, 2 Jul 2016 00:31:05 +0000 (17:31 -0700)]
After the repository is added, the ${::apt::sources_list_d}/${sources_list_d_filename} file is created as an empty file.
The unless condition of Exec["add-apt-repository-${name}"] calls test -s, which returns 1 if the file is empty. Because
the file is empty, the unless condition is never true and the repository is added on every execution. This commit
replaces the -s test condition with -f, which is true if the file exists or false otherwise.
Philipp Wagner [Fri, 29 Apr 2016 12:20:53 +0000 (14:20 +0200)]
Install software-properties-common for xenial
Instead of adding every newer release of Ubuntu, let's assume that the
package name that is used today will be used in the future, until the
next change is necessary.
Philipp Wagner [Wed, 3 Feb 2016 16:13:46 +0000 (17:13 +0100)]
Look for correct sources.list.d file for apt::ppa
In Ubuntu 15.10 the path of the apt sources file, which is generated by
apt-add-repository, changed to include the distid. This breaks apt::ppa
idempotency, since it does not recognize the repository is already
added.
Reported on puppet-users as well:
https://groups.google.com/forum/#!topic/puppet-users/YzeMyZYUo98
Philipp Wagner [Wed, 3 Feb 2016 16:09:40 +0000 (17:09 +0100)]
Ensure PPAs in tests have valid form
"man apt-add-repository" notes: "REPOSITORY can be either a line that
can be added directly to sources.list(5), in the form ppa:<user>/<ppa-name>
for adding Personal Package Archives".
Fix the tests to always use the format ppa:<user>/<ppa-name> when adding
PPAs.
Tim Bishop [Mon, 18 Jan 2016 21:47:32 +0000 (21:47 +0000)]
Handle PPA names that contain a plus character.
It looks like add-apt-repository changes pluses to underscores when
creating the sources.list.d file. So the name it creates doesn't match
what Puppet expects, and the resource keeps applying on every Puppet
run.
Clayton O'Neill [Wed, 11 Nov 2015 20:11:24 +0000 (20:11 +0000)]
Fix apt_key tempfile race condition
The Ruby Tempfile class has a finalizer that removes the file when the
GC runs. It's not predictible when the GC will run, so you have to
ensure that the instance of the class stays in scope for as long as you
need it.
Unfortunately the tempfile method is returning just the filename of the
temporary file, which means it goes out of scope when that method
returns. This allows the GC to reap it at any time after return.
In both CI and production environments we've seen this race fail,
causing apt-key add to fail a small (2-3%) amount of the time.
This changes the tempfile and source_to_file methods to return the
underlying Tempfile object, pushing it up into the caller's scope. Both
of the callers immediately use the object to get its filename and then
open the file, eliminating the race.
Tested this by adding 'GC.start; sleep(1)' immediately before the
command is run, to give the GC plenty of time to remove the tempfile if
it was going to.
Morgan Haskel [Wed, 26 Aug 2015 23:29:54 +0000 (16:29 -0700)]
MODULES-2446 - Fix pinning for backports
The 2.x series added a changed behavior for backport pinning to pin to
origin instead of release. Pinning to release is the correct behavior
for backports though.
* Expose the underlying notify_update setting of the apt::settings resource
This is because not all configuration file changes should trigger an apt::update notification
* apt::pin also shouldn't result in an apt-update call
Adding a pin configuration should apply to the next apt-get update call it shouldn't trigger one itself.
* Added documentation
* Add tests for apt::conf notify_update