Commit graph

55 commits

Author SHA1 Message Date
Daniel Hoherd
91092bdc80 Exposing notify_update to apt::source 2016-03-18 10:08:30 -07:00
Andreas Mauf
6698cbe94b MODULES-2889 - remove unneeded whitespace in source.list template 2015-12-14 10:20:40 +01:00
Morgan Haskel
cd37fc34f2 MODULES-2190 - Fix anchor issues 2015-07-21 10:19:15 -07:00
Morgan Haskel
396f308e6a Compatibility between 1.8.x and 2.x for apt::source 2015-06-08 11:19:45 -07:00
Hunter Haugen
48152d4a89 Don't stub puppetversion
The puppetversion fact still needs to represent puppet's version that is being used to test
2015-05-06 15:10:05 -07:00
Morgan Haskel
21a2462a58 Compatibility for puppet < 3.5.0 2015-04-27 13:48:41 -07:00
Morgan Haskel
fff702270e Update tests to work with rspec-puppet 2.x
Also enable future parser testing. Need to allow failures with future
parser for now since none of the published gems have the fix for
PUP-4379
2015-04-22 16:40:48 -07:00
Daniele Sluijters
791012b2c9 source: Support complex pin, like key does.
This adds support for passing in a full pin declaration as the pin
parameter on a source declaration.

It keeps the old behaviour intact, you can still simply do `pin => '10'`
and it will pin on origin with a priority of 10.

Should that not be what you want you can now pass in a full pin
declaration instead. We make no assumptions here, whatever you pass in
will be passed through to pin as-is with the exception of the values for
`ensure` and `before` which are always overridden by us to ensure
everything keeps working as designed.
2015-04-09 15:44:20 -07:00
Daniele Sluijters
41a2725683 apt::source: Make location mostly required.
In what universe does it make sense to create a `sources.list.d` entry
for a repository **without** specifying where this repository is?
😖

😞 😩 😧 😱

Only when removing the resource should a location not be required.
2015-03-06 17:40:45 +01:00
Daniele Sluijters
90bade9561 apt::source: Rename trusted_source.
It is weird that `trusted_source` would default to `false` as that would
imply that we normally don't trust our sources. This is opposite to the
truth, by default we trust them but only if the Releases file can be
verified (meaning it is signed by a GPG key known to apt).

What we were telling apt is that it should trust this source even if the
Releases file and the repository is unsigned. This is better captured
with `allow_unsigned` and better highlights the danger of what you're
doing, installing packages from a source we cannot authenticate.
2015-03-05 20:23:38 +01:00
Daniele Sluijters
a220dcf08c apt::source: Merge include_* options into hash.
This makes its behaviour similar to the `update`, `proxy` and `purge`
hashes on the main classes bringing its API more in line with the rest
of the module.
2015-03-05 17:37:51 +01:00
Daniele Sluijters
061bc49463 apt:🔑 Rename $key to $id to match apt_key. 2015-03-01 14:40:17 +01:00
Daniele Sluijters
ea4f615735 apt::source: Allow passing in a complex key.
Turn `$key` into something that accepts a string or a hash of four keys
representing the different options that can be passed on to `apt::key`.
2015-03-01 14:40:17 +01:00
Daniele Sluijters
0f3bdcdf5a apt(::key|_key) Remove the key.*_ prefixes.
Remove a lot of the redundant `key_` prefixes on `apt::key` and the
`keyserver_` prefix on `apt_key`.
2015-03-01 14:20:46 +01:00
Morgan Haskel
0475e50be8 Make apt::setting notify Exec['apt_update'] by default
Can be disabled by setting `notify_update => false`
2015-02-26 12:44:06 -08:00
Morgan Haskel
351c8d5941 Convert to use apt::setting instead of file resources
This adds consistency across the module
2015-02-25 10:24:56 -08:00
Morgan Haskel
1139f801eb Convert specs to RSpec 3.1.7 syntax with Transpec
This conversion is done by Transpec 3.0.8 with the following command:
    transpec spec/classes spec/defines spec/unit

* 87 conversions
    from: it { should ... }
      to: it { is_expected.to ... }

* 14 conversions
    from: obj.should
      to: expect(obj).to

* 7 conversions
    from: == expected
      to: eq(expected)

* 1 conversion
    from: it { should_not ... }
      to: it { is_expected.not_to ... }

