Removed all Zulip duplicate files

This commit is contained in:
Alexander Trost
2016-05-08 15:39:21 +02:00
parent 8dcb9b0513
commit 8a3af4df92
373 changed files with 45 additions and 17907 deletions

View File

@@ -1,4 +1,4 @@
.git
.git/
.gitignore
AUTHORS
LICENSE

View File

@@ -4,6 +4,8 @@
* [**Quay.io**](https://quay.io/repository/galexrt/zulip)
* [**Docker Hub**](https://hub.docker.com/r/galexrt/zulip)
Current Version: `v1.3.11`
***
This is a container image for [Zulip](https://zulip.org) from [Dropbox](https://blogs.dropbox.com/tech/2015/09/open-sourcing-zulip-a-dropbox-hack-week-project/)
@@ -23,9 +25,9 @@ See the [Configuration](https://github.com/Galexrt/docker-zulip/wiki/Configurati
## How to get the container:
### For docker use:
`docker pull quay.io/galexrt/zulip:v1.3.10-1`
`docker pull quay.io/galexrt/zulip:v1.3.11`
or
`docker pull galexrt/zulip:v1.3.10-1`
`docker pull galexrt/zulip:v1.3.11`
### For the latest development image changes use:
`docker pull quay.io/galexrt/zulip:dev`

View File

@@ -1,2 +0,0 @@
---
BUNDLE_WITHOUT: development

View File

@@ -1,5 +0,0 @@
fixtures:
repositories:
"stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git"
symlinks:
"apt": "#{source_dir}"

View File

@@ -1,29 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>puppetlabs</groupId>
<artifactId>ghpublisher</artifactId>
<version>1.0.0</version>
<packaging>puppet-module</packaging>
<name>ghpublisher</name>
<properties>
<forge.login>${env.PUBLISHER_LOGIN}</forge.login>
<forge.password>${env.PUBLISHER_PASSWORD}</forge.password>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.cloudsmith.geppetto</groupId>
<artifactId>forge-maven-plugin</artifactId>
<version>3.2.0</version>
<extensions>true</extensions>
<configuration>
<enablePuppetLintValidation>false</enablePuppetLintValidation>
<cacheLocation>${project.build.directory}/forgeCache</cacheLocation>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -1,18 +0,0 @@
#!/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" deploy

View File

@@ -1,34 +0,0 @@
<settings>
<profiles>
<profile>
<id>cloudsmith</id>
<repositories>
<repository>
<id>cloudsmith</id>
<url>https://am0.cloudsmith.com/nexus/content/repositories/releases/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>cloudsmith</id>
<url>https://am0.cloudsmith.com/nexus/content/repositories/releases/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>cloudsmith</activeProfile>
</activeProfiles>
</settings>

View File

@@ -1,6 +0,0 @@
#!/bin/sh
#
# Perform GitHub publish
MODULES_ROOT=`pwd`
cd $(dirname $0)
mvn -q -s settings.xml -Dforge.modules.root="$MODULES_ROOT" compile

View File

@@ -1,19 +0,0 @@
---
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'

View File

@@ -1,40 +0,0 @@
---
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

View File

@@ -1,183 +0,0 @@
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 <info@puppetlabs.com> - 0.0.4
* Fix ppa list filename when there is a period in the PPA name
* Add .pref extension to apt preferences files
* Allow preferences to be purged
* Extend pin support
2012-05-04 Puppet Labs <info@puppetlabs.com> - 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 <info@puppetlabs.com> - 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 <info@puppetlabs.com> - 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

View File

@@ -1,16 +0,0 @@
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

View File

@@ -1,70 +0,0 @@
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

View File

@@ -1,19 +0,0 @@
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.

View File

@@ -1,14 +0,0 @@
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'

View File

@@ -1,226 +0,0 @@
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 theyre 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 cant 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>

View File

@@ -1,2 +0,0 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'rspec-system/rake_task'

View File

@@ -1,48 +0,0 @@
# 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',
}
}

View File

@@ -1,16 +0,0 @@
# 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'],
}
}

View File

@@ -1,18 +0,0 @@
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',
}
}

View File

@@ -1,21 +0,0 @@
# 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',
}
}

View File

@@ -1,21 +0,0 @@
# 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',
}
}

View File

@@ -1,24 +0,0 @@
# 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,
}
}

View File

@@ -1,121 +0,0 @@
# 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'],
}
}

View File

