Merge branch 'master' of https://github.com/puppetlabs/puppetlabs-apt
authorMarkelov Anton <doublic@gmail.com>
Sun, 2 Jun 2013 23:10:03 +0000 (10:10 +1100)
committerMarkelov Anton <doublic@gmail.com>
Sun, 2 Jun 2013 23:10:03 +0000 (10:10 +1100)
Conflicts:
.travis.yml
Modulefile

15 files changed:
.gemfile [deleted file]
.gitignore
.travis.yml
Gemfile [new file with mode: 0644]
Modulefile
README.md
manifests/init.pp
manifests/pin.pp
manifests/ppa.pp
spec/classes/apt_spec.rb
spec/defines/pin_spec.rb
spec/defines/ppa_spec.rb
spec/fixtures/manifests/site.pp [deleted file]
templates/pin.pref.erb
templates/source.list.erb

diff --git a/.gemfile b/.gemfile
deleted file mode 100644 (file)
index 9aad840..0000000
--- a/.gemfile
+++ /dev/null
@@ -1,5 +0,0 @@
-source :rubygems
-
-puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 2.7']
-gem 'puppet', puppetversion
-gem 'puppetlabs_spec_helper', '>= 0.1.0'
index 444fe1a3a5bbb8f4a4ea3dab5df09fc1ad36a209..b77434bea0792513cdff50c8759df47957f77965 100644 (file)
@@ -1,2 +1,4 @@
 *.swp
 pkg/
+Gemfile.lock
+spec/fixtures/manifests
index 6db520f6b0294302d053e29ce0bf36d3be4c1575..c825f5e4ed3da0d6556bfb48fc993923eab5b7d8 100644 (file)
@@ -1,17 +1,36 @@
 language: ruby
+bundler_args: --without development
+script: "bundle exec rake spec SPEC_OPTS='--format documentation'"
 rvm:
   - 1.8.7
-before_script:
-after_script:
-script: "rake spec"
-branches:
-  only:
-    - master
+  - 1.9.3
+  - ruby-head
 env:
+<<<<<<< HEAD
   - PUPPET_VERSION=3.0.1
   - PUPPET_VERSION=2.7.13
   - PUPPET_VERSION=2.7.6
   - PUPPET_VERSION=2.6.9
+=======
+  - 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
+      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"
+>>>>>>> 18ee4cc6c9eb8d16becfec68254d8955eb10c7d5
 notifications:
   email: false
-gemfile: .gemfile
diff --git a/Gemfile b/Gemfile
new file mode 100644 (file)
index 0000000..8e5e04d
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,13 @@
+source :rubygems
+
+group :development, :test do
+  gem 'puppetlabs_spec_helper', :require => false
+end
+
+if puppetversion = ENV['PUPPET_GEM_VERSION']
+  gem 'puppet', puppetversion, :require => false
+else
+  gem 'puppet', :require => false
+end
+
+# vim:ft=ruby
index 24dd985288ce9a5aaf9818d7b7776a2c194676fc..dbf3f2e209bc0234a190a27c328569003e94e88b 100644 (file)
@@ -1,5 +1,5 @@
 name    'puppetlabs-apt'
-version '0.0.4'
+version '1.1.0'
 source  'https://github.com/puppetlabs/puppetlabs-apt'
 author  'Evolving Web / Puppet Labs'
 license 'Apache License 2.0'
@@ -8,4 +8,11 @@ description 'APT Module for Puppet'
 project_page 'https://github.com/puppetlabs/puppetlabs-apt'
 
 ## Add dependencies, if any:
+<<<<<<< HEAD
 dependency 'puppetlabs/stdlib', '>= 3.0.1'