For more details: https://github.com/yujinakayama/transpec#supported-conversions
2015-02-24 13:20:29 -08:00
Morgan Haskel
10f313cfb4 Convert apt::source to use apt::setting
May as well use the define since we added it
2015-02-21 15:26:48 -08:00
Morgan Haskel
0a178c3382 Cleanup for apt::source
* Update `release` to default to `$::lsbdistcodename`
* Default `include_src` to false
* Validate more things!
* Stop redefining variables from `apt::params`
2015-02-21 15:26:48 -08:00
Morgan Haskel
bb3a1f0af0 Remove required packages
I'm not entirely clear on the history behind this feature, and this
feels sort of hack-y. If you could explain why this is needed that would
be awesome, or if it isn't just merge this :)
2015-02-19 15:39:14 -08:00
Morgan Haskel
1534042c93 Fix broken unit tests 2015-02-18 11:43:50 -08:00
Stefan Dietrich
443db5a7c2 (MODULES-1200) Fix inconsistent header across files 2015-02-06 21:16:05 +01:00
Morgan Haskel
3d25c08ec1 Trusted will be a reserved word in Puppet 4
Rename the new `trusted` parameter to `trusted_source`.
2015-01-21 10:54:37 -08:00
Merritt Krakowitzer
4f0ebaced7 Merge branch 'master' of https://github.com/puppetlabs/puppetlabs-apt into f3792625/trusted_param 2015-01-20 21:27:52 +02:00
Merritt Krakowitzer
38582d02cd Add support for parameter trusted
* Add support for paramater trusted, valid options are 'true' and false.
defaults to false. True sets the value to trusted=yes.

trusted=yes can be set to indicate that packages from this source are
always authenticated even if the Release file is not signed or the
signature can't be checked.

* Update documentation
2015-01-13 17:41:20 +02:00
rfkrocktk
445ad0b6fe Allow full length GPG key fingerprints.
Also add support for ECC and ECDSA key_types
2015-01-10 00:45:57 -05:00
Wolf Noble
7a192d7bea - add bits for updating apt
- fix spec tests to include osfamily fact
- add spec tests to verify current default behavior unimpacted.
- manage the update-stamp file in puppet via content rather than a served file.
- update custom fact to return -1 if the file doesn't exist
- add spec test for custom fact
- refactor to use a variable vs a collector/override
- document parameters a bit more verbosely
- remove empty unconstrained fact
- Add osfamily fact to backports tests to facilitate functional tests on non-debian hosts
2014-09-24 16:29:27 -07:00
Morgan Haskel
d6bdb4d925 Cleaned up unit tests. 2014-08-04 19:44:19 -04:00
wilman0
538a9f9aab Update hold.pp
fix for default debian installations

all files in /etc/apt/preferences without _ will be silently ignore according to debian manpage. Addionally its not a good idea to write versionnumber in filename cause there is no way to delete this files if you increase versionumber

Update source_spec.rb

add a way to include debsrc only (useful for debian/ubuntu build server ... jenkins ect)

Update source_spec.rb

var rename

Update source.list.erb

add include_deb "switch"

Update source.pp

"include_deb" defaultvalue = true

Update hold_spec.rb

change the name of the preferences file (hold)

Update source_spec.rb

Update README.md

Doku: 'include_deb' included next to 'include_src' in examples

Update README.md

typo
2014-07-31 18:40:46 +02:00
juniorsysadmin
986bf8b02d Allow custom comment for sources list 2014-06-10 17:05:51 +10:00
François Conil
3fad56d266 adding notice on top of sourceslist files
Useful to figure out what is managed by puppet and what isn't when
 not setting up the option to purge sourceslist files
2014-05-19 15:24:42 +10:00
Daniele Sluijters
5790341890 apt:🔑 Redo apt::key, make it use apt_key.
Introducing a totally rewritten and tested apt::key. This commit also
patches the spec's of apt::source because it was passing in data that
is no longer allowed by the new validation rules in apt::key.

It does its best to not touch any other specs and where we touch them
only minimally to ensure that we're not introducing breaking changes.
2014-03-04 16:39:58 +01:00
Ashley Penney
4d188443bc Add lsbdistid facts where appropriate. 2014-02-24 22:31:16 +00:00
Stefan van Wouw
67e8968fe0 Fixed tests for fe594950c5
We actually expect an extra space. The previous build failed because a test is issued for location='', which indeed results in 2 spaces between the architecture specification and the release. According to the sources.list man page a location is always required though (unlike the missing/empty location in the :default_params of the source_spec test).
2013-10-23 12:29:47 +02:00
lkoranda
7dd4a14848 Fixed tests for cf04f76 2013-10-14 14:27:17 +02:00
Hunter Haugen
46d47f79d2 Merge pull request #118 from opeckojo/apt-sources-arch
Add optional architecture qualifier to apt-sources
2013-07-02 11:48:06 -07:00
Francois Deppierraz
37a0dcd0b6 Install required_packages before 'apt-get update'
This is necessary when required_packages contains GPG keys that are used for
authenticating other packages. Tested with package ubuntu-cloud-keyring which
is included in Ubuntu main and used by the Ubuntu Cloud Archive.

