puppetlabs-apt-1.4.0/0040755 0000000 0000000 00000000000 12227302011 014426 5ustar00travis0000000 0000000 puppetlabs-apt-1.4.0/Modulefile0100644 0000000 0000000 00000001007 12227301662 016444 0ustar00travis0000000 0000000 name 'puppetlabs-apt' version '1.4.0' source 'https://github.com/puppetlabs/puppetlabs-apt' author 'Evolving Web / Puppet Labs' license 'Apache License 2.0' summary 'Puppet Labs Apt Module' description 'APT Module for Puppet' project_page 'https://github.com/puppetlabs/puppetlabs-apt' ## Add dependencies, if any: #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' puppetlabs-apt-1.4.0/.forge-release/0040755 0000000 0000000 00000000000 12227302011 017224 5ustar00travis0000000 0000000 puppetlabs-apt-1.4.0/.forge-release/validate0100644 0000000 0000000 00000000214 12227301757 020752 0ustar00travis0000000 0000000 #!/bin/sh # # Perform GitHub publish MODULES_ROOT=`pwd` cd $(dirname $0) mvn -q -s settings.xml -Dforge.modules.root="$MODULES_ROOT" compilepuppetlabs-apt-1.4.0/.forge-release/settings.xml0100644 0000000 0000000 00000001455 12227301757 021630 0ustar00travis0000000 0000000 cloudsmith cloudsmith https://am0.cloudsmith.com/nexus/content/repositories/releases/ true false cloudsmith https://am0.cloudsmith.com/nexus/content/repositories/releases/ true false cloudsmith puppetlabs-apt-1.4.0/.forge-release/publish0100644 0000000 0000000 00000000543 12227301757 020634 0ustar00travis0000000 0000000 #!/bin/sh # # Perform GitHub publish if [ -z "$PUBLISHER_LOGIN" ] then echo "Environment variable PUBLISHER_LOGIN must be set" exit 1 fi if [ -z "$PUBLISHER_PASSWORD" ] then echo "Environment variable PUBLISHER_PASSWORD must be set" exit 1 fi MODULES_ROOT=`pwd` cd $(dirname $0) mvn -q -s settings.xml -Dforge.modules.root="$MODULES_ROOT" deploypuppetlabs-apt-1.4.0/.forge-release/pom.xml0100644 0000000 0000000 00000001706 12227301757 020562 0ustar00travis0000000 0000000 4.0.0 puppetlabs ghpublisher 1.0.0 puppet-module ghpublisher ${env.PUBLISHER_LOGIN} ${env.PUBLISHER_PASSWORD} org.cloudsmith.geppetto forge-maven-plugin 3.2.0 true false ${project.build.directory}/forgeCache puppetlabs-apt-1.4.0/CHANGELOG0100644 0000000 0000000 00000015536 12227301662 015662 0ustar00travis0000000 0000000 2013-10-08 1.4.0 Summary: Minor bugfix and allow the timeout to be adjusted. Features: - Add an `updates_timeout` to apt::params Fixes: - Ensure apt::ppa can readd a ppa removed by hand. Summary 1.3.0 ===== Summary: This major feature in this release is the new apt::unattended_upgrades class, allowing you to handle Ubuntu's unattended feature. This allows you to select specific packages to automatically upgrade without any further user involvement. In addition we extend our Wheezy support, add proxy support to apt:ppa and do various cleanups and tweaks. Features: - Add apt::unattended_upgrades support for Ubuntu. - Add wheezy backports support. - Use the geoDNS http.debian.net instead of the main debian ftp server. - Add `options` parameter to apt::ppa in order to pass options to apt-add-repository command. - Add proxy support for apt::ppa (uses proxy_host and proxy_port from apt). Bugfixes: - Fix regsubst() calls to quote single letters (for future parser). - Fix lint warnings and other misc cleanup. 1.2.0 ===== Features: - Add geppetto `.project` natures - Add GH auto-release - Add `apt::key::key_options` parameter - Add complex pin support using distribution properties for `apt::pin` via new properties: - `apt::pin::codename` - `apt::pin::release_version` - `apt::pin::component` - `apt::pin::originator` - `apt::pin::label` - Add source architecture support to `apt::source::architecture` Bugfixes: - Use apt-get instead of aptitude in apt::force - Update default backports location - Add dependency for required packages before apt-get update 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 - 0.0.4 * Fix ppa list filename when there is a period in the PPA name * Add .pref extension to apt preferences files * Allow preferences to be purged * Extend pin support 2012-05-04 Puppet Labs - 0.0.3 * only invoke apt-get update once * only install python-software-properties if a ppa is added * support 'ensure => absent' for all defined types * add apt::conf * add apt::backports * fixed Modulefile for module tool dependency resolution * configure proxy before doing apt-get update * use apt-get update instead of aptitude for apt::ppa * add support to pin release 2012-03-26 Puppet Labs - 0.0.2 41cedbb (#13261) Add real examples to smoke tests. d159a78 (#13261) Add key.pp smoke test 7116c7a (#13261) Replace foo source with puppetlabs source 1ead0bf Ignore pkg directory. 9c13872 (#13289) Fix some more style violations 0ea4ffa (#13289) Change test scaffolding to use a module & manifest dir fixture path a758247 (#13289) Clean up style violations and fix corresponding tests 99c3fd3 (#13289) Add puppet lint tests to Rakefile 5148cbf (#13125) Apt keys should be case insensitive b9607a4 Convert apt::key to use anchors 2012-03-07 Puppet Labs - 0.0.1 d4fec56 Modify apt::source release parameter test 1132a07 (#12917) Add contributors to README 8cdaf85 (#12823) Add apt::key defined type and modify apt::source to use it 7c0d10b (#12809) $release should use $lsbdistcodename and fall back to manual input be2cc3e (#12522) Adjust spec test for splitting purge 7dc60ae (#12522) Split purge option to spare sources.list 9059c4e Fix source specs to test all key permutations 8acb202 Add test for python-software-properties package a4af11f Check if python-software-properties is defined before attempting to define it. 1dcbf3d Add tests for required_packages change f3735d2 Allow duplicate $required_packages 74c8371 (#12430) Add tests for changes to apt module 97ebb2d Test two sources with the same key 1160bcd (#12526) Add ability to reverse apt { disable_keys => true } 2842d73 Add Modulefile to puppet-apt c657742 Allow the use of the same key in multiple sources 8c27963 (#12522) Adding purge option to apt class 997c9fd (#12529) Add unit test for apt proxy settings 50f3cca (#12529) Add parameter to support setting a proxy for apt d522877 (#12094) Replace chained .with_* with a hash 8cf1bd0 (#12094) Remove deprecated spec.opts file 2d688f4 (#12094) Add rspec-puppet tests for apt 0fb5f78 (#12094) Replace name with path in file resources f759bc0 (#11953) Apt::force passes $version to aptitude f71db53 (#11413) Add spec test for apt::force to verify changes to unless 2f5d317 (#11413) Update dpkg query used by apt::force cf6caa1 (#10451) Add test coverage to apt::ppa 0dd697d include_src parameter in example; Whitespace cleanup b662eb8 fix typos in "repositories" 1be7457 Fix (#10451) - apt::ppa fails to "apt-get update" when new PPA source is added 864302a Set the pin priority before adding the source (Fix #10449) 1de4e0a Refactored as per mlitteken 1af9a13 Added some crazy bash madness to check if the ppa is installed already. Otherwise the manifest tries to add it on every run! 52ca73e (#8720) Replace Apt::Ppa with Apt::Builddep 5c05fa0 added builddep command. a11af50 added the ability to specify the content of a key c42db0f Fixes ppa test. 77d2b0d reformatted whitespace to match recommended style of 2 space indentation. 27ebdfc ignore swap files. 377d58a added smoke tests for module. 18f614b reformatted apt::ppa according to recommended style. d8a1e4e Created a params class to hold global data. 636ae85 Added two params for apt class 148fc73 Update LICENSE. ed2d19e Support ability to add more than one PPA 420d537 Add call to apt-update after add-apt-repository in apt::ppa 945be77 Add package definition for python-software-properties 71fc425 Abs paths for all commands 9d51cd1 Adding LICENSE 71796e3 Heading fix in README 87777d8 Typo in README f848bac First commit puppetlabs-apt-1.4.0/.bundle/0040755 0000000 0000000 00000000000 12227302011 015755 5ustar00travis0000000 0000000 puppetlabs-apt-1.4.0/.bundle/config0100644 0000000 0000000 00000000041 12227301666 017154 0ustar00travis0000000 0000000 --- BUNDLE_WITHOUT: development puppetlabs-apt-1.4.0/metadata.json0100644 0000000 0000000 00000011464 12227302011 017104 0ustar00travis0000000 0000000 { "name": "puppetlabs-apt", "version": "1.4.0", "summary": "Puppet Labs Apt Module", "author": "Evolving Web / Puppet Labs", "description": "APT Module for Puppet", "dependencies": [ { "name": "puppetlabs/stdlib", "version_requirement": "\u003e\u003d 2.2.1" } ], "types": [], "checksums": { ".bundle/config": "7f1c988748783d2a8d455376eed1470c", ".fixtures.yml": "0c43f56b0bb8e8d04e8051a0e7aa37a5", ".forge-release/pom.xml": "c650a84961ad88de03192e23b63b3549", ".forge-release/publish": "1c1d6dd64ef52246db485eb5459aa941", ".forge-release/settings.xml": "06d768a57d582fe1ee078b563427e750", ".forge-release/validate": "7fffde8112f42a1ec986d49ba80ac219", ".nodeset.yml": "78d78c172336a387a1067464434ffbcb", ".travis.yml": "782420dcc9d6412c79c30f03b1f3613c", "CHANGELOG": "f5488e1e891a8f8c47143dac790ddab3", "Gemfile": "1bfa7eb6e30346c9ddb4a8b144b0d255", "Gemfile.lock": "8ff8bc3d32bb7412bd97e48190a93b2f", "LICENSE": "20bcc606fc61ffba2b8cea840e8dce4d", "Modulefile": "b34e93626fbc137cbb651952e7509839", "README.md": "65176b395f7202fe5d222ae7b0de4e05", "Rakefile": "0428ea3759a4692c91604396c406a9c1", "manifests/backports.pp": "09f1d86603d0f44a2169acb3eeea2a70", "manifests/builddep.pp": "4f313b5140c84aa7d5793b5a073c30dd", "manifests/conf.pp": "5ddf258195d414d93284dfd281a8d6e3", "manifests/debian/testing.pp": "aeb625bacb6a8df46c864ee9ee1cb5a5", "manifests/debian/unstable.pp": "108038596b05dc1d28975884693f73f5", "manifests/force.pp": "cf871e869f4114f32ab164de2a67e7e2", "manifests/init.pp": "5ec106a7a03313c544159a9a1f6b78e6", "manifests/key.pp": "3cf082ed91a3933ab7218d1be3464f4f", "manifests/params.pp": "ca4ce3730a65c43f884ab3e6445f1661", "manifests/pin.pp": "dea8cbaabc37010ce25838080608802b", "manifests/ppa.pp": "754a83944ae79b5001fc0c0a8c775985", "manifests/release.pp": "427f3ee70a6a1e55fa291e58655bd5d9", "manifests/source.pp": "6eab8d33c173a066f5dec8474efdedb6", "manifests/unattended_upgrades.pp": "e97f908b42010ff9a85be4afd2c721ab", "manifests/update.pp": "436c79f160f2cb603710795a9ec71ac7", "spec/classes/apt_spec.rb": "54841b04b42026770ed6d744a82c55df", "spec/classes/backports_spec.rb": "7d2454a881cc26edd3dcd3acb7ffd20f", "spec/classes/debian_testing_spec.rb": "fad1384cb9d3c99b2663d7df4762dc0e", "spec/classes/debian_unstable_spec.rb": "11131efffd18db3c96e2bbe3d98a2fb7", "spec/classes/params_spec.rb": "a25396d3f0bbac784a7951f03ad7e8f4", "spec/classes/release_spec.rb": "d8f01a3cf0c2f6f6952b835196163ce4", "spec/classes/unattended_upgrades_spec.rb": "a2e206bda79d24cdb43312d035eff66f", "spec/defines/builddep_spec.rb": "e1300bb4f3abbd34029b11d8b733a6e5", "spec/defines/conf_spec.rb": "b7fc9fb6cb270c276aacbfa4a43f228c", "spec/defines/force_spec.rb": "97098c5b123be49e321e71cda288fe53", "spec/defines/key_spec.rb": "7800c30647b1ddf799b991110109cba0", "spec/defines/pin_spec.rb": "c912e59e9e3d1145280d659cccabe72b", "spec/defines/ppa_spec.rb": "72ce037a1d6ea0a33f369b1f3d98b3d6", "spec/defines/source_spec.rb": "e553bb9598dbe2becba6ae7f91d4deb0", "spec/spec_helper.rb": "0db89c9a486df193c0e40095422e19dc", "spec/spec_helper_system.rb": "e67d2574baae312f1095f90d78fdf5e9", "spec/system/apt_builddep_spec.rb": "97be5a48d2d16d96cb7c35ccdbcdcb69", "spec/system/apt_key_spec.rb": "098835d0c53c69390d4c3b6ea8ef3815", "spec/system/apt_ppa_spec.rb": "c96f6d0bbdafac39beaf0d5e6eba9010", "spec/system/apt_source_spec.rb": "df5aa98b03688884903c564bb507469f", "spec/system/basic_spec.rb": "0a5b33d18254bedcb7886e34846ebff6", "spec/system/class_spec.rb": "2ba4265236f00685c23cb00f908defc1", "templates/10periodic.erb": "2aeea866a39f19a62254abbb4f1bc59d", "templates/50unattended-upgrades.erb": "ae995ade214fdaefab51d335c85819ae", "templates/pin.pref.erb": "623249839cee7788fa0805a3474396db", "templates/source.list.erb": "65a016e60daf065c481f3d5f2c883324", "tests/builddep.pp": "4773f57072111e58f2ed833fa4489a88", "tests/debian/testing.pp": "1cbee56baddd6a91d981db8fddec70fb", "tests/debian/unstable.pp": "4b2a090afeb315752262386f4dbcd8ca", "tests/force.pp": "2bb6cf0b3d655cb51f95aeb79035e600", "tests/init.pp": "551138eb704e71ab3687932dda429a81", "tests/key.pp": "371a695e1332d51a38e283a87be52798", "tests/params.pp": "900db40f3fc84b0be173278df2ebff35", "tests/pin.pp": "4b4c3612d75a19dba8eb7227070fa4ab", "tests/ppa.pp": "b902cce8159128b5e8b21bed540743ff", "tests/release.pp": "53ce5debe6fa5bee42821767599cc768", "tests/source.pp": "9cecd9aa0dcde250fe49be9e26971a98", "tests/unattended-upgrades.pp": "cdc853f1b58e5206c5a538621ddca161" }, "source": "https://github.com/puppetlabs/puppetlabs-apt", "project_page": "https://github.com/puppetlabs/puppetlabs-apt", "license": "Apache License 2.0" }puppetlabs-apt-1.4.0/tests/0040755 0000000 0000000 00000000000 12227302011 015570 5ustar00travis0000000 0000000 puppetlabs-apt-1.4.0/tests/builddep.pp0100644 0000000 0000000 00000000066 12227301662 017733 0ustar00travis0000000 0000000 class { 'apt': } apt::builddep{ 'glusterfs-server': } puppetlabs-apt-1.4.0/tests/force.pp0100644 0000000 0000000 00000000173 12227301662 017240 0ustar00travis0000000 0000000 # force.pp # force a package from a specific release apt::force { 'package': release => 'testing', version => false } puppetlabs-apt-1.4.0/tests/init.pp0100644 0000000 0000000 00000000021 12227301662 017075 0ustar00travis0000000 0000000 class { 'apt': } puppetlabs-apt-1.4.0/tests/ppa.pp0100644 0000000 0000000 00000000145 12227301662 016721 0ustar00travis0000000 0000000 class { 'apt': } # Example declaration of an Apt PPA apt::ppa{ 'ppa:openstack-ppa/bleeding-edge': } puppetlabs-apt-1.4.0/tests/pin.pp0100644 0000000 0000000 00000000161 12227301662 016725 0ustar00travis0000000 0000000 # pin a release in apt, useful for unstable repositories apt::pin { 'foo': packages => '*', priority => 0, } puppetlabs-apt-1.4.0/tests/debian/0040755 0000000 0000000 00000000000 12227302011 017012 5ustar00travis0000000 0000000 puppetlabs-apt-1.4.0/tests/debian/testing.pp0100644 0000000 0000000 00000000063 12227301662 021037 0ustar00travis0000000 0000000 class { 'apt': } class { 'apt::debian::testing': } puppetlabs-apt-1.4.0/tests/debian/unstable.pp0100644 0000000 0000000 00000000064 12227301662 021200 0ustar00travis0000000 0000000 class { 'apt': } class { 'apt::debian::unstable': } puppetlabs-apt-1.4.0/tests/params.pp0100644 0000000 0000000 00000000024 12227301662 017420 0ustar00travis0000000 0000000 include apt::params puppetlabs-apt-1.4.0/tests/release.pp0100644 0000000 0000000 00000000104 12227301662 017554 0ustar00travis0000000 0000000 class { 'apt': } class { 'apt::release': release_id => 'karmic' } puppetlabs-apt-1.4.0/tests/unattended-upgrades.pp0100644 0000000 0000000 00000000041 12227301662 022077 0ustar00travis0000000 0000000 include apt::unattended-upgrades puppetlabs-apt-1.4.0/tests/key.pp0100644 0000000 0000000 00000000325 12227301662 016731 0ustar00travis0000000 0000000 # Declare Apt key for apt.puppetlabs.com source apt::key { 'puppetlabs': key => '4BD6EC30', key_server => 'pgp.mit.edu', key_options => 'http-proxy="http://proxyuser:proxypass@example.org:3128"', } puppetlabs-apt-1.4.0/tests/source.pp0100644 0000000 0000000 00000001600 12227301662 017436 0ustar00travis0000000 0000000 # Declare the apt class to manage /etc/apt/sources.list and /etc/sources.list.d class { 'apt': } # Install the puppetlabs apt source # Release is automatically obtained from lsbdistcodename fact if available. apt::source { 'puppetlabs': location => 'http://apt.puppetlabs.com', repos => 'main', key => '4BD6EC30', key_server => 'pgp.mit.edu', } # test two sources with the same key apt::source { 'debian_testing': location => 'http://debian.mirror.iweb.ca/debian/', release => 'testing', repos => 'main contrib non-free', key => '55BE302B', key_server => 'subkeys.pgp.net', pin => '-10', } apt::source { 'debian_unstable': location => 'http://debian.mirror.iweb.ca/debian/', release => 'unstable', repos => 'main contrib non-free', key => '55BE302B', key_server => 'subkeys.pgp.net', pin => '-10', } puppetlabs-apt-1.4.0/.fixtures.yml0100644 0000000 0000000 00000000203 12227301662 017103 0ustar00travis0000000 0000000 fixtures: repositories: "stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git" symlinks: "apt": "#{source_dir}" puppetlabs-apt-1.4.0/README.md0100644 0000000 0000000 00000020355 12227301662 015722 0ustar00travis0000000 0000000 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 To begin using the APT module with default parameters, declare the class 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, disable_keys => undef, proxy_host => false, proxy_port => '8080', purge_sources_list => false, purge_sources_list_d => false, purge_preferences_d => false, update_timeout => undef } 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::force 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'], } ###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::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 } 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`. apt::ppa { 'ppa:drizzle-developers/ppa': } ###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 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 } 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', repos => 'main', key => '4BD6EC30', key_server => 'pgp.mit.edu', } ###Testing 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::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 * Branan Purvine-Riley * Christian G. Warden * Dan Bode * Garrett Honeycutt * Jeff Wallace * Ken Barber * Matthaus Litteken * Matthias Pigulla * Monty Taylor * Peter Drake * Reid Vandewiele * Robert Navarro * Ryan Coleman * Scott McLeod * Spencer Krum * William Van Hevelingen * Zach Leslie puppetlabs-apt-1.4.0/manifests/0040755 0000000 0000000 00000000000 12227302011 016417 5ustar00travis0000000 0000000 puppetlabs-apt-1.4.0/manifests/conf.pp0100644 0000000 0000000 00000000464 12227301662 017721 0ustar00travis0000000 0000000 define apt::conf ( $content, $ensure = present, $priority = '50' ) { include apt::params $apt_conf_d = $apt::params::apt_conf_d file { "${apt_conf_d}/${priority}${name}": ensure => $ensure, content => $content, owner => root, group => root, mode => '0644', } } puppetlabs-apt-1.4.0/manifests/builddep.pp0100644 0000000 0000000 00000000570 12227301662 020562 0ustar00travis0000000 0000000 # builddep.pp define apt::builddep() { include apt::update exec { "apt-builddep-${name}": command => "/usr/bin/apt-get -y --force-yes build-dep ${name}", logoutput => 'on_failure', notify => Exec['apt_update'], } # Need anchor to provide containment for dependencies. anchor { "apt::builddep::${name}": require => Class['apt::update'], } } puppetlabs-apt-1.4.0/manifests/unattended_upgrades.pp0100644 0000000 0000000 00000003364 12227301662 023023 0ustar00travis0000000 0000000 # Class: apt::unattended_upgrades # # This class manages the unattended-upgrades package and related configuration # files for ubuntu # # origins are the repositories to automatically upgrade included packages # blacklist is a list of packages to not automatically upgrade # update is how often to run "apt-get update" in days # download is how often to run "apt-get upgrade --download-only" in days # upgrade is how often to upgrade packages included in the origins list in days # autoclean is how often to run "apt-get autoclean" in days # # information on the other options can be found in the 50unattended-upgrades # file and in /etc/cron.daily/apt # class apt::unattended_upgrades ( $origins = ['${distro_id}:${distro_codename}-security'], $blacklist = [], $update = "1", $download = "1", $upgrade = "1", $autoclean = "7", $auto_fix = true, $minimal_steps = false, $install_on_shutdown = false, $mail_to = "NONE", $mail_only_on_error = false, $remove_unused = true, $auto_reboot = false, $dl_limit = "NONE", $enable = "1", $backup_interval = "0", $backup_level = "3", $max_age = "0", $min_age = "0", $max_size = "0", $download_delta = "0", $verbose = "0", ) { validate_bool( $auto_fix, $minimal_steps, $install_on_shutdown, $mail_only_on_error, $remove_unused, $auto_reboot ) package { 'unattended-upgrades': ensure => present, } File { ensure => file, owner => 'root', group => 'root', mode => '0644', require => Package['unattended-upgrades'], } file { '/etc/apt/apt.conf.d/50unattended-upgrades': content => template('apt/50unattended-upgrades.erb'); '/etc/apt/apt.conf.d/10periodic': content => template('apt/10periodic.erb'); } } puppetlabs-apt-1.4.0/manifests/force.pp0100644 0000000 0000000 00000001113 12227301662 020062 0ustar00travis0000000 0000000 # force.pp # force a package from a specific release define apt::force( $release = 'testing', $version = false, $timeout = 300 ) { $version_string = $version ? { false => undef, default => "=${version}", } $install_check = $version ? { false => "/usr/bin/dpkg -s ${name} | grep -q 'Status: install'", default => "/usr/bin/dpkg -s ${name} | grep -q 'Version: ${version}'", } exec { "/usr/bin/apt-get -y -t ${release} install ${name}${version_string}": unless => $install_check, logoutput => 'on_failure', timeout => $timeout, } } puppetlabs-apt-1.4.0/manifests/init.pp0100644 0000000 0000000 00000006427 12227301662 017744 0ustar00travis0000000 0000000 # Class: apt # # This module manages the initial configuration of apt. # # Parameters: # The parameters listed here are not required in general and were # 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) # purge_sources_list - Accepts true or false. Defaults to false If set to # true, Puppet will purge all unmanaged entries from sources.list # purge_sources_list_d - Accepts true or false. Defaults to false. If set # to true, Puppet will purge all unmanaged entries from sources.list.d # update_timeout - Overrides the exec timeout in seconds for apt-get update. # If not set defaults to Exec's default (300) # # Actions: # # Requires: # puppetlabs/stdlib # Sample Usage: # class { 'apt': } class apt( $always_apt_update = false, $disable_keys = undef, $proxy_host = false, $proxy_port = '8080', $purge_sources_list = false, $purge_sources_list_d = false, $purge_preferences_d = false, $update_timeout = undef ) { include apt::params include apt::update validate_bool($purge_sources_list, $purge_sources_list_d, $purge_preferences_d) $sources_list_content = $purge_sources_list ? { false => undef, true => "# Repos managed by puppet.\n", } if $always_apt_update == true { Exec <| title=='apt_update' |> { refreshonly => false, } } $root = $apt::params::root $apt_conf_d = $apt::params::apt_conf_d $sources_list_d = $apt::params::sources_list_d $preferences_d = $apt::params::preferences_d $provider = $apt::params::provider file { 'sources.list': ensure => present, path => "${root}/sources.list", owner => root, group => root, mode => '0644', content => $sources_list_content, notify => Exec['apt_update'], } file { 'sources.list.d': ensure => directory, path => $sources_list_d, owner => root, group => root, purge => $purge_sources_list_d, recurse => $purge_sources_list_d, notify => Exec['apt_update'], } file { 'preferences.d': ensure => directory, path => $preferences_d, owner => root, group => root, purge => $purge_preferences_d, recurse => $purge_preferences_d, } case $disable_keys { true: { file { '99unauth': ensure => present, content => "APT::Get::AllowUnauthenticated 1;\n", path => "${apt_conf_d}/99unauth", } } false: { file { '99unauth': ensure => absent, path => "${apt_conf_d}/99unauth", } } undef: { } # do nothing default: { fail('Valid values for disable_keys are true or false') } } $proxy_set = $proxy_host ? { false => absent, default => present } file { 'configure-apt-proxy': ensure => $proxy_set, path => "${apt_conf_d}/proxy", content => "Acquire::http::Proxy \"http://${proxy_host}:${proxy_port}\";", notify => Exec['apt_update'], } # Need anchor to provide containment for dependencies. anchor { 'apt::update': require => Class['apt::update'], } } puppetlabs-apt-1.4.0/manifests/ppa.pp0100644 0000000 0000000 00000003441 12227301662 017552 0ustar00travis0000000 0000000 # ppa.pp define apt::ppa( $release = $::lsbdistcodename, $options = '-y' ) { include apt::params include apt::update $sources_list_d = $apt::params::sources_list_d if ! $release { fail('lsbdistcodename fact not available: release parameter required') } $filename_without_slashes = regsubst($name, '/', '-', 'G') $filename_without_dots = regsubst($filename_without_slashes, '\.', '_', 'G') $filename_without_ppa = regsubst($filename_without_dots, '^ppa:', '', 'G') $sources_list_d_filename = "${filename_without_ppa}-${release}.list" $package = $::lsbdistrelease ? { /^[1-9]\..*|1[01]\..*|12.04$/ => 'python-software-properties', default => 'software-properties-common', } if ! defined(Package[$package]) { package { $package: } } if defined(Class[apt]) { $proxy_host = getparam(Class[apt], 'proxy_host') $proxy_port = getparam(Class[apt], 'proxy_port') case $proxy_host { false, '': { $proxy_env = [] } default: {$proxy_env = ["http_proxy=http://${proxy_host}:${proxy_port}", "https_proxy=http://${proxy_host}:${proxy_port}"]} } } else { $proxy_env = [] } exec { "add-apt-repository-${name}": environment => $proxy_env, command => "/usr/bin/add-apt-repository ${options} ${name}", unless => "/usr/bin/test -s ${sources_list_d}/${sources_list_d_filename}", logoutput => 'on_failure', notify => Exec['apt_update'], require => [ File[$sources_list_d], Package[$package], ], } file { "${sources_list_d}/${sources_list_d_filename}": ensure => file, require => Exec["add-apt-repository-${name}"], } # Need anchor to provide containment for dependencies. anchor { "apt::ppa::${name}": require => Class['apt::update'], } } puppetlabs-apt-1.4.0/manifests/update.pp0100644 0000000 0000000 00000000341 12227301662 020250 0ustar00travis0000000 0000000 class apt::update { include apt::params exec { 'apt_update': command => "${apt::params::provider} update", logoutput => 'on_failure', refreshonly => true, timeout => $apt::update_timeout, } } puppetlabs-apt-1.4.0/manifests/pin.pp0100644 0000000 0000000 00000003677 12227301662 017573 0ustar00travis0000000 0000000 # pin.pp # pin a release in apt, useful for unstable repositories define apt::pin( $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 $preferences_d = $apt::params::preferences_d if $order != '' and !is_integer($order) { fail('Only integers are allowed in the apt::pin order param') } $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 ? { '' => "${preferences_d}/${name}.pref", default => "${preferences_d}/${order}-${name}.pref", } file { "${name}.pref": ensure => $ensure, path => $path, owner => root, group => root, mode => '0644', content => template('apt/pin.pref.erb'), } } puppetlabs-apt-1.4.0/manifests/debian/0040755 0000000 0000000 00000000000 12227302011 017641 5ustar00travis0000000 0000000 puppetlabs-apt-1.4.0/manifests/debian/testing.pp0100644 0000000 0000000 00000001240 12227301662 021664 0ustar00travis0000000 0000000 # testing.pp class apt::debian::testing { include apt # deb http://debian.mirror.iweb.ca/debian/ testing main contrib non-free # deb-src http://debian.mirror.iweb.ca/debian/ testing main contrib non-free # Key: 55BE302B Server: subkeys.pgp.net # debian-keyring # debian-archive-keyring apt::source { 'debian_testing': location => 'http://debian.mirror.iweb.ca/debian/', release => 'testing', repos => 'main contrib non-free', required_packages => 'debian-keyring debian-archive-keyring', key => '55BE302B', key_server => 'subkeys.pgp.net', pin => '-10', } } puppetlabs-apt-1.4.0/manifests/debian/unstable.pp0100644 0000000 0000000 00000001246 12227301662 022032 0ustar00travis0000000 0000000 # unstable.pp class apt::debian::unstable { include apt # deb http://debian.mirror.iweb.ca/debian/ unstable main contrib non-free # deb-src http://debian.mirror.iweb.ca/debian/ unstable main contrib non-free # Key: 55BE302B Server: subkeys.pgp.net # debian-keyring # debian-archive-keyring 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', } } puppetlabs-apt-1.4.0/manifests/params.pp0100644 0000000 0000000 00000001626 12227301662 020260 0ustar00travis0000000 0000000 class apt::params { $root = '/etc/apt' $provider = '/usr/bin/apt-get' $sources_list_d = "${root}/sources.list.d" $apt_conf_d = "${root}/apt.conf.d" $preferences_d = "${root}/preferences.d" case $::lsbdistid { 'debian': { case $::lsbdistcodename { 'squeeze': { $backports_location = 'http://backports.debian.org/debian-backports' } 'wheezy': { $backports_location = 'http://ftp.debian.org/debian/' } default: { $backports_location = 'http://http.debian.net/debian/' } } } 'ubuntu': { case $::lsbdistcodename { 'hardy','lucid','maverick','natty','oneiric','precise': { $backports_location = 'http://us.archive.ubuntu.com/ubuntu' } default: { $backports_location = 'http://old-releases.ubuntu.com/ubuntu' } } } } } puppetlabs-apt-1.4.0/manifests/release.pp0100644 0000000 0000000 00000000424 12227301662 020410 0ustar00travis0000000 0000000 # release.pp class apt::release ( $release_id ) { include apt::params $root = $apt::params::root file { "${root}/apt.conf.d/01release": owner => root, group => root, mode => '0644', content => "APT::Default-Release \"${release_id}\";" } } puppetlabs-apt-1.4.0/manifests/key.pp0100644 0000000 0000000 00000005266 12227301662 017571 0ustar00travis0000000 0000000 define apt::key ( $key = $title, $ensure = present, $key_content = false, $key_source = false, $key_server = 'keyserver.ubuntu.com', $key_options = false ) { 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' } elsif $key_source { $method = 'source' } elsif $key_server { $method = 'server' } # This is a hash of the parts of the key definition that we care about. # It is used as a unique identifier for this instance of apt::key. It gets # hashed to ensure that the resource name doesn't end up being pages and # pages (e.g. in the situation where key_content is specified). $digest = sha1("${upkey}/${key_content}/${key_source}/${key_server}/") # Allow multiple ensure => present for the same key to account for many # apt::source resources that all reference the same key. case $ensure { present: { anchor { "apt::key/${title}": } if defined(Exec["apt::key ${upkey} absent"]) { fail("Cannot ensure Apt::Key[${upkey}] present; ${upkey} already ensured absent") } if !defined(Anchor["apt::key ${upkey} present"]) { anchor { "apt::key ${upkey} present": } } if $key_options{ $options_string = "--keyserver-options ${key_options}" } else{ $options_string = '' } if !defined(Exec[$digest]) { $digest_command = $method ? { 'content' => "echo '${key_content}' | /usr/bin/apt-key add -", 'source' => "wget -q '${key_source}' -O- | apt-key add -", 'server' => "apt-key adv --keyserver '${key_server}' ${options_string} --recv-keys '${upkey}'", } exec { $digest: command => $digest_command, path => '/bin:/usr/bin', unless => "/usr/bin/apt-key list | /bin/grep '${trimmedkey}'", logoutput => 'on_failure', before => Anchor["apt::key ${upkey} present"], } } Anchor["apt::key ${upkey} present"] -> Anchor["apt::key/${title}"] } absent: { if defined(Anchor["apt::key ${upkey} present"]) { fail("Cannot ensure Apt::Key[${upkey}] absent; ${upkey} already ensured present") } exec { "apt::key ${upkey} absent": command => "apt-key del '${upkey}'", path => '/bin:/usr/bin', onlyif => "apt-key list | grep '${trimmedkey}'", user => 'root', group => 'root', logoutput => 'on_failure', } } default: { fail "Invalid 'ensure' value '${ensure}' for aptkey" } } } puppetlabs-apt-1.4.0/manifests/backports.pp0100644 0000000 0000000 00000002177 12227301662 020767 0ustar00travis0000000 0000000 # This adds the necessary components to get backports for ubuntu and debian # # == Parameters # # [*release*] # The ubuntu/debian release name. Defaults to $lsbdistcodename. Setting this # manually can cause undefined behavior. (Read: universe exploding) # # == Examples # # include apt::backports # # class { 'apt::backports': # release => 'natty', # } # # == Authors # # Ben Hughes, I think. At least blame him if this goes wrong. # I just added puppet doc. # # == Copyright # # Copyright 2011 Puppet Labs Inc, unless otherwise noted. class apt::backports( $release = $::lsbdistcodename, $location = $apt::params::backports_location ) inherits apt::params { $release_real = downcase($release) $key = $::lsbdistid ? { 'debian' => '55BE302B', 'ubuntu' => '437D05B5', } $repos = $::lsbdistid ? { 'debian' => 'main contrib non-free', 'ubuntu' => 'main universe multiverse restricted', } apt::source { 'backports': location => $location, release => "${release_real}-backports", repos => $repos, key => $key, key_server => 'pgp.mit.edu', pin => '200', } } puppetlabs-apt-1.4.0/manifests/source.pp0100644 0000000 0000000 00000004334 12227301662 020274 0ustar00travis0000000 0000000 # source.pp # add an apt source define apt::source( $ensure = present, $location = '', $release = 'UNDEF', $repos = 'main', $include_src = true, $required_packages = false, $key = false, $key_server = 'keyserver.ubuntu.com', $key_content = false, $key_source = false, $pin = false, $architecture = undef ) { include apt::params include apt::update $sources_list_d = $apt::params::sources_list_d $provider = $apt::params::provider if $release == 'UNDEF' { if $::lsbdistcodename == undef { fail('lsbdistcodename fact not available: release parameter required') } else { $release_real = $::lsbdistcodename } } else { $release_real = $release } file { "${name}.list": ensure => $ensure, path => "${sources_list_d}/${name}.list", owner => root, group => root, mode => '0644', content => template("${module_name}/source.list.erb"), notify => Exec['apt_update'], } if ($pin != false) { # Get the host portion out of the url so we can pin to origin $url_split = split($location, '/') $host = $url_split[2] apt::pin { $name: ensure => $ensure, priority => $pin, before => File["${name}.list"], origin => $host, } } if ($required_packages != false) and ($ensure == 'present') { exec { "Required packages: '${required_packages}' for ${name}": command => "${provider} -y install ${required_packages}", logoutput => 'on_failure', refreshonly => true, subscribe => File["${name}.list"], before => Exec['apt_update'], } } # We do not want to remove keys when the source is absent. if ($key != false) and ($ensure == 'present') { apt::key { "Add key: ${key} from Apt::Source ${title}": ensure => present, key => $key, key_server => $key_server, key_content => $key_content, key_source => $key_source, before => File["${name}.list"], } } # Need anchor to provide containment for dependencies. anchor { "apt::source::${name}": require => Class['apt::update'], } } puppetlabs-apt-1.4.0/spec/0040755 0000000 0000000 00000000000 12227302011 015360 5ustar00travis0000000 0000000 puppetlabs-apt-1.4.0/spec/classes/0040755 0000000 0000000 00000000000 12227302011 017015 5ustar00travis0000000 0000000 puppetlabs-apt-1.4.0/spec/classes/debian_unstable_spec.rb0100644 0000000 0000000 00000001000 12227301662 023472 0ustar00travis0000000 0000000 require 'spec_helper' describe 'apt::debian::unstable', :type => :class do it { should contain_apt__source("debian_unstable").with({ "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" }) } end puppetlabs-apt-1.4.0/spec/classes/debian_testing_spec.rb0100644 0000000 0000000 00000001013 12227301662 023336 0ustar00travis0000000 0000000 require 'spec_helper' describe 'apt::debian::testing', :type => :class do it { should contain_apt__source("debian_testing").with({ "location" => "http://debian.mirror.iweb.ca/debian/", "release" => "testing", "repos" => "main contrib non-free", "required_packages" => "debian-keyring debian-archive-keyring", "key" => "55BE302B", "key_server" => "subkeys.pgp.net", "pin" => "-10" }) } end puppetlabs-apt-1.4.0/spec/classes/backports_spec.rb0100644 0000000 0000000 00000003417 12227301662 022361 0ustar00travis0000000 0000000 require 'spec_helper' describe 'apt::backports', :type => :class do describe 'when turning on backports for ubuntu karmic' do let :facts do { 'lsbdistcodename' => 'Karmic', 'lsbdistid' => 'Ubuntu' } end it { should contain_apt__source('backports').with({ 'location' => 'http://old-releases.ubuntu.com/ubuntu', 'release' => 'karmic-backports', 'repos' => 'main universe multiverse restricted', 'key' => '437D05B5', 'key_server' => 'pgp.mit.edu', 'pin' => '200', }) } end describe "when turning on backports for debian squeeze" do let :facts do { 'lsbdistcodename' => 'Squeeze', 'lsbdistid' => 'Debian', } end it { should contain_apt__source('backports').with({ 'location' => 'http://backports.debian.org/debian-backports', 'release' => 'squeeze-backports', 'repos' => 'main contrib non-free', 'key' => '55BE302B', 'key_server' => 'pgp.mit.edu', 'pin' => '200', }) } end describe "when turning on backports for debian squeeze but using your own mirror" do let :facts do { 'lsbdistcodename' => 'Squeeze', 'lsbdistid' => 'Debian' } end let :location do 'http://mirrors.example.com/debian-backports' end let :params do { 'location' => location } end it { should contain_apt__source('backports').with({ 'location' => location, 'release' => 'squeeze-backports', 'repos' => 'main contrib non-free', 'key' => '55BE302B', 'key_server' => 'pgp.mit.edu', 'pin' => '200', }) } end end puppetlabs-apt-1.4.0/spec/classes/release_spec.rb0100644 0000000 0000000 00000000735 12227301662 022011 0ustar00travis0000000 0000000 require 'spec_helper' describe 'apt::release', :type => :class do let (:title) { 'my_package' } let :param_set do { :release_id => 'precise' } end let (:params) { param_set } it { should include_class("apt::params") } it { should contain_file("/etc/apt/apt.conf.d/01release").with({ "mode" => "0644", "owner" => "root", "group" => "root", "content" => "APT::Default-Release \"#{param_set[:release_id]}\";" }) } end puppetlabs-apt-1.4.0/spec/classes/apt_spec.rb0100644 0000000 0000000 00000007431 12227301662 021155 0ustar00travis0000000 0000000 require 'spec_helper' describe 'apt', :type => :class do let :default_params do { :disable_keys => :undef, :always_apt_update => false, :purge_sources_list => false, :purge_sources_list_d => false, } end [{}, { :disable_keys => true, :always_apt_update => true, :proxy_host => true, :proxy_port => '3128', :purge_sources_list => true, :purge_sources_list_d => true, }, { :disable_keys => false } ].each do |param_set| describe "when #{param_set == {} ? "using default" : "specifying"} class parameters" do let :param_hash do default_params.merge(param_set) end let :params do param_set end let :refresh_only_apt_update do if param_hash[:always_apt_update] false else true end end it { should include_class("apt::params") } it { if param_hash[:purge_sources_list] should contain_file("sources.list").with({ 'path' => "/etc/apt/sources.list", 'ensure' => "present", 'owner' => "root", 'group' => "root", 'mode' => "0644", "content" => "# Repos managed by puppet.\n" }) else should contain_file("sources.list").with({ 'path' => "/etc/apt/sources.list", 'ensure' => "present", 'owner' => "root", 'group' => "root", 'mode' => "0644", 'content' => nil }) end } it { if param_hash[:purge_sources_list_d] should create_file("sources.list.d").with({ 'path' => "/etc/apt/sources.list.d", 'ensure' => "directory", 'owner' => "root", 'group' => "root", 'purge' => true, 'recurse' => true, 'notify' => 'Exec[apt_update]' }) else should create_file("sources.list.d").with({ 'path' => "/etc/apt/sources.list.d", 'ensure' => "directory", 'owner' => "root", 'group' => "root", 'purge' => false, 'recurse' => false, 'notify' => 'Exec[apt_update]' }) end } it { should contain_exec("apt_update").with({ 'command' => "/usr/bin/apt-get update", 'refreshonly' => refresh_only_apt_update }) } it { if param_hash[:disable_keys] == true should create_file("99unauth").with({ 'content' => "APT::Get::AllowUnauthenticated 1;\n", 'ensure' => "present", 'path' => "/etc/apt/apt.conf.d/99unauth" }) elsif param_hash[:disable_keys] == false should create_file("99unauth").with({ 'ensure' => "absent", 'path' => "/etc/apt/apt.conf.d/99unauth" }) elsif param_hash[:disable_keys] != :undef should_not create_file("99unauth").with({ 'path' => "/etc/apt/apt.conf.d/99unauth" }) end } describe 'when setting a proxy' do it { if param_hash[:proxy_host] should contain_file('configure-apt-proxy').with( 'path' => '/etc/apt/apt.conf.d/proxy', 'content' => "Acquire::http::Proxy \"http://#{param_hash[:proxy_host]}:#{param_hash[:proxy_port]}\";", 'notify' => "Exec[apt_update]" ) else should contain_file('configure-apt-proxy').with( 'path' => '/etc/apt/apt.conf.d/proxy', 'notify' => 'Exec[apt_update]', 'ensure' => 'absent' ) end } end end end end puppetlabs-apt-1.4.0/spec/classes/params_spec.rb0100644 0000000 0000000 00000000661 12227301662 021652 0ustar00travis0000000 0000000 require 'spec_helper' describe 'apt::params', :type => :class do let (:title) { 'my_package' } it { should contain_apt__params } # There are 4 resources in this class currently # there should not be any more resources because it is a params class # The resources are class[apt::params], class[main], class[settings], stage[main] it "Should not contain any resources" do subject.resources.size.should == 4 end end puppetlabs-apt-1.4.0/spec/classes/unattended_upgrades_spec.rb0100644 0000000 0000000 00000014346 12227301662 024421 0ustar00travis0000000 0000000 require 'spec_helper' describe 'apt::unattended_upgrades', :type => :class do let(:file_unattended) { '/etc/apt/apt.conf.d/50unattended-upgrades' } let(:file_periodic) { '/etc/apt/apt.conf.d/10periodic' } it { should contain_package("unattended-upgrades") } it { should create_file("/etc/apt/apt.conf.d/50unattended-upgrades").with({ "owner" => "root", "group" => "root", "mode" => "0644", "require" => "Package[unattended-upgrades]", }) } it { should create_file("/etc/apt/apt.conf.d/10periodic").with({ "owner" => "root", "group" => "root", "mode" => "0644", "require" => "Package[unattended-upgrades]", }) } describe "origins" do describe "with param defaults" do let(:params) {{ }} it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::Allowed-Origins \{\n\t"\${distro_id}:\${distro_codename}-security";\n\};$/) } end describe "with origins => ['ubuntu:precise-security']" do let :params do { :origins => ['ubuntu:precise-security'] } end it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::Allowed-Origins \{\n\t"ubuntu:precise-security";\n\};$/) } end end describe "blacklist" do describe "with param defaults" do let(:params) {{ }} it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::Package-Blacklist \{\n\};$/) } end describe "with blacklist => []" do let :params do { :blacklist => ['libc6', 'libc6-dev'] } end it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::Package-Blacklist \{\n\t"libc6";\n\t"libc6-dev";\n\};$/) } end end describe "with update => 2" do let :params do { :update => "2" } end it { should contain_file(file_periodic).with_content(/^APT::Periodic::Update-Package-Lists "2";$/) } end describe "with download => 2" do let :params do { :download => "2" } end it { should contain_file(file_periodic).with_content(/^APT::Periodic::Download-Upgradeable-Packages "2";$/) } end describe "with upgrade => 2" do let :params do { :upgrade => "2" } end it { should contain_file(file_periodic).with_content(/^APT::Periodic::Unattended-Upgrade "2";$/) } end describe "with autoclean => 2" do let :params do { :autoclean => "2" } end it { should contain_file(file_periodic).with_content(/^APT::Periodic::AutocleanInterval "2";$/) } end describe "with auto_fix => false" do let :params do { :auto_fix => false } end it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::AutoFixInterruptedDpkg "false";$/) } end describe "with minimal_steps => true" do let :params do { :minimal_steps => true } end it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::MinimalSteps "true";$/) } end describe "with install_on_shutdown => true" do let :params do { :install_on_shutdown => true } end it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::InstallOnShutdown "true";$/) } end describe "mail_to" do describe "param defaults" do let(:params) {{ }} it { should_not contain_file(file_unattended).with_content(/^Unattended-Upgrade::Mail /) } it { should_not contain_file(file_unattended).with_content(/^Unattended-Upgrade::MailOnlyOnError /) } end describe "with mail_to => user@website, mail_only_on_error => true" do let :params do { :mail_to => "user@website", :mail_only_on_error => true } end it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::Mail "user@website";$/) } it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::MailOnlyOnError "true";$/) } end end describe "with remove_unused => false" do let :params do { :remove_unused => false } end it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::Remove-Unused-Dependencies "false";$/) } end describe "with auto_reboot => true" do let :params do { :auto_reboot => true } end it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::Automatic-Reboot "true";$/) } end describe "dl_limit" do describe "param defaults" do let(:params) {{ }} it { should_not contain_file(file_unattended).with_content(/^Acquire::http::Dl-Limit /) } end describe "with dl_limit => 70" do let :params do { :dl_limit => "70" } end it { should contain_file(file_unattended).with_content(/^Acquire::http::Dl-Limit "70";$/) } end end describe "with enable => 0" do let :params do { :enable => "0" } end it { should contain_file(file_periodic).with_content(/^APT::Periodic::Enable "0";$/) } end describe "with backup_interval => 1" do let :params do { :backup_interval => "1" } end it { should contain_file(file_periodic).with_content(/^APT::Periodic::BackUpArchiveInterval "1";$/) } end describe "with backup_level => 0" do let :params do { :backup_level => "0" } end it { should contain_file(file_periodic).with_content(/^APT::Periodic::BackUpLevel "0";$/) } end describe "with max_age => 1" do let :params do { :max_age => "1" } end it { should contain_file(file_periodic).with_content(/^APT::Periodic::MaxAge "1";$/) } end describe "with min_age => 1" do let :params do { :min_age => "1" } end it { should contain_file(file_periodic).with_content(/^APT::Periodic::MinAge "1";$/) } end describe "with max_size => 1" do let :params do { :max_size => "1" } end it { should contain_file(file_periodic).with_content(/^APT::Periodic::MaxSize "1";$/) } end describe "with download_delta => 2" do let :params do { :download_delta => "2" } end it { should contain_file(file_periodic).with_content(/^APT::Periodic::Download-Upgradeable-Packages-Debdelta "2";$/) } end describe "with verbose => 2" do let :params do { :verbose => "2" } end it { should contain_file(file_periodic).with_content(/^APT::Periodic::Verbose "2";$/) } end end puppetlabs-apt-1.4.0/spec/defines/0040755 0000000 0000000 00000000000 12227302011 016775 5ustar00travis0000000 0000000 puppetlabs-apt-1.4.0/spec/defines/force_spec.rb0100644 0000000 0000000 00000001741 12227301662 021445 0ustar00travis0000000 0000000 require 'spec_helper' describe 'apt::force', :type => :define do let :title do 'my_package' end let :default_params do { :release => 'testing', :version => false } end [{}, { :release => 'stable', :version => '1' } ].each do |param_set| describe "when #{param_set == {} ? "using default" : "specifying"} define parameters" do let :param_hash do default_params.merge(param_set) end let :params do param_set end let :unless_query do base_command = "/usr/bin/dpkg -s #{title} | grep -q " base_command + (params[:version] ? "'Version: #{params[:version]}'" : "'Status: install'") end let :exec_title do base_exec = "/usr/bin/apt-get -y -t #{param_hash[:release]} install #{title}" base_exec + (params[:version] ? "=#{params[:version]}" : "") end it { should contain_exec(exec_title).with_unless(unless_query) } end end end puppetlabs-apt-1.4.0/spec/defines/source_spec.rb0100644 0000000 0000000 00000011764 12227301662 021655 0ustar00travis0000000 0000000 require 'spec_helper' describe 'apt::source', :type => :define do let :title do 'my_source' end let :default_params do { :ensure => 'present', :location => '', :release => 'karmic', :repos => 'main', :include_src => true, :required_packages => false, :key => false, :key_server => 'keyserver.ubuntu.com', :key_content => false, :key_source => false, :pin => false } end [{}, { :location => 'http://example.com', :release => 'precise', :repos => 'security', :include_src => false, :required_packages => 'apache', :key => 'key_name', :key_server => 'keyserver.debian.com', :pin => '600', :key_content => 'ABCD1234' }, { :key => 'key_name', :key_server => 'keyserver.debian.com', :key_content => false, }, { :ensure => 'absent', :location => 'http://example.com', :release => 'precise', :repos => 'security', }, { :release => '', }, { :release => 'custom', }, { :architecture => 'amd64', } ].each do |param_set| describe "when #{param_set == {} ? "using default" : "specifying"} class parameters" do let :param_hash do default_params.merge(param_set) end let :facts do {:lsbdistcodename => 'karmic'} end let :params do param_set end let :filename do "/etc/apt/sources.list.d/#{title}.list" end let :content do content = "# #{title}" if param_hash[:architecture] arch = "[arch=#{param_hash[:architecture]}]" end content << "\ndeb #{arch}#{param_hash[:location]} #{param_hash[:release]} #{param_hash[:repos]}\n" if param_hash[:include_src] content << "deb-src #{arch}#{param_hash[:location]} #{param_hash[:release]} #{param_hash[:repos]}\n" end content end it { should contain_apt__params } it { should contain_file("#{title}.list").with({ 'ensure' => param_hash[:ensure], 'path' => filename, 'owner' => 'root', 'group' => 'root', 'mode' => '0644', 'content' => content, }) } it { if param_hash[:pin] should contain_apt__pin(title).with({ "priority" => param_hash[:pin], "before" => "File[#{title}.list]" }) else should_not contain_apt__pin(title).with({ "priority" => param_hash[:pin], "before" => "File[#{title}.list]" }) end } it { should contain_exec("apt_update").with({ "command" => "/usr/bin/apt-get update", "refreshonly" => true }) } it { if param_hash[:required_packages] should contain_exec("Required packages: '#{param_hash[:required_packages]}' for #{title}").with({ "command" => "/usr/bin/apt-get -y install #{param_hash[:required_packages]}", "subscribe" => "File[#{title}.list]", "refreshonly" => true, "before" => 'Exec[apt_update]', }) else should_not contain_exec("Required packages: '#{param_hash[:required_packages]}' for #{title}").with({ "command" => "/usr/bin/apt-get -y install #{param_hash[:required_packages]}", "subscribe" => "File[#{title}.list]", "refreshonly" => true }) end } it { if param_hash[:key] should contain_apt__key("Add key: #{param_hash[:key]} from Apt::Source #{title}").with({ "key" => param_hash[:key], "ensure" => :present, "key_server" => param_hash[:key_server], "key_content" => param_hash[:key_content], "key_source" => param_hash[:key_source], "before" => "File[#{title}.list]" }) else should_not contain_apt__key("Add key: #{param_hash[:key]} from Apt::Source #{title}").with({ "key" => param_hash[:key], "ensure" => :present, "key_server" => param_hash[:key_server], "key_content" => param_hash[:key_content], "key_source" => param_hash[:key_source], "before" => "File[#{title}.list]" }) end } end end describe "without release should raise a Puppet::Error" do let(:default_params) { Hash.new } let(:facts) { Hash.new } it { expect { should raise_error(Puppet::Error) } } let(:facts) { { :lsbdistcodename => 'lucid' } } it { should contain_apt__source(title) } end end puppetlabs-apt-1.4.0/spec/defines/ppa_spec.rb0100644 0000000 0000000 00000011003 12227301662 021117 0ustar00travis0000000 0000000 require 'spec_helper' describe 'apt::ppa', :type => :define do [ { :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 { :lsbdistrelease => platform[:lsbdistrelease], :lsbdistcodename => platform[:lsbdistcodename], } end let :release do "#{platform[:lsbdistcodename]}" end let :package do "#{platform[:package]}" end let :options do "-y" 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("#{package}") } 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 #{options} #{t}", 'unless' => "/usr/bin/test -s /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}]" ) } end end describe 'without a proxy defined' do let :title do 'rspec_ppa' end let :pre_condition do 'class { "apt": proxy_host => false }' end let :filename do "#{title}-#{release}.list" end it { should contain_exec("add-apt-repository-#{title}").with( 'environment' => [], 'command' => "/usr/bin/add-apt-repository #{options} #{title}", 'unless' => "/usr/bin/test -s /etc/apt/sources.list.d/#{filename}", 'require' => ["File[/etc/apt/sources.list.d]", "Package[#{package}]"], 'notify' => "Exec[apt_update]" ) } end describe 'behind a proxy' do let :title do 'rspec_ppa' end let :pre_condition do 'class { "apt": proxy_host => "user:pass@proxy", }' end let :filename do "#{title}-#{release}.list" end it { should contain_exec("add-apt-repository-#{title}").with( 'environment' => [ "http_proxy=http://user:pass@proxy:8080", "https_proxy=http://user:pass@proxy:8080", ], 'command' => "/usr/bin/add-apt-repository #{options} #{title}", 'unless' => "/usr/bin/test -s /etc/apt/sources.list.d/#{filename}", 'require' => ["File[/etc/apt/sources.list.d]", "Package[#{package}]"], 'notify' => "Exec[apt_update]" ) } end end end [ { :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 end describe "without Class[apt] should raise a Puppet::Error" do let(:release) { "natty" } let(:title) { "ppa" } it { expect { should contain_apt__ppa(title) }.to raise_error(Puppet::Error) } end describe "without release should raise a Puppet::Error" do let(:title) { "ppa:" } it { expect { should contain_apt__ppa(:release) }.to raise_error(Puppet::Error) } end end puppetlabs-apt-1.4.0/spec/defines/conf_spec.rb0100644 0000000 0000000 00000002724 12227301662 021276 0ustar00travis0000000 0000000 require 'spec_helper' describe 'apt::conf', :type => :define do let :title do 'norecommends' end describe "when creating an apt preference" do let :params do { :priority => '00', :content => "Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n" } end let :filename do "/etc/apt/apt.conf.d/00norecommends" end it { should contain_apt__conf('norecommends').with({ 'priority' => '00', 'content' => "Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n" }) } it { should contain_file(filename).with({ 'ensure' => 'present', 'content' => "Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n", 'owner' => 'root', 'group' => 'root', 'mode' => '0644', }) } end describe "when removing an apt preference" do let :params do { :ensure => 'absent', :priority => '00', :content => "Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n" } end let :filename do "/etc/apt/apt.conf.d/00norecommends" end it { should contain_file(filename).with({ 'ensure' => 'absent', 'content' => "Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n", 'owner' => 'root', 'group' => 'root', 'mode' => '0644', }) } end end puppetlabs-apt-1.4.0/spec/defines/builddep_spec.rb0100644 0000000 0000000 00000000652 12227301662 022137 0ustar00travis0000000 0000000 require 'spec_helper' describe 'apt::builddep', :type => :define do let(:title) { 'my_package' } describe "should require apt-get update" do it { should contain_exec("apt_update").with({ 'command' => "/usr/bin/apt-get update", 'refreshonly' => true }) } it { should contain_anchor("apt::builddep::my_package").with({ 'require' => 'Class[Apt::Update]', }) } end end puppetlabs-apt-1.4.0/spec/defines/key_spec.rb0100644 0000000 0000000 00000006623 12227301662 021143 0ustar00travis0000000 0000000 require 'spec_helper' describe 'apt::key', :type => :define do let :title do '8347A27F' end let :default_params do { :key => title, :ensure => 'present', :key_server => "keyserver.ubuntu.com", :key_source => false, :key_content => false } end [{}, { :ensure => 'absent' }, { :ensure => 'random' }, { :key_source => 'ftp://ftp.example.org/key', }, { :key_content => 'deadbeef', } ].each do |param_set| let :param_hash do param_hash = default_params.merge(param_set) param_hash[:key].upcase! if param_hash[:key] param_hash end let :params do param_set end let :digest do str = String.new str << param_hash[:key].to_s << '/' str << param_hash[:key_content].to_s << '/' str << param_hash[:key_source].to_s << '/' str << param_hash[:key_server].to_s << '/' Digest::SHA1.hexdigest(str) end describe "when #{param_set == {} ? "using default" : "specifying"} define parameters" do it { if [:present, 'present', :absent, 'absent'].include? param_hash[:ensure] should contain_apt__params end } it { if [:present, 'present'].include? param_hash[:ensure] should_not contain_exec("apt::key #{param_hash[:key]} absent") should contain_anchor("apt::key #{param_hash[:key]} present") should contain_exec(digest).with({ "path" => "/bin:/usr/bin", "unless" => "/usr/bin/apt-key list | /bin/grep '#{param_hash[:key]}'" }) elsif [:absent, 'absent'].include? param_hash[:ensure] should_not contain_anchor("apt::key #{param_hash[:key]} present") should contain_exec("apt::key #{param_hash[:key]} absent").with({ "path" => "/bin:/usr/bin", "onlyif" => "apt-key list | grep '#{param_hash[:key]}'", "command" => "apt-key del '#{param_hash[:key]}'" }) else expect { should raise_error(Puppet::Error) } end } it { if [:present, 'present'].include? param_hash[:ensure] if param_hash[:key_content] should contain_exec(digest).with({ "command" => "echo '#{param_hash[:key_content]}' | /usr/bin/apt-key add -" }) elsif param_hash[:key_source] should contain_exec(digest).with({ "command" => "wget -q '#{param_hash[:key_source]}' -O- | apt-key add -" }) elsif param_hash[:key_server] should contain_exec(digest).with({ "command" => "apt-key adv --keyserver '#{param_hash[:key_server]}' --recv-keys '#{param_hash[:key]}'" }) end end } end end [{ :ensure => 'present' }, { :ensure => 'absent' }].each do |param_set| describe "should correctly handle duplicate definitions" do let :pre_condition do "apt::key { 'duplicate': key => '#{title}'; }" end let(:params) { param_set } it { if param_set[:ensure] == 'present' should contain_anchor("apt::key #{title} present") should contain_apt__key(title) should contain_apt__key("duplicate") elsif param_set[:ensure] == 'absent' expect { should raise_error(Puppet::Error) } end } end end end puppetlabs-apt-1.4.0/spec/defines/pin_spec.rb0100644 0000000 0000000 00000005656 12227301662 021146 0ustar00travis0000000 0000000 require 'spec_helper' describe 'apt::pin', :type => :define do let(:title) { 'my_pin' } let :default_params do { :ensure => 'present', :order => '', :packages => '*', :priority => '0', :release => nil } end [ { :params => {}, :content => "# my_pin\nExplanation: : my_pin\nPackage: *\nPin: release a=my_pin\nPin-Priority: 0\n" }, { :params => { :packages => 'apache', :priority => '1' }, :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=my_pin\nPin-Priority: 1\n" }, { :params => { :order => 50, :packages => 'apache', :priority => '1' }, :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=my_pin\nPin-Priority: 1\n" }, { :params => { :ensure => 'absent', :packages => 'apache', :priority => '1' }, :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=my_pin\nPin-Priority: 1\n" }, { :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[:params]) end let :params do param_set[:params] end it { should include_class("apt::params") } it { should contain_file("#{title}.pref").with({ 'ensure' => param_hash[:ensure], 'path' => "/etc/apt/preferences.d/#{param_hash[:order] == '' ? "" : "#{param_hash[:order]}-"}#{title}.pref", 'owner' => 'root', 'group' => 'root', 'mode' => '0644', 'content' => param_set[:content], }) } end end end puppetlabs-apt-1.4.0/spec/system/0040755 0000000 0000000 00000000000 12227302011 016704 5ustar00travis0000000 0000000 puppetlabs-apt-1.4.0/spec/system/basic_spec.rb0100644 0000000 0000000 00000000402 12227301662 021330 0ustar00travis0000000 0000000 require 'spec_helper_system' describe 'basic tests:' do # Using puppet_apply as a subject context puppet_apply 'notice("foo")' do its(:stdout) { should =~ /foo/ } its(:stderr) { should be_empty } its(:exit_code) { should be_zero } end end puppetlabs-apt-1.4.0/spec/system/apt_ppa_spec.rb0100644 0000000 0000000 00000002612 12227301662 021700 0ustar00travis0000000 0000000 require 'spec_helper_system' describe 'apt::ppa' do context 'reset' do it 'removes ppa' do shell('rm /etc/apt/sources.list.d/drizzle-developers-ppa*') shell('rm /etc/apt/sources.list.d/raravena80-collectd5-*') end end context 'adding a ppa that doesnt exist' do it 'should work with no errors' do pp = <<-EOS include '::apt' apt::ppa { 'ppa:drizzle-developers/ppa': } EOS puppet_apply(pp) do |r| r.exit_code.should_not == 1 end end describe 'contains the source file' do it 'contains a drizzle ppa source' do shell('ls /etc/apt/sources.list.d/drizzle-developers-ppa-*.list') do |r| r.exit_code.should be_zero end end end end context 'readding a removed ppa.' do it 'setup' do shell('add-apt-repository -y ppa:raravena80/collectd5') # This leaves a blank file shell('add-apt-repository --remove ppa:raravena80/collectd5') end it 'should readd it successfully' do pp = <<-EOS include '::apt' apt::ppa { 'ppa:raravena80/collectd5': } EOS puppet_apply(pp) do |r| r.exit_code.should_not == 1 end end end context 'reset' do it 'removes added ppas' do shell('rm /etc/apt/sources.list.d/drizzle-developers-ppa*') shell('rm /etc/apt/sources.list.d/raravena80-collectd5-*') end end end puppetlabs-apt-1.4.0/spec/system/apt_key_spec.rb0100644 0000000 0000000 00000002145 12227301662 021711 0ustar00travis0000000 0000000 require 'spec_helper_system' describe 'apt::key' do context 'reset' do it 'clean up keys' do shell('apt-key del 4BD6EC30') shell('apt-key del D50582E6') end end context 'apt::key' do it 'should work with no errors' do pp = <<-EOS include '::apt' apt::key { 'puppetlabs': key => '4BD6EC30', key_server => 'pgp.mit.edu', } apt::key { 'jenkins': key => 'D50582E6', key_source => 'http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key', } EOS puppet_apply(pp) do |r| r.exit_code.should_not == 1 end end describe 'keys should exist' do it 'finds puppetlabs key' do shell('apt-key list | grep 4BD6EC30') do |r| r.exit_code.should be_zero end end it 'finds jenkins key' do shell('apt-key list | grep D50582E6') do |r| r.exit_code.should be_zero end end end end context 'reset' do it 'clean up keys' do shell('apt-key del 4BD6EC30') shell('apt-key del D50582E6') end end end puppetlabs-apt-1.4.0/spec/system/apt_source_spec.rb0100644 0000000 0000000 00000002165 12227301662 022423 0ustar00travis0000000 0000000 require 'spec_helper_system' describe 'apt::source' do context 'reset' do it 'clean up puppetlabs repo' do shell('apt-key del 4BD6EC30') shell('rm /etc/apt/sources.list.d/puppetlabs.list') end end context 'apt::source' do it 'should work with no errors' do pp = <<-EOS include '::apt' apt::source { 'puppetlabs': location => 'http://apt.puppetlabs.com', repos => 'main', key => '4BD6EC30', key_server => 'pgp.mit.edu', } EOS puppet_apply(pp) do |r| r.exit_code.should_not == 1 end end describe 'key should exist' do it 'finds puppetlabs key' do shell('apt-key list | grep 4BD6EC30') do |r| r.exit_code.should be_zero end end end describe 'source should exist' do describe file('/etc/apt/sources.list.d/puppetlabs.list') do it { should be_file } end end end context 'reset' do it 'clean up puppetlabs repo' do shell('apt-key del 4BD6EC30') shell('rm /etc/apt/sources.list.d/puppetlabs.list') end end end puppetlabs-apt-1.4.0/spec/system/class_spec.rb0100644 0000000 0000000 00000000632 12227301662 021361 0ustar00travis0000000 0000000 require 'spec_helper_system' describe 'apt class' do context 'default parameters' do # Using puppet_apply as a helper it 'should work with no errors' do pp = <<-EOS class { 'apt': } EOS # Run it twice and test for idempotency puppet_apply(pp) do |r| r.exit_code.should_not == 1 r.refresh r.exit_code.should be_zero end end end end puppetlabs-apt-1.4.0/spec/system/apt_builddep_spec.rb0100644 0000000 0000000 00000001371 12227301662 022711 0ustar00travis0000000 0000000 require 'spec_helper_system' describe 'apt::builddep' do context 'reset' do it 'removes packages' do shell('apt-get -y remove glusterfs-server') shell('apt-get -y remove g++') end end context 'apt::builddep' do it 'should work with no errors' do pp = <<-EOS include '::apt' apt::builddep { 'glusterfs-server': } EOS puppet_apply(pp) do |r| r.exit_code.should_not == 1 end end describe 'should install g++ as a dependency' do describe package('g++') do it { should be_installed } end end end context 'reset' do it 'removes packages' do shell('apt-get -y remove glusterfs-server') shell('apt-get -y remove g++') end end end puppetlabs-apt-1.4.0/spec/fixtures/0040755 0000000 0000000 00000000000 12227302011 017231 5ustar00travis0000000 0000000 puppetlabs-apt-1.4.0/spec/fixtures/manifests/0040755 0000000 0000000 00000000000 12227302011 021222 5ustar00travis0000000 0000000 puppetlabs-apt-1.4.0/spec/fixtures/modules/0040755 0000000 0000000 00000000000 12227302011 020701 5ustar00travis0000000 0000000 puppetlabs-apt-1.4.0/spec/spec_helper_system.rb0100644 0000000 0000000 00000001460 12227301662 021613 0ustar00travis0000000 0000000 require 'rspec-system/spec_helper' require 'rspec-system-puppet/helpers' require 'rspec-system-serverspec/helpers' include RSpecSystemPuppet::Helpers include Serverspec::Helper::RSpecSystem include Serverspec::Helper::DetectOS RSpec.configure do |c| # Project root proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) # Enable colour c.tty = true c.include RSpecSystemPuppet::Helpers # This is where we 'setup' the nodes before running our tests c.before :suite do # May as well update here as this can only run on apt-get machines. shell('apt-get update') # Install puppet puppet_install # Install modules and dependencies puppet_module_install(:source => proj_root, :module_name => 'apt') shell('puppet module install puppetlabs-stdlib') end end puppetlabs-apt-1.4.0/spec/spec_helper.rb0100644 0000000 0000000 00000000064 12227301662 020206 0ustar00travis0000000 0000000 require 'puppetlabs_spec_helper/module_spec_helper' puppetlabs-apt-1.4.0/Gemfile.lock0100644 0000000 0000000 00000002716 12227301734 016666 0ustar00travis0000000 0000000 GEM remote: https://rubygems.org/ specs: builder (3.2.2) diff-lcs (1.2.4) facter (1.6.18) hiera (1.0.0) highline (1.6.19) kwalify (0.7.2) metaclass (0.0.1) mocha (0.14.0) metaclass (~> 0.0.1) net-scp (1.1.2) net-ssh (>= 2.6.5) net-ssh (2.7.0) nokogiri (1.5.10) puppet (3.0.2) facter (~> 1.6.11) hiera (~> 1.0.0) puppetlabs_spec_helper (0.4.1) mocha (>= 0.10.5) rake rspec (>= 2.9.0) rspec-puppet (>= 0.1.1) rake (10.1.0) rbvmomi (1.6.0) builder nokogiri (>= 1.4.1) trollop rspec (2.14.1) rspec-core (~> 2.14.0) rspec-expectations (~> 2.14.0) rspec-mocks (~> 2.14.0) rspec-core (2.14.5) rspec-expectations (2.14.3) diff-lcs (>= 1.1.3, < 2.0) rspec-mocks (2.14.3) rspec-puppet (0.1.6) rspec rspec-system (2.3.0) kwalify (~> 0.7.2) net-scp (~> 1.1) net-ssh (~> 2.6) nokogiri (~> 1.5.9) rbvmomi (~> 1.6) rspec (~> 2.13) systemu (~> 2.5) rspec-system-puppet (2.2.0) rspec-system (~> 2.0) rspec-system-serverspec (1.0.1) rspec-system (~> 2.0) serverspec (~> 0.0) serverspec (0.10.5) highline net-ssh rspec (>= 2.13.0) systemu (2.5.2) trollop (2.0) PLATFORMS ruby DEPENDENCIES puppet (~> 3.0.0) puppetlabs_spec_helper rake rspec-puppet rspec-system rspec-system-puppet rspec-system-serverspec puppetlabs-apt-1.4.0/.travis.yml0100644 0000000 0000000 00000002033 12227301662 016545 0ustar00travis0000000 0000000 --- branches: only: - master language: ruby bundler_args: --without development script: bundle exec rake spec SPEC_OPTS='--format documentation' after_success: - git clone -q git://github.com/puppetlabs/ghpublisher.git .forge-release - .forge-release/publish rvm: - 1.8.7 - 1.9.3 - 2.0.0 env: matrix: - PUPPET_GEM_VERSION="~> 2.7.0" - PUPPET_GEM_VERSION="~> 3.0.0" - PUPPET_GEM_VERSION="~> 3.1.0" - PUPPET_GEM_VERSION="~> 3.2.0" global: - PUBLISHER_LOGIN=puppetlabs - secure: |- ipB/CV1rVSTXU9ZDuzrFOlzJrRmJob36tKns2xszuH4r9s5P9qivNAngRGdV msb69xvOlzQykM0WRF+4kJ6TZ7AbMiDI+VZ8GDtsRaU5/q3BpsvFe8aato+6 QeyFtBG62OsosTEhGws4mqiFsPDu3dHlakuJc9zevlTuhNwbKSs= matrix: exclude: - rvm: 1.9.3 env: PUPPET_GEM_VERSION="~> 2.7.0" - rvm: 2.0.0 env: PUPPET_GEM_VERSION="~> 2.7.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-1.4.0/Rakefile0100644 0000000 0000000 00000000115 12227301662 016100 0ustar00travis0000000 0000000 require 'puppetlabs_spec_helper/rake_tasks' require 'rspec-system/rake_task' puppetlabs-apt-1.4.0/.nodeset.yml0100644 0000000 0000000 00000000655 12227301662 016706 0ustar00travis0000000 0000000 --- default_set: 'ubuntu-server-12042-x64' sets: 'debian-607-x64': nodes: "main.foo.vm": prefab: 'debian-607-x64' 'debian-70rc1-x64': nodes: "main.foo.vm": prefab: 'debian-70rc1-x64' 'ubuntu-server-10044-x64': nodes: "main.foo.vm": prefab: 'ubuntu-server-10044-x64' 'ubuntu-server-12042-x64': nodes: "main.foo.vm": prefab: 'ubuntu-server-12042-x64' puppetlabs-apt-1.4.0/Gemfile0100644 0000000 0000000 00000000774 12227301662 015741 0ustar00travis0000000 0000000 source 'https://rubygems.org' group :development, :test do gem 'rake', :require => false gem 'rspec-puppet', :require => false gem 'puppetlabs_spec_helper', :require => false gem 'rspec-system', :require => false gem 'rspec-system-puppet', :require => false gem 'rspec-system-serverspec', :require => false end if puppetversion = ENV['PUPPET_GEM_VERSION'] gem 'puppet', puppetversion, :require => false else gem 'puppet', :require => false end puppetlabs-apt-1.4.0/templates/0040755 0000000 0000000 00000000000 12227302011 016424 5ustar00travis0000000 0000000 puppetlabs-apt-1.4.0/templates/10periodic.erb0100644 0000000 0000000 00000001164 12227301662 021067 0ustar00travis0000000 0000000 APT::Periodic::Enable "<%= @enable %>"; APT::Periodic::BackUpArchiveInterval "<%= @backup_interval %>"; APT::Periodic::BackUpLevel "<%= @backup_level %>"; APT::Periodic::MaxAge "<%= @max_age %>"; APT::Periodic::MinAge "<%= @min_age %>"; APT::Periodic::MaxSize "<%= @max_size %>"; APT::Periodic::Update-Package-Lists "<%= @update %>"; APT::Periodic::Download-Upgradeable-Packages "<%= @download %>"; APT::Periodic::Download-Upgradeable-Packages-Debdelta "<%= @download_delta %>"; APT::Periodic::Unattended-Upgrade "<%= @upgrade %>"; APT::Periodic::AutocleanInterval "<%= @autoclean %>"; APT::Periodic::Verbose "<%= @verbose %>"; puppetlabs-apt-1.4.0/templates/source.list.erb0100644 0000000 0000000 00000000440 12227301662 021376 0ustar00travis0000000 0000000 # <%= @name %> deb <% if @architecture %>[arch=<%= @architecture %>]<% end %><%= @location %> <%= @release_real %> <%= @repos %> <%- if @include_src then -%> deb-src <% if @architecture %>[arch=<%= @architecture %>]<% end %><%= @location %> <%= @release_real %> <%= @repos %> <%- end -%> puppetlabs-apt-1.4.0/templates/50unattended-upgrades.erb0100644 0000000 0000000 00000004256 12227301662 023245 0ustar00travis0000000 0000000 // Automatically upgrade packages from these (origin:archive) pairs Unattended-Upgrade::Allowed-Origins { <% @origins.each do |origin| -%> "<%= origin %>"; <% end -%> }; // List of packages to not update Unattended-Upgrade::Package-Blacklist { <% @blacklist.each do |package| -%> "<%= package %>"; <% end -%> }; // This option allows you to control if on a unclean dpkg exit // unattended-upgrades will automatically run // dpkg --force-confold --configure -a // The default is true, to ensure updates keep getting installed Unattended-Upgrade::AutoFixInterruptedDpkg "<%= @auto_fix %>"; // Split the upgrade into the smallest possible chunks so that // they can be interrupted with SIGUSR1. This makes the upgrade // a bit slower but it has the benefit that shutdown while a upgrade // is running is possible (with a small delay) Unattended-Upgrade::MinimalSteps "<%= @minimal_steps %>"; // Install all unattended-upgrades when the machine is shuting down // instead of doing it in the background while the machine is running // This will (obviously) make shutdown slower Unattended-Upgrade::InstallOnShutdown "<%= @install_on_shutdown %>"; // Send email to this address for problems or packages upgrades // If empty or unset then no email is sent, make sure that you // have a working mail setup on your system. A package that provides // 'mailx' must be installed. <% if @mail_to != "NONE" %>Unattended-Upgrade::Mail "<%= @mail_to %>";<% end %> // Set this value to "true" to get emails only on errors. Default // is to always send a mail if Unattended-Upgrade::Mail is set <% if @mail_to != "NONE" %>Unattended-Upgrade::MailOnlyOnError "<%= @mail_only_on_error %>";<% end %> // Do automatic removal of new unused dependencies after the upgrade // (equivalent to apt-get autoremove) Unattended-Upgrade::Remove-Unused-Dependencies "<%= @remove_unused %>"; // Automatically reboot *WITHOUT CONFIRMATION* if a // the file /var/run/reboot-required is found after the upgrade Unattended-Upgrade::Automatic-Reboot "<%= @auto_reboot %>"; // Use apt bandwidth limit feature, this example limits the download // speed to 70kb/sec <% if @dl_limit != "NONE" %>Acquire::http::Dl-Limit "<%= @dl_limit %>";<% end %> puppetlabs-apt-1.4.0/templates/pin.pref.erb0100644 0000000 0000000 00000001332 12227301662 020646 0ustar00travis0000000 0000000 <%- @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 %> Pin: <%= @pin %> Pin-Priority: <%= @priority %> puppetlabs-apt-1.4.0/LICENSE0100644 0000000 0000000 00000002045 12227301662 015444 0ustar00travis0000000 0000000 Copyright (c) 2011 Evolving Web Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.