@@ -1,90 +0,0 @@
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"
}
}
}

View File

@@ -1,33 +0,0 @@
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'
}
}
}
}
}

View File

@@ -1,73 +0,0 @@
# 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'),
}
}

View File

@@ -1,63 +0,0 @@
# 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'],
}
}

View File

@@ -1,17 +0,0 @@
# 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}\";"
}
}

View File

@@ -1,85 +0,0 @@
# 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'],
}
}

View File

@@ -1,68 +0,0 @@
# 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');
}
}

View File

@@ -1,10 +0,0 @@
class apt::update {
include apt::params
exec { 'apt_update':
command => "${apt::params::provider} update",
logoutput => 'on_failure',
refreshonly => true,
timeout => $apt::update_timeout,
}
}

View File

@@ -1,87 +0,0 @@
{
"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"
}

View File

@@ -1,133 +0,0 @@
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

View File

@@ -1,71 +0,0 @@
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

View File

@@ -1,14 +0,0 @@
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

View File

@@ -1,14 +0,0 @@
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

View File

@@ -1,13 +0,0 @@
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

View File

@@ -1,22 +0,0 @@
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

View File

@@ -1,204 +0,0 @@
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

View File

@@ -1,18 +0,0 @@
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

View File

@@ -1,57 +0,0 @@
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

View File

@@ -1,41 +0,0 @@
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

View File

@@ -1,123 +0,0 @@
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

View File

@@ -1,101 +0,0 @@
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

View File

@@ -1,143 +0,0 @@
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

View File

@@ -1,166 +0,0 @@
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

View File

@@ -1 +0,0 @@
require 'puppetlabs_spec_helper/module_spec_helper'

View File

@@ -1,30 +0,0 @@
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

View File

@@ -1,38 +0,0 @@
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

View File

@@ -1,53 +0,0 @@
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

View File

@@ -1,59 +0,0 @@
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

View File

@@ -1,51 +0,0 @@
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

View File

@@ -1,10 +0,0 @@
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

View File

@@ -1,20 +0,0 @@
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

View File

@@ -1,12 +0,0 @@
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 %>";

View File

@@ -1,53 +0,0 @@
// 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 %>

View File

@@ -1,22 +0,0 @@
<%-
@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 %>

View File

@@ -1,5 +0,0 @@
# <%= @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 -%>

View File

@@ -1,2 +0,0 @@
class { 'apt': }
apt::builddep{ 'glusterfs-server': }

View File

@@ -1,2 +0,0 @@
class { 'apt': }
class { 'apt::debian::testing': }

View File

@@ -1,2 +0,0 @@
class { 'apt': }
class { 'apt::debian::unstable': }

View File

@@ -1,7 +0,0 @@
# force.pp
# force a package from a specific release
apt::force { 'package':
release => 'testing',
version => false
}

View File

@@ -1 +0,0 @@
class { 'apt': }

View File

@@ -1,6 +0,0 @@
# 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"',
}

View File

@@ -1 +0,0 @@
include apt::params

View File

@@ -1,5 +0,0 @@
# pin a release in apt, useful for unstable repositories
apt::pin { 'foo':
packages => '*',
priority => 0,
}

View File

@@ -1,4 +0,0 @@
class { 'apt': }
# Example declaration of an Apt PPA
apt::ppa{ 'ppa:openstack-ppa/bleeding-edge': }

View File

@@ -1,4 +0,0 @@
class { 'apt': }
class { 'apt::release':
release_id => 'karmic'
}

View File

@@ -1,29 +0,0 @@
# 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',
}

View File

@@ -1 +0,0 @@
include apt::unattended-upgrades

View File

@@ -1 +0,0 @@
puppet-common/

View File

@@ -1,30 +0,0 @@
puppet module common
====================
written by David Schmitt
Copyright (C) 2007 David Schmitt
<david@schmitt.edv-bus.at>
adapted by immerda project group
admin+puppet(at)immerda.ch
#################################################
The common module installs various functions that are
required by other modules. This module should be
installed before any of the other module.
To use this module, follow these directions:
1. Your modules directory will need all the files
included in this repository placed under a directory
called "common"
2. Add the following line to manifests/site.pp:
import "modules.pp"
3. Add the following line to manifests/modules.pp:
import "common"

View File

@@ -1 +0,0 @@
# A placeholder to nail this directory into git

View File

@@ -1 +0,0 @@
this directory contains various data collected for system wide configurations