+=======
+#dependency 'puppetlabs/stdlib', '2.x'
+# The dependency should be written as above but librarian-puppet
+# does not support the expression as the PMT does.
+dependency 'puppetlabs/stdlib', '>= 2.2.1'
+>>>>>>> 18ee4cc6c9eb8d16becfec68254d8955eb10c7d5
index 72a130c5e76cfc2b00a081184a7e90b82ab2e650..5082e343376ca01fb5551e91fd12b3631682d9dd 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,15 +1,51 @@
-# Apt module for Puppet
+apt
+===
+
+[![Build Status](https://travis-ci.org/puppetlabs/puppetlabs-apt.png?branch=master)](https://travis-ci.org/puppetlabs/puppetlabs-apt)
 
 ## Description
 Provides helpful definitions for dealing with Apt.
+=======
+Overview
+--------
+
+The APT module provides a simple interface for managing APT source, key, and definitions with Puppet. 
+
+Module Description
+------------------
+
+APT automates obtaining and installing software packages on *nix systems. 
+
+Setup
+-----
+
+**What APT affects:**
+
+* package/service/configuration files for APT 
+* your system's `sources.list` file and `sources.list.d` directory
+    * NOTE: Setting the `purge_sources_list` and `purge_sources_list_d` parameters to 'true' will destroy any existing content that was not declared with Puppet. The default for these parameters is 'false'.
+* system repositories
+* authentication keys
+* wget (optional)
+
+###Beginning with APT
 
-## Usage
+To begin using the APT module with default parameters, declare the class
 
-### apt
-The apt class provides a number of common resources and options which
-are shared by the various defined types in this module. This class
-should always be included in your manifests if you are using the `apt`
-module.
+    class { 'apt': }
+Puppet code that uses anything from the APT module requires that the core apt class be declared. 
+
+Usage
+-----
+
+Using the APT module consists predominantly in declaring classes that provide desired functionality and features. 
+###apt
+
+`apt` provides a number of common resources and options that are shared by the various defined types in this module, so you MUST always include this class in your manifests.
+
+The parameters for `apt` are not required in general and are predominantly for development environment use-cases.
 
     class { 'apt':
       always_apt_update    => false,
@@ -21,55 +57,80 @@ module.
       purge_preferences_d  => false
     }
 
-### apt::builddep
-Install the build depends of a specified package.
+Puppet will manage your system's `sources.list` file and `sources.list.d` directory but will do its best to respect existing content. 
+
+If you declare your apt class with `purge_sources_list` and `purge_sources_list_d` set to 'true', Puppet will unapologetically purge any existing content it finds that wasn't declared with Puppet. 
+
+###apt::builddep
+
+Installs the build depends of a specified package.
 
-    apt::builddep { "glusterfs-server": }
+    apt::builddep { 'glusterfs-server': }
 
-### apt::force
-Force a package to be installed from a specific release.  Useful when
-using repositories like Debian unstable in Ubuntu.
+###apt::force
 
-    apt::force { "glusterfs-server":
-         release => "unstable",
+Forces a package to be installed from a specific release.  This class is particularly useful when using repositories, like Debian, that are unstable in Ubuntu.
+
+    apt::force { 'glusterfs-server':
+         release => 'unstable',
          version => '3.0.3',
-         require => Apt::Source["debian_unstable"],
+         require => Apt::Source['debian_unstable'],
+    }
+
+###apt::key
+
+Adds a key to the list of keys used by APT to authenticate packages.
+
+    apt::key { 'puppetlabs':
+      key        => '4BD6EC30',
+      key_server => 'pgp.mit.edu',
     }
 
-### apt::pin
-Add an apt pin for a certain release.
+    apt::key { 'jenkins':
+      key        => 'D50582E6',
+      key_source => 'http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key',
+    }
+
+Note that use of `key_source` requires wget to be installed and working.
+
+###apt::pin
+
+Adds an apt pin for a certain release.
 
-    apt::pin { "karmic": priority => 700 }
-    apt::pin { "karmic-updates": priority => 700 }
-    apt::pin { "karmic-security": priority => 700 }
+    apt::pin { 'karmic': priority => 700 }
+    apt::pin { 'karmic-updates': priority => 700 }
+    apt::pin { 'karmic-security': priority => 700 }
 
-### apt::ppa
-Add a ppa repository using `add-apt-repository`.  Somewhat experimental.
+###apt::ppa
 
-    apt::ppa { "ppa:drizzle-developers/ppa": }
+Adds a ppa repository using `add-apt-repository`.
 
-### apt::release
-Set the default apt release.  Useful when using repositories like
-Debian unstable in Ubuntu.
+    apt::ppa { 'ppa:drizzle-developers/ppa': }
 
-    apt::release { "karmic": }
+###apt::release
+
+Sets the default apt release. This class is particularly useful when using repositories, like Debian, that are unstable in Ubuntu.
+
+    class { 'apt::release':
+      release_id => 'precise',
+    }
 
-### apt::source
-Add an apt source to `/etc/apt/sources.list.d/`.
+###apt::source
 
-    apt::source { "debian_unstable":
-      location          => "http://debian.mirror.iweb.ca/debian/",
-      release           => "unstable",
-      repos             => "main contrib non-free",
-      required_packages => "debian-keyring debian-archive-keyring",
-      key               => "55BE302B",
-      key_server        => "subkeys.pgp.net",
-      pin               => "-10",
+Adds an apt source to `/etc/apt/sources.list.d/`.
+
+    apt::source { 'debian_unstable':
+      location          => 'http://debian.mirror.iweb.ca/debian/',
+      release           => 'unstable',
+      repos             => 'main contrib non-free',
+      required_packages => 'debian-keyring debian-archive-keyring',
+      key               => '55BE302B',
+      key_server        => 'subkeys.pgp.net',
+      pin               => '-10',
       include_src       => true
     }
 
-This source will configure your system for the Puppet Labs APT
-repository.
+If you would like to configure your system so the source is the Puppet Labs APT repository
 
     apt::source { 'puppetlabs':
       location   => 'http://apt.puppetlabs.com',
@@ -78,42 +139,84 @@ repository.
       key_server => 'pgp.mit.edu',
     }
 
-### apt::key
-Add a key to the list of keys used by apt to authenticate packages.
+###Testing
 
-    apt::key { "puppetlabs":
-      key        => "4BD6EC30",
-      key_server => "pgp.mit.edu",
-    }
+The APT module is mostly a collection of defined resource types, which provide reusable logic that can be leveraged to manage APT. It does provide smoke tests for testing functionality on a target system, as well as spec tests for checking a compiled catalog against an expected set of resources.
+
+####Example Test
+
+This test will set up a Puppet Labs apt repository. Start by creating a new smoke test in the apt module's test folder. Call it puppetlabs-apt.pp. Inside, declare a single resource representing the Puppet Labs APT source and gpg key
 
-    apt::key { "jenkins":
-      key        => "D50582E6",
-      key_source => "http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key",
+    apt::source { 'puppetlabs':
+      location   => 'http://apt.puppetlabs.com',
+      repos      => 'main',
+      key        => '4BD6EC30',
+      key_server => 'pgp.mit.edu',
     }
+    
+This resource creates an apt source named puppetlabs and gives Puppet information about the repository's location and key used to sign its packages. Puppet leverages Facter to determine the appropriate release, but you can set it directly by adding the release type.
+
+Check your smoke test for syntax errors
+
+    $ puppet parser validate tests/puppetlabs-apt.pp
+
+If you receive no output from that command, it means nothing is wrong. Then apply the code
+
+    $ puppet apply --verbose tests/puppetlabs-apt.pp
+    notice: /Stage[main]//Apt::Source[puppetlabs]/File[puppetlabs.list]/ensure: defined content as '{md5}3be1da4923fb910f1102a233b77e982e'
+    info: /Stage[main]//Apt::Source[puppetlabs]/File[puppetlabs.list]: Scheduling refresh of Exec[puppetlabs apt update]
+    notice: /Stage[main]//Apt::Source[puppetlabs]/Exec[puppetlabs apt update]: Triggered 'refresh' from 1 events>
+
+The above example used a smoke test to easily lay out a resource declaration and apply it on your system. In production, you may want to declare your APT sources inside the classes where they’re needed. 
+
+Implementation
+--------------
+
+###apt::backports
+
+Adds the necessary components to get backports for Ubuntu and Debian. The release name defaults to `$lsbdistcodename`. Setting this manually can cause undefined behavior (read: universe exploding).
+
+Limitations
+-----------
+
+This module should work across all versions of Debian/Ubuntu and support all major APT repository management features. 
+
+Development
+------------
+
+Puppet Labs modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. We can’t access the huge number of platforms and myriad of hardware, software, and deployment configurations that Puppet is intended to serve.
+
+We want to keep it as easy as possible to contribute changes so that our modules work in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things.
+
+You can read the complete module contribution guide [on the Puppet Labs wiki.](http://projects.puppetlabs.com/projects/module-site/wiki/Module_contributing)
+
+Contributors
+------------
+
+A lot of great people have contributed to this module. A somewhat current list follows:
+
+* Ben Godfrey <ben.godfrey@wonga.com>
+* Branan Purvine-Riley <branan@puppetlabs.com>
+* Christian G. Warden <cwarden@xerus.org>  
+* Dan Bode <bodepd@gmail.com> <dan@puppetlabs.com>  
+* Garrett Honeycutt <github@garretthoneycutt.com>  
+* Jeff Wallace <jeff@evolvingweb.ca> <jeff@tjwallace.ca>  
+* Ken Barber <ken@bob.sh>  
+* Matthaus Litteken <matthaus@puppetlabs.com> <mlitteken@gmail.com>  
+* Matthias Pigulla <mp@webfactory.de>  
+* Monty Taylor <mordred@inaugust.com>  
+* Peter Drake <pdrake@allplayers.com>  
+* Reid Vandewiele <marut@cat.pdx.edu>  
+* Robert Navarro <rnavarro@phiivo.com>  
+* Ryan Coleman <ryan@puppetlabs.com>  
+* Scott McLeod <scott.mcleod@theice.com>  
+* 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**
 
-Note that use of the "key_source" parameter requires wget to be
-installed and working.
-
-
-## Contributors
-A lot of great people have contributed to this module. A somewhat
-current list follows.
-
-Ben Godfrey <ben.godfrey@wonga.com>
-Branan Purvine-Riley <branan@puppetlabs.com>
-Christian G. Warden <cwarden@xerus.org>  
-Dan Bode <bodepd@gmail.com> <dan@puppetlabs.com>  
-Garrett Honeycutt <github@garretthoneycutt.com>  
-Jeff Wallace <jeff@evolvingweb.ca> <jeff@tjwallace.ca>  
-Ken Barber <ken@bob.sh>  
-Matthaus Litteken <matthaus@puppetlabs.com> <mlitteken@gmail.com>  
-Matthias Pigulla <mp@webfactory.de>  
-Monty Taylor <mordred@inaugust.com>  
-Peter Drake <pdrake@allplayers.com>  
-Reid Vandewiele <marut@cat.pdx.edu>  
-Robert Navarro <rnavarro@phiivo.com>  
-Ryan Coleman <ryan@puppetlabs.com>  
-Scott McLeod <scott.mcleod@theice.com>  
-Spencer Krum <spencer@puppetlabs.com>  
-William Van Hevelingen <blkperl@cat.pdx.edu> <wvan13@gmail.com>  
-Zach Leslie <zach@puppetlabs.com>  
+This release includes Ubuntu 12.10 (Quantal) support for PPAs.
index 442e04c5875262ec0c3564863527f47341db3d5e..23197719500809e6b4d1e5c4b4aa5ad87fdf7feb 100644 (file)
@@ -7,11 +7,11 @@
 #     added for use cases related to development environments.
 #   disable_keys - disables the requirement for all packages to be signed
 #   always_apt_update - rather apt should be updated on every run (intended
-#     for development environments where package updates are frequent
+#     for development environments where package updates are frequent)
 #   purge_sources_list - Accepts true or false. Defaults to false If set to
-#     true, Puppet will purge all unmanaged entries from sources.list"
+#     true, Puppet will purge all unmanaged entries from sources.list
 #   purge_sources_list_d - Accepts true or false. Defaults to false. If set
-#     to false, Puppet will purge all unmanaged entries from sources.list.d
+#     to true, Puppet will purge all unmanaged entries from sources.list.d
 #
 # Actions:
 #
@@ -99,12 +99,16 @@ class apt(
     default: { fail('Valid values for disable_keys are true or false') }
   }
 
-  if ($proxy_host) {
-    file { 'configure-apt-proxy':
-      path    => "${apt_conf_d}/proxy",
-      content => "Acquire::http::Proxy \"http://${proxy_host}:${proxy_port}\";",
-      notify  => Exec['apt_update'],
-    }
+  $proxy_set = $proxy_host ? {
+    false   => absent,
+    default => present
+  }
+
+  file { 'configure-apt-proxy':
+    path    => "${apt_conf_d}/proxy",
+    content => "Acquire::http::Proxy \"http://${proxy_host}:${proxy_port}\";",
+    notify  => Exec['apt_update'],
+    ensure  => $proxy_set,
   }
 
   # Need anchor to provide containment for dependencies.
index cebc6e7b0da2c390092324ad7c32c5e236dab641..21cc3ffdefc0294c0c91c37de474971b94b26869 100644 (file)
@@ -3,6 +3,7 @@
 
 define apt::pin(
   $ensure     = present,
+  $explanation = "${::caller_module_name}: ${name}",
   $order      = '',
   $packages   = '*',
   $priority   = 0,
index 0458589849e30ec90dcc8f7a7d6f0d73ef6f3c32..725170d2dc39dfb9c8b51841b795a8d467cb480c 100644 (file)
@@ -17,8 +17,13 @@ define apt::ppa(
   $filename_without_ppa     = regsubst($filename_without_dots, '^ppa:', '', G)
   $sources_list_d_filename  = "${filename_without_ppa}-${release}.list"
 
-  if ! defined(Package['python-software-properties']) {
-    package { 'python-software-properties': }
+  $package = $::lsbdistrelease ? {
+    /^[1-9]\..*|1[01]\..*|12.04$/ => 'python-software-properties',
+    default  => 'software-properties-common',
+  }
+
+  if ! defined(Package[$package]) {
+    package { $package: }
   }
 
   exec { "add-apt-repository-${name}":
@@ -27,7 +32,7 @@ define apt::ppa(
     logoutput => 'on_failure',
     require   => [
       File[$sources_list_d],
-      Package['python-software-properties'],
+      Package["${package}"],
     ],
     notify    => Exec['apt_update'],
   }
@@ -42,4 +47,3 @@ define apt::ppa(
     require => Class['apt::update'],
   }
 }
-
index d623a5bf7824f8c2d32ec0cc6322b9a23f83549f..a66feac78810ce3175580a2dd5ee4b7298fcd2ea 100644 (file)
@@ -120,7 +120,11 @@ describe 'apt', :type => :class do
               'notify'  => "Exec[apt_update]"
             )
           else
-            should_not contain_file('configure_apt_proxy')
+            should contain_file('configure-apt-proxy').with(
+              'path'    => '/etc/apt/apt.conf.d/proxy',
+              'notify'  => 'Exec[apt_update]',
+              'ensure'  => 'absent'
+            )
           end
         }
       end
index cd269d3b8bb11b3deff3831df99be63b5d877da8..3aaf49cef494e79f3b4fce0c2e2e02ba91d7915d 100644 (file)
@@ -50,7 +50,7 @@ describe 'apt::pin', :type => :define do
           'owner'   => 'root',
           'group'   => 'root',
           'mode'    => '0644',
-          'content' => "# #{title}\nPackage: #{param_hash[:packages]}\nPin: release a=#{param_hash[:release] || title}\nPin-Priority: #{param_hash[:priority]}\n",
+          'content' => "# #{title}\nExplanation: : #{title}\nPackage: #{param_hash[:packages]}\nPin: release a=#{param_hash[:release] || title}\nPin-Priority: #{param_hash[:priority]}\n",
         })
       }
     end
index d57c1fb854b98d328a2daa87a3dd96a0a670e6b5..6be9ab91426d5247dbf1544c03e828e7e64ce779 100644 (file)
@@ -1,58 +1,82 @@
 require 'spec_helper'
 describe 'apt::ppa', :type => :define do
-  ['ppa:dans_ppa', 'dans_ppa','ppa:dans-daily/ubuntu'].each do |t|
-    describe "with title #{t}" do
-      let :pre_condition do
-        'class { "apt": }'
-      end
+  [ { :lsbdistrelease => '11.04',
+      :lsbdistcodename => 'natty',
+      :package => 'python-software-properties'},
+    { :lsbdistrelease => '12.10',
+      :lsbdistcodename => 'quantal',
+      :package => 'software-properties-common'},
+  ].each do |platform|
+    context "on #{platform[:lsbdistcodename]}" do
       let :facts do
-        {:lsbdistcodename => 'natty'}
-      end
-      let :title do
-        t
+        {
+          :lsbdistrelease => platform[:lsbdistrelease],
+          :lsbdistcodename => platform[:lsbdistcodename],
+        }
       end
       let :release do
-        "natty"
+        "#{platform[:lsbdistcodename]}"
       end
-      let :filename do
-        t.sub(/^ppa:/,'').gsub('/','-') << "-" << "#{release}.list"
+      let :package do
+        "#{platform[:package]}"
       end
+      ['ppa:dans_ppa', 'dans_ppa','ppa:dans-daily/ubuntu'].each do |t|
+        describe "with title #{t}" do
+          let :pre_condition do
+            'class { "apt": }'
+          end
+          let :title do
+            t
+          end
+          let :filename do
+            t.sub(/^ppa:/,'').gsub('/','-') << "-" << "#{release}.list"
+          end
 
-      it { should contain_package("python-software-properties") }
+          it { should contain_package("#{package}") }
 
-      it { should contain_exec("apt_update").with(
-        'command'     => '/usr/bin/apt-get update',
-        'refreshonly' => true
-        )
-      }
+          it { should contain_exec("apt_update").with(
+            'command'     => '/usr/bin/apt-get update',
+            'refreshonly' => true
+            )
+          }
 
-      it { should contain_exec("add-apt-repository-#{t}").with(
-        'command' => "/usr/bin/add-apt-repository #{t}",
-        'creates' => "/etc/apt/sources.list.d/#{filename}",
-        'require' => ["File[/etc/apt/sources.list.d]", "Package[python-software-properties]"],
-        'notify'  => "Exec[apt_update]"
-        )
-      }
+          it { should contain_exec("add-apt-repository-#{t}").with(
+            'command' => "/usr/bin/add-apt-repository #{t}",
+            'creates' => "/etc/apt/sources.list.d/#{filename}",
+            'require' => ["File[/etc/apt/sources.list.d]", "Package[#{package}]"],
+            'notify'  => "Exec[apt_update]"
+            )
+          }
 
-      it { should create_file("/etc/apt/sources.list.d/#{filename}").with(
-        'ensure'  => 'file',
-        'require' => "Exec[add-apt-repository-#{t}]"
-        )
-      }
+          it { should create_file("/etc/apt/sources.list.d/#{filename}").with(
+            'ensure'  => 'file',
+            'require' => "Exec[add-apt-repository-#{t}]"
+            )
+          }
+        end
+      end
     end
   end
 
-  describe "it should not error if package['python-software-properties'] is already defined" do
-    let :pre_condition do
-       'class {"apt": }' +
-       'package { "python-software-properties": }->Apt::Ppa["ppa"]'
-    end
-    let :facts do
-      {:lsbdistcodename => 'natty'}
+  [ { :lsbdistcodename => 'natty', 
+      :package => 'python-software-properties' },
+    { :lsbdistcodename => 'quantal',
+      :package => 'software-properties-common'},
+  ].each do |platform|
+    context "on #{platform[:lsbdistcodename]}" do
+      describe "it should not error if package['#{platform[:package]}'] is already defined" do
+        let :pre_condition do
+           'class {"apt": }' +
+           'package { "#{platform[:package]}": }->Apt::Ppa["ppa"]'
+        end
+        let :facts do
+          {:lsbdistcodename => '#{platform[:lsbdistcodename]}'}
+        end
+        let(:title) { "ppa" }
+        let(:release) { "#{platform[:lsbdistcodename]}" }
+        it { should contain_package('#{platform[:package]}') }
+      end
     end
-    let(:title) { "ppa" }
-    let(:release) { "natty" }
-    it { should contain_package("python-software-properties") }
   end
 
   describe "without Class[apt] should raise a Puppet::Error" do
diff --git a/spec/fixtures/manifests/site.pp b/spec/fixtures/manifests/site.pp
deleted file mode 100644 (file)
index e69de29..0000000
index 9a1e690ee66b49254e14f63aa265396460ec6d53..74df8b79c45b54b36400e7d942da2f67df6c9e4d 100644 (file)
@@ -1,4 +1,5 @@
-# <%= name %>
-Package: <%= packages %>
-Pin: <%= pin %>
-Pin-Priority: <%= priority %>
+# <%= @name %>
+Explanation: <%= @explanation %>
+Package: <%= @packages %>
+Pin: <%= @pin %>
+Pin-Priority: <%= @priority %>
index faa7e286ece80cfafd89db734010328030b03c24..65764b2612cac71780f8cbef50cb2b2d9faaf9d6 100644 (file)
@@ -1,5 +1,5 @@
-# <%= name %>
-deb <%= location %> <%= release_real %> <%= repos %>
-<%- if include_src then -%>
-deb-src <%= location %> <%= release_real %> <%= repos %>
+# <%= @name %>
+deb <%= @location %> <%= @release_real %> <%= @repos %>
+<%- if @include_src then -%>
+deb-src <%= @location %> <%= @release_real %> <%= @repos %>
 <%- end -%>