rvm:
- 1.8.7
- 1.9.3
- - ruby-head
+ - 2.0.0
env:
- - PUPPET_GEM_VERSION="~> 2.6.0"
- PUPPET_GEM_VERSION="~> 2.7.0"
- PUPPET_GEM_VERSION="~> 3.0.0"
- PUPPET_GEM_VERSION="~> 3.1.0"
- PUPPET_GEM_VERSION="~> 3.2.0"
matrix:
exclude:
- - rvm: ruby-head
- env: PUPPET_GEM_VERSION="~> 3.0.0"
- - rvm: ruby-head
- env: PUPPET_GEM_VERSION="~> 3.1.0"
- rvm: 1.9.3
env: PUPPET_GEM_VERSION="~> 2.7.0"
- - rvm: ruby-head
+ - rvm: 2.0.0
env: PUPPET_GEM_VERSION="~> 2.7.0"
- - rvm: 1.9.3
- env: PUPPET_GEM_VERSION="~> 2.6.0"
- - rvm: ruby-head
- env: PUPPET_GEM_VERSION="~> 2.6.0"
+ - rvm: 2.0.0
+ env: PUPPET_GEM_VERSION="~> 3.0.0"
+ - rvm: 2.0.0
+ env: PUPPET_GEM_VERSION="~> 3.1.0"
+ - rvm: 1.8.7
+ env: PUPPET_GEM_VERSION="~> 3.2.0"
notifications:
email: false
+## puppetlabs-apt changelog
+
+Release notes for the puppetlabs-apt module.
+
+1.1.1
+=====
+
+This is a bug fix release that resolves a number of issues:
+
+* By changing template variable usage, we remove the deprecation warnings
+ for Puppet 3.2.x
+* Fixed proxy file removal, when proxy absent
+
+Some documentation, style and whitespaces changes were also merged. This
+release also introduced proper rspec-puppet unit testing on Travis-CI to help
+reduce regression.
+
+Thanks to all the community contributors below that made this patch possible.
+
+#### Detail Changes
+
+* fix minor comment type (Chris Rutter)
+* whitespace fixes (Michael Moll)
+* Update travis config file (William Van Hevelingen)
+* Build all branches on travis (William Van Hevelingen)
+* Standardize travis.yml on pattern introduced in stdlib (William Van Hevelingen)
+* Updated content to conform to README best practices template (Lauren Rother)
+* Fix apt::release example in readme (Brian Galey)
+* add @ to variables in template (Peter Hoeg)
+* Remove deprecation warnings for pin.pref.erb as well (Ken Barber)
+* Update travis.yml to latest versions of puppet (Ken Barber)
+* Fix proxy file removal (Scott Barber)
+* Add spec test for removing proxy configuration (Dean Reilly)
+* Fix apt::key listing longer than 8 chars (Benjamin Knofe)
+
+
+---------------------------------------
+
+1.1.0
+=====
+
+This release includes Ubuntu 12.10 (Quantal) support for PPAs.
+
+---------------------------------------
+
2012-05-25 Puppet Labs <info@puppetlabs.com> - 0.0.4
* Fix ppa list filename when there is a period in the PPA name
* Add .pref extension to apt preferences files
-source :rubygems
+source 'https://rubygems.org'
group :development, :test do
+ gem 'rake', :require => false
+ gem 'rspec-puppet', :require => false
gem 'puppetlabs_spec_helper', :require => false
end
name 'puppetlabs-apt'
-version '1.1.0'
+version '1.1.1'
source 'https://github.com/puppetlabs/puppetlabs-apt'
author 'Evolving Web / Puppet Labs'
license 'Apache License 2.0'
apt::pin { 'karmic-updates': priority => 700 }
apt::pin { 'karmic-security': priority => 700 }
+Note you can also specifying more complex pins using distribution properties.
+
+ apt::pin { 'stable':
+ priority => -10,
+ originator => 'Debian',
+ release_version => '3.0',
+ component => 'main',
+ label => 'Debian'
+ }
+
###apt::ppa
Adds a ppa repository using `add-apt-repository`.
* Spencer Krum <spencer@puppetlabs.com>
* William Van Hevelingen <blkperl@cat.pdx.edu> <wvan13@gmail.com>
* Zach Leslie <zach@puppetlabs.com>
-
-Release Notes
--------------
-
-**1.1.0**
-
-This release includes Ubuntu 12.10 (Quantal) support for PPAs.
include apt::params
$upkey = upcase($key)
+ # trim the key to the last 8 chars so we can match longer keys with apt-key list too
+ $trimmedkey = regsubst($upkey, '^.*(.{8})$', '\1')
if $key_content {
$method = 'content'
exec { $digest:
command => $digest_command,
path => '/bin:/usr/bin',
- unless => "/usr/bin/apt-key list | /bin/grep '${upkey}'",
+ unless => "/usr/bin/apt-key list | /bin/grep '${trimmedkey}'",
logoutput => 'on_failure',
before => Anchor["apt::key ${upkey} present"],
}
exec { "apt::key ${upkey} absent":
command => "apt-key del '${upkey}'",
path => '/bin:/usr/bin',
- onlyif => "apt-key list | grep '${upkey}'",
+ onlyif => "apt-key list | grep '${trimmedkey}'",
user => 'root',
group => 'root',
logoutput => 'on_failure',
# pin a release in apt, useful for unstable repositories
define apt::pin(
- $ensure = present,
- $explanation = "${::caller_module_name}: ${name}",
- $order = '',
- $packages = '*',
- $priority = 0,
- $release = '',
- $origin = '',
- $originator = '',
- $version = ''
+ $ensure = present,
+ $explanation = "${::caller_module_name}: ${name}",
+ $order = '',
+ $packages = '*',
+ $priority = 0,
+ $release = '', # a=
+ $origin = '',
+ $version = '',
+ $codename = '', # n=
+ $release_version = '', # v=
+ $component = '', # c=
+ $originator = '', # o=
+ $label = '' # l=
) {
include apt::params
fail('Only integers are allowed in the apt::pin order param')
}
- if $release != '' {
- $pin = "release a=${release}"
- } elsif $origin != '' {
- $pin = "origin \"${origin}\""
- } elsif $originator != '' {
- $pin = "release o=${originator}"
- } elsif $version != '' {
- $pin = "version ${version}"
- } else {
- $pin = "release a=${name}"
+ $pin_release_array = [
+ $release,
+ $codename,
+ $release_version,
+ $component,
+ $originator,
+ $label]
+ $pin_release = join($pin_release_array, '')
+
+ # Read the manpage 'apt_preferences(5)', especially the chapter
+ # 'Thea Effect of APT Preferences' to understand the following logic
+ # and the difference between specific and general form
+ if $packages != '*' { # specific form
+
+ if ( $pin_release != '' and ( $origin != '' or $version != '' )) or
+ ( $origin != '' and ( $pin_release != '' or $version != '' )) or
+ ( $version != '' and ( $pin_release != '' or $origin != '' )) {
+ fail('parameters release, origin, and version are mutually exclusive')
+ }
+
+ } else { # general form
+
+ if $version != '' {
+ fail('parameter version cannot be used in general form')
+ }
+
+ if ( $pin_release != '' and $origin != '' ) or
+ ( $origin != '' and $pin_release != '' ) {
+ fail('parmeters release and origin are mutually exclusive')
+ }
+
}
$path = $order ? {
}
end
- [ {},
+ [
+ { :params => {},
+ :content => "# my_pin\nExplanation: : my_pin\nPackage: *\nPin: release a=my_pin\nPin-Priority: 0\n"
+ },
{
- :packages => 'apache',
- :priority => '1'
+ :params => {
+ :packages => 'apache',
+ :priority => '1'
+ },
+ :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=my_pin\nPin-Priority: 1\n"
},
{
- :order => 50,
- :packages => 'apache',
- :priority => '1'
+ :params => {
+ :order => 50,
+ :packages => 'apache',
+ :priority => '1'
+ },
+ :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=my_pin\nPin-Priority: 1\n"
},
{
- :ensure => 'absent',
- :packages => 'apache',
- :priority => '1'
+ :params => {
+ :ensure => 'absent',
+ :packages => 'apache',
+ :priority => '1'
+ },
+ :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=my_pin\nPin-Priority: 1\n"
},
{
- :packages => 'apache',
- :priority => '1',
- :release => 'my_newpin'
- }
+ :params => {
+ :packages => 'apache',
+ :priority => '1',
+ :release => 'my_newpin'
+ },
+ :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=my_newpin\nPin-Priority: 1\n"
+ },
+ {
+ :params => {
+ :packages => 'apache',
+ :priority => '1',
+ :version => '2.2.16*'
+ },
+ :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: version 2.2.16*\nPin-Priority: 1\n"
+ },
+ {
+ :params => {
+ :priority => '1',
+ :origin => 'ftp.de.debian.org'
+ },
+ :content => "# my_pin\nExplanation: : my_pin\nPackage: *\nPin: origin \"ftp.de.debian.org\"\nPin-Priority: 1\n"
+ },
+ {
+ :params => {
+ :packages => 'apache',
+ :priority => '1',
+ :release => 'stable',
+ :codename => 'wheezy',
+ :release_version => '3.0',
+ :component => 'main',
+ :originator => 'Debian',
+ :label => 'Debian'
+ },
+ :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=stable, n=wheezy, v=3.0, c=main, o=Debian, l=Debian\nPin-Priority: 1\n"
+ },
].each do |param_set|
describe "when #{param_set == {} ? "using default" : "specifying"} define parameters" do
let :param_hash do
- default_params.merge(param_set)
+ default_params.merge(param_set[:params])
end
let :params do
- param_set
+ param_set[:params]
end
it { should include_class("apt::params") }
'owner' => 'root',
'group' => 'root',
'mode' => '0644',
- 'content' => "# #{title}\nExplanation: : #{title}\nPackage: #{param_hash[:packages]}\nPin: release a=#{param_hash[:release] || title}\nPin-Priority: #{param_hash[:priority]}\n",
+ 'content' => param_set[:content],
})
}
end
+<%-
+@pin = "release a=#{@name}" # default value
+if @pin_release.length > 0
+ options = []
+ options.push("a=#{@release}") if @release.length > 0
+ options.push("n=#{@codename}") if @codename.length > 0
+ options.push("v=#{@release_version}") if @release_version.length > 0
+ options.push("c=#{@component}") if @component.length > 0
+ options.push("o=#{@originator}") if @originator.length > 0
+ options.push("l=#{@label}") if @label.length > 0
+ @pin = "release #{options.join(', ')}"
+elsif @version.length > 0
+ @pin = "version #{@version}"
+elsif @origin.length > 0
+ @pin = "origin \"#{@origin}\""
+end
+-%>
# <%= @name %>
Explanation: <%= @explanation %>
Package: <%= @packages %>