View File

@@ -1,16 +0,0 @@
# basename(string) : string
# basename(string[]) : string[]
#
# Returns the last component of the filename given as argument, which must be
# formed using forward slashes (``/..) regardless of the separator used on the
# local file system.
module Puppet::Parser::Functions
newfunction(:basename, :type => :rvalue) do |args|
if args[0].is_a?(Array)
args.collect do |a| File.basename(a) end
else
File.basename(args[0])
end
end
end

View File

@@ -1,16 +0,0 @@
# dirname(string) : string
# dirname(string[]) : string[]
#
# Returns all components of the filename given as argument except the last
# one. The filename must be formed using forward slashes (``/..) regardless of
# the separator used on the local file system.
module Puppet::Parser::Functions
newfunction(:dirname, :type => :rvalue) do |args|
if args[0].is_a?(Array)
args.collect do |a| File.dirname(a) end
else
File.dirname(args[0])
end
end
end

View File

@@ -1,17 +0,0 @@
module Puppet::Parser::Functions
# thin wrapper around the ruby gsub function
# gsub($string, $pattern, $replacement) will replace all occurrences of
# $pattern in $string with $replacement. $string can be either a singel
# value or an array. In the latter case, each element of the array will
# be processed in turn.
newfunction(:gsub, :type => :rvalue) do |args|
if args[0].is_a?(Array)
args[0].collect do |val|
val.gsub(/#{args[1]}/, args[2])
end
else
args[0].gsub(/#{args[1]}/, args[2])
end
end
end

View File

@@ -1,13 +0,0 @@
# get an uniq array of ipaddresses for a hostname
require 'resolv'
module Puppet::Parser::Functions
newfunction(:hostname, :type => :rvalue) do |args|
res = Array.new
Resolv::DNS.new.each_address(args[0]){ |addr|
res << addr
}
res.uniq
end
end

View File

@@ -1,12 +0,0 @@
module Puppet::Parser::Functions
newfunction(:network_lookup, :type => :rvalue) do |args|
case args[0]
when "ip" then
IPSocket::getaddress(lookupvar('fqdn'))
when "netmask" then
"255.255.255.0"
when "gateway" then
IPSocket::getaddress(lookupvar('fqdn')).gsub(/\.\d+$/, '.1')
end
end
end

View File

@@ -1,9 +0,0 @@
# prefix arguments 2..n with first argument
module Puppet::Parser::Functions
newfunction(:prefix_with, :type => :rvalue) do |args|
prefix = args.shift
args.collect {|v| "%s%s" % [prefix, v] }
end
end

View File

@@ -1,7 +0,0 @@
# apply regexp escaping to a string
module Puppet::Parser::Functions
newfunction(:re_escape, :type => :rvalue) do |args|
Regexp.escape(args[0])
end
end

View File

@@ -1,7 +0,0 @@
# escape slashes in a String
module Puppet::Parser::Functions
newfunction(:slash_escape, :type => :rvalue) do |args|
args[0].gsub(/\//, '\\/')
end
end

View File

@@ -1,17 +0,0 @@
# split($string, $delimiter) : $string
# split($string[], $delimiter) : $string[][]
#
# Split the first argument(s) on every $delimiter. $delimiter is interpreted as
# Ruby regular expression.
#
# For long-term portability it is recommended to refrain from using Ruby's
# extended RE features.
module Puppet::Parser::Functions
newfunction(:split, :type => :rvalue) do |args|
if args[0].is_a?(Array)
args.collect do |a| a.split(/#{args[1]}/) end
else
args[0].split(/#{args[1]}/)
end
end
end

View File

@@ -1,20 +0,0 @@
# subsititute($string, $regex, $replacement) : $string
# subsititute($string[], $regex, $replacement) : $string[]
#
# Replace all ocurrences of $regex in $string by $replacement.
# $regex is interpreted as Ruby regular expression.
#
# For long-term portability it is recommended to refrain from using Ruby's
# extended RE features.
module Puppet::Parser::Functions
newfunction(:substitute, :type => :rvalue) do |args|
if args[0].is_a?(Array)
args[0].collect do |val|
val.gsub(/#{args[1]}/, args[2])
end
else
args[0].gsub(/#{args[1]}/, args[2])
end
end
end

View File

@@ -1,19 +0,0 @@
# Returns the content at given URL
module Puppet::Parser::Functions
newfunction(:url_get, :type => :rvalue) do |args|
require 'open-uri'
url = args[0]
begin
data = open(url, :proxy => nil)
# Ignore header
data.readline
data.readline.chomp
rescue OpenURI::HTTPError => error
fail "Fetching URL #{url} failed with status #{error.message}"
end
end
end

View File

@@ -1,8 +0,0 @@
define common::append_if_no_such_line($file, $line, $refreshonly = 'false') {
exec { "/bin/echo '$line' >> '$file'":
unless => "/bin/grep -Fxqe '$line' '$file'",
path => "/bin",
refreshonly => $refreshonly,
subscribe => File[$file],
}
}

View File

@@ -1,41 +0,0 @@
# common/manifests/classes/lsb_release.pp -- request the installation of
# lsb_release to get to lsbdistcodename, which is used throughout the manifests
#
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
# See LICENSE for the full license granted to you.
# Changelog:
# 2007-08-26: micah <micah@riseup.net> reported, that lsb_release can report
# nonsensical values for lsbdistcodename; assert_lsbdistcodename now
# recognises "n/a" and acts accordingly
# This lightweight class only asserts that $lsbdistcodename is set.
# If the assertion fails, an error is printed on the server
#
# To fail individual resources on a missing lsbdistcodename, require
# Exec[assert_lsbdistcodename] on the specific resource
class common::assert_lsbdistcodename {
case $lsbdistcodename {
'': {
err("Please install lsb_release or set facter_lsbdistcodename in the environment of $fqdn")
exec { "false # assert_lsbdistcodename": alias => assert_lsbdistcodename }
}
'n/a': {
case $operatingsystem {
"Debian": {
err("lsb_release was unable to report your distcodename; This seems to indicate a broken apt/sources.list on $fqdn")
}
default: {
err("lsb_release was unable to report your distcodename; please set facter_lsbdistcodename in the environment of $fqdn")
}
}
exec { "false # assert_lsbdistcodename": alias => assert_lsbdistcodename }
}
default: {
exec { "true # assert_lsbdistcodename": alias => assert_lsbdistcodename }
exec { "true # require_lsbdistcodename": alias => require_lsbdistcodename }
}
}
}

View File

@@ -1,71 +0,0 @@
# common/manifests/defines/concatenated_file.pp -- create a file from snippets
# stored in a directory
#
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
# See LICENSE for the full license granted to you.
# TODO:
# * create the directory in _part too
# Usage:
# concatenated_file { "/etc/some.conf":
# dir => "/etc/some.conf.d",
# }
# Use Exec["concat_$name"] as Semaphor
define common::concatenated_file (
# where the snippets are located
$dir = '',
# a file with content to prepend
$header = '',
# a file with content to append
$footer = '',
$mode = 0644, $owner = root, $group = 0
)
{
$dir_real = $dir ? { '' => "${name}.d", default => $dir }
if defined(File[$dir_real]) {
debug("${dir_real} already defined")
} else {
file {
$dir_real:
source => "puppet://$server/common/empty",
checksum => mtime,
ignore => '\.ignore',
recurse => true, purge => true, force => true,
mode => $mode, owner => $owner, group => $group,
notify => Exec["concat_${name}"];
}
}
file {
$name:
ensure => present, checksum => md5,
mode => $mode, owner => $owner, group => $group;
}
# if there is a header or footer file, add it
$additional_cmd = $header ? {
'' => $footer ? {
'' => '',
default => "| cat - '${footer}' "
},
default => $footer ? {
'' => "| cat '${header}' - ",
default => "| cat '${header}' - '${footer}' "
}
}
# use >| to force clobbering the target file
exec { "concat_${name}":
command => "/usr/bin/find ${dir_real} -maxdepth 1 -type f ! -name '*puppettmp' -print0 | sort -z | xargs -0 cat ${additional_cmd} >| ${name}",
refreshonly => true,
subscribe => [ File[$dir_real] ],
before => File[$name],
refreshonly => true,
subscribe => [ File[$dir_real] ],
before => File[$name],
alias => [ "concat_${dir_real}"] ,
}
}

View File

@@ -1,16 +0,0 @@
# Add a snippet called $name to the concatenated_file at $dir.
# The file can be referenced as File["cf_part_${name}"]
define common::concatenated_file_part (
$dir, $content = '', $ensure = present,
$mode = 0644, $owner = root, $group = 0
)
{
file { "${dir}/${name}":
ensure => $ensure, content => $content,
mode => $mode, owner => $owner, group => $group,
alias => "cf_part_${name}",
notify => Exec["concat_${dir}"],
}
}

View File

@@ -1,91 +0,0 @@
# Inspired by David Schmitt's concatenated_file.pp
define common::concatfilepart (
$ensure = present,
$file,
$content = false,
$source = false,
$manage = false
) {
# Resulting file
if defined(File[$file]) {
debug("${file} already defined")
} else {
file {$file:
ensure => present,
}
}
# Directory containing file parts
$dir = "${file}.d"
if defined(File[$dir]) {
debug("${dir} already defined")
} else {
file {$dir:
ensure => directory,
mode => 0600,
source => "puppet:///modules/common/empty/",
recurse => $manage,
purge => $manage,
force => $manage,
ignore => '.ignore',
}
}
if $notify {
if $content {
file {"${dir}/${name}":
ensure => $ensure,
content => $content,
mode => 0600,
notify => [Exec["${file} concatenation"], $notify],
}
} else {
file {"${dir}/${name}":
ensure => $ensure,
source => $source,
mode => 0600,
notify => [Exec["${file} concatenation"], $notify],
}
}
} else {
if $content {
file {"${dir}/${name}":
ensure => $ensure,
content => $content,
mode => 0600,
notify => Exec["${file} concatenation"],
}
} else {
file {"${dir}/${name}":
ensure => $ensure,
source => $source,
mode => 0600,
notify => Exec["${file} concatenation"],
}
}
}
# The actual file generation
if defined(Exec["${file} concatenation"]) {
debug("Blah")
#Exec["${file} concatenation"] {
# require +> File["${dir}/${name}"],
#}
} else {
# use >| to force clobbering the target file
exec { "${file} concatenation":
command => "/usr/bin/find ${dir} -maxdepth 1 -type f ! -name '*puppettmp' -print0 | sort -z | xargs -0 cat >| ${file}",
refreshonly => true,
subscribe => File[$dir],
before => File[$file],
# require => File["${dir}/${name}"],
#alias => [ "concat_${name}", "concat_${dir}"] ,
}
}
}

View File

@@ -1,53 +0,0 @@
# common/manifests/defines/config_file.pp -- create a config file with default permissions
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
# See LICENSE for the full license granted to you.
# Usage:
# config_file { filename:
# content => "....\n",
# }
#
# Examples:
#
# To create the file /etc/vservers/${vs_name}/context with specific
# content:
#
# config_file { "/etc/vservers/${vs_name}/context":
# content => "${context}\n",
# notify => Exec["vs_restart_${vs_name}"],
# require => Exec["vs_create_${vs_name}"];
# }
#
# To create the file /etc/apache2/sites-available/munin-stats with the
# content pulled from a template:
#
# config_file { "/etc/apache2/sites-available/munin-stats":
# content => template("apache/munin-stats"),
# require => Package["apache2"],
# notify => Exec["reload-apache2"]
# }
define config_file ($content = '', $source = '', $ensure = 'present') {
file { $name:
ensure => $ensure,
# keep old versions on the server
backup => server,
# default permissions for config files
mode => 0644, owner => root, group => 0,
# really detect changes to this file
checksum => md5,
}
case $source {
'': { }
default: { File[$name] { source => $source } }
}
case $content {
'': { }
default: { File[$name] { content => $content } }
}
}

View File

@@ -1,42 +0,0 @@
# common/manifests/defines/line.pp -- a trivial mechanism to ensure a line exists in a file
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
# See LICENSE for the full license granted to you.
# Usage:
# line { description:
# file => "filename",
# line => "content",
# ensure => {absent,*present*}
# }
#
# Example:
# The following ensures that the line "allow ^$munin_host$" exists
# in /etc/munin/munin-node.conf, and if there are any changes notify the service for
# a restart
#
# line { allow_munin_host:
# file => "/etc/munin/munin-node.conf",
# line => "allow ^$munin_host$",
# ensure => present,
# notify => Service[munin-node],
# require => Package[munin-node],
# }
#
#
define common::line($file, $line, $ensure = 'present') {
case $ensure {
default : { err ( "unknown ensure value '${ensure}'" ) }
present: {
exec { "/bin/echo '${line}' >> '${file}'":
unless => "/bin/grep -qFx '${line}' '${file}'"
}
}
absent: {
exec { "/usr/bin/perl -ni -e 'print if \$_ ne \"${line}\n\";' '${file}'":
onlyif => "/bin/grep -qFx '${line}' '${file}'"
}
}
}
}

View File

@@ -1,27 +0,0 @@
# common/manifests/defines/modules_dir.pp -- create a default directory
# for storing module specific information
#
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
# See LICENSE for the full license granted to you.
# Usage:
# modules_dir { ["common", "common/dir1", "common/dir2" ]: }
define modules_dir (
$mode = 0644, $owner = root, $group = 0
)
{
$dir = "/var/lib/puppet/modules/${name}"
if defined(File[$dir]) {
debug("${dir} already defined")
} else {
file {
"/var/lib/puppet/modules/${name}":
source => [ "puppet:///modules/${name}/modules_dir", "puppet:///modules/common/empty"],
checksum => mtime,
# ignore the placeholder
ignore => '\.ignore',
recurse => true, purge => true, force => true,
mode => $mode, owner => $owner, group => $group;
}
}
}

View File

@@ -1,24 +0,0 @@
# common/manifests/defines/modules_file.pp -- use a modules_dir to store module
# specific files
#
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
# See LICENSE for the full license granted to you.
# Usage:
# modules_file { "module/file":
# source => "puppet://..",
# mode => 644, # default
# owner => root, # default
# group => root, # default
# }
define common::modules_file (
$source,
$mode = 0644, $owner = root, $group = root
)
{
file {
"/var/lib/puppet/modules/${name}":
source => $source,
mode => $mode, owner => $owner, group => $group;
}
}

View File

@@ -1,30 +0,0 @@
# common/manifests/defines/replace.pp -- replace a pattern in a file with a string
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
# See LICENSE for the full license granted to you.
# Usage:
#
# replace { description:
# file => "filename",
# pattern => "regexp",
# replacement => "replacement"
#
# Example:
# To replace the current port in /etc/munin/munin-node.conf
# with a new port, but only disturbing the file when needed:
#
# replace { set_munin_node_port:
# file => "/etc/munin/munin-node.conf",
# pattern => "^port (?!$port)[0-9]*",
# replacement => "port $port"
# }
define common::replace($file, $pattern, $replacement) {
$pattern_no_slashes = slash_escape($pattern)
$replacement_no_slashes = slash_escape($replacement)
exec { "replace_${pattern}_${file}":
command => "/usr/bin/perl -pi -e 's/${pattern_no_slashes}/${replacement_no_slashes}/' '${file}'",
onlyif => "/usr/bin/perl -ne 'BEGIN { \$ret = 1; } \$ret = 0 if /${pattern_no_slashes}/ && ! /\\Q${replacement_no_slashes}\\E/; END { exit \$ret; }' '${file}'",
alias => "exec_$name",
}
}

View File

@@ -1,4 +0,0 @@
# To fail the complete compilation, include this class
class common::require_lsbdistcodename inherits common::assert_lsbdistcodename {
exec { "false # require_lsbdistcodename": require => Exec[require_lsbdistcodename], }
}

View File

@@ -1,19 +0,0 @@
import "../manifests/concatfilepart.pp"
common::concatfilepart{"0_header":
ensure => present,
content => "A",
file => "/tmp/test-concat.txt",
}
common::concatfilepart{"1_body":
ensure => present,
content => "B",
file => "/tmp/test-concat.txt",
}
common::concatfilepart{"9_footer":
ensure => present,
content => "C",
file => "/tmp/test-concat.txt",
}

View File

@@ -1,19 +0,0 @@
import "../manifests/concatfilepart.pp"
common::concatfilepart{"0_header":
ensure => absent,
content => "A",
file => "/tmp/test-concat.txt",
}
common::concatfilepart{"1_body":
ensure => present,
content => "B",
file => "/tmp/test-concat.txt",
}
common::concatfilepart{"9_footer":
ensure => present,
content => "C",
file => "/tmp/test-concat.txt",
}

View File

@@ -1,19 +0,0 @@
import "../manifests/concatfilepart.pp"
common::concatfilepart{"0_blah":
ensure => present,
content => "Z",
file => "/tmp/test-concat.txt",
}
common::concatfilepart{"1_body":
ensure => present,
content => "B",
file => "/tmp/test-concat.txt",
}
common::concatfilepart{"9_footer":
ensure => present,
content => "C",
file => "/tmp/test-concat.txt",
}

Some files were not shown because too many files have changed in this diff Show More