I think the same problem applies to other *-keyring packages as well.
2013-06-03 09:57:58 +00:00
Joe O'Pecko
b3d67c8937 Add optional architecture qualifier to apt-sources 2013-06-02 11:55:36 -07:00
Steffen Zieger
d49dbb49ae fix check of release parameter 2012-07-10 01:39:53 +02:00
Branan Purvine-Riley
7450a5ffc0 Fix the spec test for apt::source
the $location paramater is meant to be a deb location, so it should be
formatted as a URI.
2012-05-25 15:32:49 -07:00
Branan Purvine-Riley
ebd05e5c51 Fix spec tests 2012-05-25 11:23:54 -07:00
Nan Liu
f13f3cfac7 (#11966) Change apt update to apt_update.
Based on code review change exec from apt update to apt_update.
2012-05-04 13:35:25 -07:00
Nan Liu
3684f88372 (#11966) Only invoke apt-get update once.
Move apt-get update exec to a seperate class to minimize the number of
apt-get updates invoked by configuration changes.

* remove apt_update exec resource in apt class.
* remove apt-get-${name} in defines.
* apt::source notify Exec['apt update'].
* Remove dependency to Exec['apt_update'].
* fix rspec-puppet tests.

Conflicts:

	manifests/source.pp
2012-05-04 13:35:13 -07:00
Nan Liu
effb3f7ff3 (#14308) Add ensure=>absent for define resource.
Several apt::* define resource type does not support ensurable. This
update allows ensure=>absent to support the removal of these
configuration files.

* apt::conf
* apt::pin
* apt::source
2012-05-03 16:59:13 -07:00
Ken Barber
a758247f26 (#13289) Clean up style violations and fix corresponding tests 2012-03-21 13:21:11 +00:00
Reid Vandewiele
d4fec561f3 Modify apt::source release parameter test
This commit modifies the release parameter test in apt::source to work
correctly within puppet-rspec for edge-case resource definitions. Previously,
the test for the $release parameter was written as

`if ! $release { fail() }`

This commit updates the test to be written as

`if $release == undef { fail() }`

Additionally, the tests for correct behavior in the presence or absence of a
$release parameter have been beefed up.

The reason for making this change relates to examples such as the following
resource definition:

apt::source { "jenkins":
  location    => "http://pkg.jenkins-ci.org/debian",
  release     => "",
  repos       => "binary/",
  key         => "D50582E6",
  key_source  => "http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key",
  include_src => false,
}

Note that the $release parameter is given as the empty string. In practice,
this is perfectly valid and everything will work great. However, it seems that
the empty string gets interpreted by something in puppet-rspec as something
equivalent to "False", and thus when testing, the above resource definition
would fail with "Puppet::Error: lsbdistcodename fact not available: release
parameter required" even though the $release parameter has been explicitely
specified (as the empty string).

See also: https://github.com/rtyler/puppet-jenkins/issues/9
2012-03-07 10:10:46 -08:00
Ryan Coleman
76dbf992e0 Merge pull request #26 from pdxcat/ticket_12823_aptkey_defined_type
(#12823) Add apt::key defined type and modify apt::source to use it

Reviewed and tested by Ryan Coleman (ryan@puppetlabs.com)
2012-03-01 14:40:44 -08:00
Reid Vandewiele
8cdaf855a1 (#12823) Add apt::key defined type and modify apt::source to use it
Adding this defined type allows puppet to add keys to the apt keystore without
needing to add a corresponding source; it also adds the "key_source" parameter
for wget'ing keys from arbitrary URLs, and allows for keys to be explicity
removed.

apt::key allows a key to be ensured present multiple times to account for
apt::source resources that all reference the same key. However, this means
that it is possible for a given key to be defined multiple times with
differing source parameters. e.g.

apt::key { "Add key: 4BD6EC30 from Apt::Source bunny":
  key        => "4BD6EC30",
  key_server => "pgp.mit.edu",
}

apt::key { "Add key: 4BD6EC30 from Apt::Source rabbit":
  key        => "4BD6EC30",
  key_server => "keyserver.ubuntu.com",
}

The defined type will accept both definitions and will create multiple exec
resources. This was deemed preferable to the alternative (creating only one
exec resource) in that one broken definition won't hose an entire catalog. If
one definition fails to install the key because of a bad "key_server", the
next apt::key that uses the key will get it done.
2012-03-01 14:15:52 -08:00
William Van Hevelingen
7c0d10b392 (#12809) $release should use $lsbdistcodename and fall back to manual input
This commit changes $release to default to Facter's $lsbdistcodename
and fall back to a Parse Error if $release is not set and $lsbdistcodename
does not exist. Previously $release was hardcoded to karmic.

This commit also modifies apt::ppa to use $release and sets the
files to be ensured so that they are not purged when purge_sources_list_d
is set to true.
2012-03-01 11:15:02 -08:00
Ryan Coleman
fab62e6de7 Merge pull request #22 from haus/unique_required_packages
Allow duplicate required_packages between sources

Reviewed and tested by Ryan Coleman (ryan@puppetlabs.com)
2012-02-24 11:12:39 -08:00