aboutsummaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-01-18 10:51:59 -0200
committerSilvio Rhatto <rhatto@riseup.net>2013-01-18 10:51:59 -0200
commitc2219fa645251599b797b2574e6a68212d676f66 (patch)
treeb2b5cb63bee1abc3f2ae31b81cd417b292355b6c /manifests
parent8bfd579a82b6f824b0184bb2e33a384254426eec (diff)
parent14670466be5eceba043e697d5f6f0f0ada9d5b07 (diff)
downloadpuppet-apt-c2219fa645251599b797b2574e6a68212d676f66.tar.gz
puppet-apt-c2219fa645251599b797b2574e6a68212d676f66.tar.bz2
Merge branch 'master' of git://labs.riseup.net/shared-apt
Conflicts: templates/Ubuntu/sources.list.erb
Diffstat (limited to 'manifests')
-rw-r--r--manifests/apt_conf.pp6
-rw-r--r--manifests/apticron.pp74
-rw-r--r--manifests/cron/base.pp2
-rw-r--r--manifests/cron/dist_upgrade.pp18
-rw-r--r--manifests/cron/download.pp18
-rw-r--r--manifests/dist_upgrade.pp13
-rw-r--r--manifests/dist_upgrade/initiator.pp10
-rw-r--r--manifests/dot_d_directories.pp14
-rw-r--r--manifests/dselect.pp8
-rw-r--r--manifests/init.pp158
-rw-r--r--manifests/listchanges.pp53
-rw-r--r--manifests/preferences.pp24
-rw-r--r--manifests/preferences/absent.pp1
-rw-r--r--manifests/preferences_snippet.pp30
-rw-r--r--manifests/preseeded_package.pp25
-rw-r--r--manifests/proxy_client.pp19
-rw-r--r--manifests/reboot_required_notify.pp2
-rw-r--r--manifests/sources_list.pp18
-rw-r--r--manifests/unattended_upgrades.pp19
-rw-r--r--manifests/update.pp7
-rw-r--r--manifests/upgrade_package.pp27
21 files changed, 249 insertions, 297 deletions
diff --git a/manifests/apt_conf.pp b/manifests/apt_conf.pp
index fe07546..d78fb9b 100644
--- a/manifests/apt_conf.pp
+++ b/manifests/apt_conf.pp
@@ -19,8 +19,10 @@ define apt::apt_conf(
# apparently doesn't.
file { "/etc/apt/apt.conf.d/${name}":
ensure => $ensure,
- owner => root, group => 0, mode => 0644,
- notify => Exec["refresh_apt"],
+ owner => root,
+ group => 0,
+ mode => '0644',
+ notify => Exec['refresh_apt'],
}
if $source {
diff --git a/manifests/apticron.pp b/manifests/apticron.pp
index 2fe8e44..54d7b71 100644
--- a/manifests/apticron.pp
+++ b/manifests/apticron.pp
@@ -1,54 +1,24 @@
-class apt::apticron {
-
- case $apticron_ensure_version {
- '': { $apticron_ensure_version = "present" }
- }
-
- case $apticron_config {
- '': { $apticron_config = "apt/${operatingsystem}/apticron_${lsbdistcodename}.erb" }
- }
-
- case $apticron_email {
- '': { $apticron_email = "root" }
- }
-
- case $apticron_diff_only {
- '': { $apticron_diff_only = "1" }
- }
-
- case $apticron_listchanges_profile {
- '': { $apticron_listchanges_profile = "apticron" }
- }
-
- case $apticron_system {
- '': { $apticron_system = false }
- }
-
- case $apticron_ipaddressnum {
- '': { $apticron_ipaddressnum = false }
- }
-
- case $apticron_ipaddresses {
- '': { $apticron_ipaddresses = false }
- }
-
- case $apticron_notifyholds {
- '': { $apticron_notifyholds = "0" }
- }
-
- case $apticron_notifynew {
- '': { $apticron_notifynew = "0" }
- }
-
- case $apticron_customsubject {
- '': { $apticron_customsubject = "" }
- }
-
- package { apticron: ensure => $apticron_ensure_version }
-
- file { "/etc/apticron/apticron.conf":
- content => template($apticron_config),
- mode => 0644, owner => root, group => root,
- require => Package["apticron"];
+class apt::apticron(
+ $ensure_version = 'installed',
+ $config = "apt/${::operatingsystem}/apticron_${::lsbdistcodename}.erb",
+ $email = 'root',
+ $diff_only = '1',
+ $listchanges_profile = 'apticron',
+ $system = false,
+ $ipaddressnum = false,
+ $ipaddresses = false,
+ $notifyholds = '0',
+ $notifynew = '0',
+ $customsubject = ''
+) {
+
+ package { 'apticron': ensure => $ensure_version }
+
+ file { '/etc/apticron/apticron.conf':
+ content => template($apt::apticron::config),
+ owner => root,
+ group => root,
+ mode => '0644',
+ require => Package['apticron'];
}
}
diff --git a/manifests/cron/base.pp b/manifests/cron/base.pp
index 7ccfce6..39fc306 100644
--- a/manifests/cron/base.pp
+++ b/manifests/cron/base.pp
@@ -1,6 +1,6 @@
class apt::cron::base {
- package { cron-apt: ensure => installed }
+ package { 'cron-apt': ensure => installed }
case $apt_cron_hours {
'': {}
diff --git a/manifests/cron/dist_upgrade.pp b/manifests/cron/dist_upgrade.pp
index 1c8adb1..74403bb 100644
--- a/manifests/cron/dist_upgrade.pp
+++ b/manifests/cron/dist_upgrade.pp
@@ -4,20 +4,26 @@ class apt::cron::dist_upgrade inherits apt::cron::base {
dist-upgrade -y -o APT::Get::Show-Upgraded=true -o 'DPkg::Options::=--force-confold'
"
- file { "/etc/cron-apt/action.d/3-download":
+ file { '/etc/cron-apt/action.d/3-download':
ensure => absent,
}
- package { "apt-listbugs": ensure => absent }
+ package { 'apt-listbugs': ensure => absent }
- config_file { "/etc/cron-apt/action.d/4-dist-upgrade":
+ file { '/etc/cron-apt/action.d/4-dist-upgrade':
content => $action,
- require => Package[cron-apt]
+ owner => root,
+ group => 0,
+ mode => '0644',
+ require => Package[cron-apt];
}
- config_file { "/etc/cron-apt/config.d/MAILON":
+ file { '/etc/cron-apt/config.d/MAILON':
content => "MAILON=upgrade\n",
- require => Package[cron-apt]
+ owner => root,
+ group => 0,
+ mode => '0644',
+ require => Package[cron-apt];
}
}
diff --git a/manifests/cron/download.pp b/manifests/cron/download.pp
index a27967d..4a19fec 100644
--- a/manifests/cron/download.pp
+++ b/manifests/cron/download.pp
@@ -3,19 +3,25 @@ class apt::cron::download inherits apt::cron::base {
$action = "autoclean -y
dist-upgrade -d -y -o APT::Get::Show-Upgraded=true
"
-
- file { "/etc/cron-apt/action.d/4-dist-upgrade":
+
+ file { '/etc/cron-apt/action.d/4-dist-upgrade':
ensure => absent,
}
- config_file { "/etc/cron-apt/action.d/3-download":
+ file { '/etc/cron-apt/action.d/3-download':
content => $action,
- require => Package[cron-apt]
+ require => Package[cron-apt],
+ owner => root,
+ group => 0,
+ mode => '0644';
}
- config_file { "/etc/cron-apt/config.d/MAILON":
+ file { '/etc/cron-apt/config.d/MAILON':
content => "MAILON=changes\n",
- require => Package[cron-apt]
+ require => Package[cron-apt],
+ owner => root,
+ group => 0,
+ mode => '0644';
}
}
diff --git a/manifests/dist_upgrade.pp b/manifests/dist_upgrade.pp
index 9e26769..bf78dcc 100644
--- a/manifests/dist_upgrade.pp
+++ b/manifests/dist_upgrade.pp
@@ -1,11 +1,18 @@
class apt::dist_upgrade {
- include apt::update
+ if $apt::disable_update == false {
+ include apt::update
+ }
+
+ $req = $apt::disable_update ? {
+ true => undef,
+ default => Exec['apt_updated'],
+ }
exec { 'apt_dist-upgrade':
- command => "/usr/bin/apt-get -q -y -o 'DPkg::Options::=--force-confold' dist-upgrade",
+ command => '/usr/bin/apt-get -q -y -o \'DPkg::Options::=--force-confold\' dist-upgrade',
refreshonly => true,
- require => Exec['apt_updated'],
+ require => $req
}
}
diff --git a/manifests/dist_upgrade/initiator.pp b/manifests/dist_upgrade/initiator.pp
index 571cd51..d238988 100644
--- a/manifests/dist_upgrade/initiator.pp
+++ b/manifests/dist_upgrade/initiator.pp
@@ -4,15 +4,15 @@ class apt::dist_upgrade::initiator inherits apt::dist_upgrade {
$initiator_abs = "${apt::apt_base_dir}/${initiator}"
file { 'apt_upgrade_initiator':
- mode => 0644,
+ mode => '0644',
owner => root,
group => 0,
- path => "${initiator_abs}",
+ path => $initiator_abs,
checksum => md5,
source => [
- "puppet:///modules/site_apt/${fqdn}/${initiator}",
- "puppet:///modules/site_apt/${initiator}",
- "puppet:///modules/apt/${initiator}",
+ "puppet:///modules/site_apt/${::fqdn}/${initiator}",
+ "puppet:///modules/site_apt/${initiator}",
+ "puppet:///modules/apt/${initiator}",
],
}
diff --git a/manifests/dot_d_directories.pp b/manifests/dot_d_directories.pp
index 742aad4..37c3fc8 100644
--- a/manifests/dot_d_directories.pp
+++ b/manifests/dot_d_directories.pp
@@ -2,20 +2,20 @@ class apt::dot_d_directories {
# watch .d directories and ensure they are present
file {
- "/etc/apt/apt.conf.d":
- ensure => directory,
+ '/etc/apt/apt.conf.d':
+ ensure => directory,
checksum => mtime,
- notify => Exec['refresh_apt'];
- "/etc/apt/sources.list.d":
- ensure => directory,
+ notify => Exec['refresh_apt'];
+ '/etc/apt/sources.list.d':
+ ensure => directory,
checksum => mtime,
- notify => Exec['refresh_apt'];
+ notify => Exec['refresh_apt'];
}
exec {
# "&& sleep 1" is workaround for older(?) clients
'refresh_apt':
- command => '/usr/bin/apt-get update && sleep 1',
+ command => '/usr/bin/apt-get update && sleep 1',
refreshonly => true,
}
diff --git a/manifests/dselect.pp b/manifests/dselect.pp
index 44f0e19..6feeb9f 100644
--- a/manifests/dselect.pp
+++ b/manifests/dselect.pp
@@ -1,10 +1,10 @@
class apt::dselect {
# suppress annoying help texts of dselect
- line { dselect_expert:
- file => "/etc/dpkg/dselect.cfg",
- line => "expert",
+ line { 'dselect_expert':
+ file => '/etc/dpkg/dselect.cfg',
+ line => 'expert',
}
- package { dselect: ensure => installed }
+ package { 'dselect': ensure => installed }
}
diff --git a/manifests/init.pp b/manifests/init.pp
index 2ae691f..020c1cc 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -3,73 +3,48 @@
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
# See LICENSE for the full license granted to you.
-class apt {
-
- $use_volatile = $apt_volatile_enabled ? {
- '' => false,
- default => $apt_volatile_enabled,
- }
-
- $include_src = $apt_include_src ? {
- '' => false,
- default => $apt_include_src,
- }
-
- $use_next_release = $apt_use_next_release ? {
- '' => false,
- default => $apt_use_next_release,
- }
-
- $debian_url = $apt_debian_url ? {
- '' => 'http://cdn.debian.net/debian/',
- default => "${apt_debian_url}",
- }
- $security_url = $apt_security_url ? {
- '' => 'http://security.debian.org/',
- default => "${apt_security_url}",
- }
- $backports_url = $apt_backports_url ? {
- '' => 'http://backports.debian.org/debian-backports/',
- default => "${apt_backports_url}",
- }
- $volatile_url = $apt_volatile_url ? {
- '' => 'http://volatile.debian.org/debian-volatile/',
- default => "${apt_volatile_url}",
- }
- $ubuntu_url = $apt_ubuntu_url ? {
- '' => 'http://archive.ubuntu.com/ubuntu',
- default => "${apt_ubuntu_url}",
- }
- case $operatingsystem {
+class apt(
+ $codename = $::lsbdistcodename,
+ $use_volatile = false,
+ $include_src = false,
+ $use_next_release = false,
+ $debian_url = 'http://http.debian.net/debian/',
+ $security_url = 'http://security.debian.org/',
+ $backports_url = 'http://backports.debian.org/debian-backports/',
+ $volatile_url = 'http://volatile.debian.org/debian-volatile/',
+ $ubuntu_url = 'http://archive.ubuntu.com/ubuntu',
+ $repos = 'auto',
+ $custom_preferences = '',
+ $disable_update = false
+){
+ case $::operatingsystem {
'debian': {
- $repos = $apt_repos ? {
- '' => 'main contrib non-free',
- default => "${apt_repos}",
+ $real_repos = $repos ? {
+ 'auto' => 'main contrib non-free',
+ default => $repos,
}
}
'ubuntu': {
- $repos = $apt_repos ? {
+ $real_repos = $repos ? {
'' => 'main restricted universe multiverse',
- default => "${apt_repos}",
+ default => $repos,
}
}
}
- package { apt:
- ensure => installed,
+ package { 'apt':
+ ensure => installed,
require => undef,
}
include lsb
- # init $release, $next_release, $codename, $next_codename, $release_version
- case $lsbdistcodename {
- '': {
- $codename = $lsbdistcodename
- $release = $lsbdistrelease
+ # init $release, $next_release, $next_codename, $release_version
+ case $codename {
+ 'n/a': {
+ fail("Unknown lsbdistcodename reported by facter: '$::lsbdistcodename', please fix this by setting this variable in your manifest.")
}
default: {
- $codename = $lsbdistcodename
$release = debian_release($codename)
}
}
@@ -77,40 +52,44 @@ class apt {
$next_codename = debian_nextcodename($codename)
$next_release = debian_nextrelease($release)
- config_file {
+ $sources_content = $::custom_sources_list ? {
+ '' => template( "apt/${::operatingsystem}/sources.list.erb"),
+ default => $::custom_sources_list
+ }
+ file {
# include main, security and backports
# additional sources should be included via the apt::sources_list define
- "/etc/apt/sources.list":
- content => $custom_sources_list ? {
- '' => template( "apt/$operatingsystem/sources.list.erb"),
- default => $custom_sources_list
- },
+ '/etc/apt/sources.list':
+ content => $sources_content,
require => Package['lsb'],
- notify => Exec['refresh_apt'],
+ notify => Exec['refresh_apt'],
+ owner => root,
+ group => 0,
+ mode => '0644';
}
- apt_conf { "02show_upgraded":
- source => [ "puppet:///modules/site_apt/${fqdn}/02show_upgraded",
- "puppet:///modules/site_apt/02show_upgraded",
- "puppet:///modules/apt/02show_upgraded" ]
+ apt_conf { '02show_upgraded':
+ source => [ "puppet:///modules/site_apt/${::fqdn}/02show_upgraded",
+ 'puppet:///modules/site_apt/02show_upgraded',
+ 'puppet:///modules/apt/02show_upgraded' ]
}
- if ( $virtual == "vserver" ) {
- apt_conf { "03clean_vserver":
- source => [ "puppet:///modules/site_apt/${fqdn}/03clean_vserver",
- "puppet:///modules/site_apt/03clean_vserver",
- "puppet:///modules/apt/03clean_vserver" ],
- alias => "03clean";
+ if ( $::virtual == 'vserver' ) {
+ apt_conf { '03clean_vserver':
+ source => [ "puppet:///modules/site_apt/${::fqdn}/03clean_vserver",
+ 'puppet:///modules/site_apt/03clean_vserver',
+ 'puppet:///modules/apt/03clean_vserver' ],
+ alias => '03clean';
}
}
else {
- apt_conf { "03clean":
- source => [ "puppet:///modules/site_apt/${fqdn}/03clean",
- "puppet:///modules/site_apt/03clean",
- "puppet:///modules/apt/03clean" ]
+ apt_conf { '03clean':
+ source => [ "puppet:///modules/site_apt/${::fqdn}/03clean",
+ 'puppet:///modules/site_apt/03clean',
+ 'puppet:///modules/apt/03clean' ]
}
}
-
+
case $custom_preferences {
false: {
include apt::preferences::absent
@@ -122,43 +101,38 @@ class apt {
}
}
- # backward compatibility: upgrade from previous versions of this module.
- file {
- [ "/etc/apt/apt.conf.d/from_puppet", "/etc/apt/apt.conf.d/99from_puppet" ]:
- ensure => 'absent',
- require => [ Apt_conf['02show_upgraded'], Apt_conf['03clean'] ];
- }
-
include apt::dot_d_directories
## This package should really always be current
- package { "debian-archive-keyring": ensure => latest }
+ package { 'debian-archive-keyring': ensure => latest }
# backports uses the normal archive key now
- package { "debian-backports-keyring": ensure => absent }
+ package { 'debian-backports-keyring': ensure => absent }
include common::moduledir
$apt_base_dir = "${common::moduledir::module_dir_path}/apt"
- modules_dir { apt: }
+ modules_dir { 'apt': }
- if $custom_key_dir {
+ if $::custom_key_dir {
file { "${apt_base_dir}/keys.d":
- source => "$custom_key_dir",
+ source => $::custom_key_dir,
recurse => true,
- mode => 0755, owner => root, group => root,
+ owner => root,
+ group => root,
+ mode => '0755',
}
- exec { "custom_keys":
- command => "find ${apt_base_dir}/keys.d -type f -exec apt-key add '{}' \\; && /usr/bin/apt-get update",
- subscribe => File["${apt_base_dir}/keys.d"],
+ exec { 'custom_keys':
+ command => "find ${apt_base_dir}/keys.d -type f -exec apt-key add '{}' \\; && /usr/bin/apt-get update",
+ subscribe => File["${apt_base_dir}/keys.d"],
refreshonly => true,
}
if $custom_preferences != false {
- Exec["custom_keys"] {
- before => Concat[apt_config],
+ Exec['custom_keys'] {
+ before => File['apt_config'],
}
}
}
# workaround for preseeded_package component
- file { [ "/var/cache", "/var/cache/local", "/var/cache/local/preseeding" ]: ensure => directory }
+ file { [ '/var/cache', '/var/cache/local', '/var/cache/local/preseeding' ]: ensure => directory }
}
diff --git a/manifests/listchanges.pp b/manifests/listchanges.pp
index 038d5c9..0c163ae 100644
--- a/manifests/listchanges.pp
+++ b/manifests/listchanges.pp
@@ -1,38 +1,19 @@
-class apt::listchanges {
-
- case $apt_listchanges_version {
- '': { $apt_listchanges_version = "present" }
- }
-
- case $apt_listchanges_config {
- '': { $apt_listchanges_config = "apt/${operatingsystem}/listchanges_${lsbdistcodename}.erb" }
- }
-
- case $apt_listchanges_frontend {
- '': { $apt_listchanges_frontend = "mail" }
- }
-
- case $apt_listchanges_email {
- '': { $apt_listchanges_email = "root" }
- }
-
- case $apt_listchanges_confirm {
- '': { $apt_listchanges_confirm = "0" }
- }
-
- case $apt_listchanges_saveseen {
- '': { $apt_listchanges_saveseen = "/var/lib/apt/listchanges.db" }
- }
-
- case $apt_listchanges_which {
- '': { $apt_listchanges_which = "both" }
- }
-
- package { apt-listchanges: ensure => $apt_listchanges_ensure_version }
-
- file { "/etc/apt/listchanges.conf":
- content => template($apt_listchanges_config),
- mode => 0644, owner => root, group => root,
- require => Package["apt-listchanges"];
+class apt::listchanges(
+ $ensure_version = 'installed',
+ $config = "apt/${::operatingsystem}/listchanges_${::lsbdistcodename}.erb",
+ $frontend = 'mail',
+ $email = 'root',
+ $confirm = '0',
+ $saveseen = '/var/lib/apt/listchanges.db',
+ $which = 'both'
+){
+ package { 'apt-listchanges': ensure => $ensure_version }
+
+ file { '/etc/apt/listchanges.conf':
+ content => template($apt::listchanges::config),
+ owner => root,
+ group => root,
+ mode => '0644',
+ require => Package['apt-listchanges'];
}
}
diff --git a/manifests/preferences.pp b/manifests/preferences.pp
index f188149..9ed24c1 100644
--- a/manifests/preferences.pp
+++ b/manifests/preferences.pp
@@ -1,22 +1,20 @@
class apt::preferences {
- concat::fragment{"apt_preferences_header":
- content => $custom_preferences ? {
- '' => $operatingsystem ? {
- 'debian' => template("apt/${operatingsystem}/preferences_${codename}.erb"),
- 'ubuntu' => template("apt/${operatingsystem}/preferences_${codename}.erb"),
- },
- default => $custom_preferences
+ $pref_contents = $apt::custom_preferences ? {
+ '' => $::operatingsystem ? {
+ 'debian' => template("apt/${::operatingsystem}/preferences_${apt::codename}.erb"),
+ 'ubuntu' => template("apt/${::operatingsystem}/preferences_${apt::codename}.erb"),
},
- order => 00,
- target => '/etc/apt/preferences',
+ default => $apt::custom_preferences
}
- concat{'/etc/apt/preferences':
- alias => apt_config,
+ file { '/etc/apt/preferences':
+ ensure => present,
+ alias => 'apt_config',
# only update together
- require => File["/etc/apt/sources.list"],
- owner => root, group => 0, mode => 0644;
+ content => $pref_contents,
+ require => File['/etc/apt/sources.list'],
+ owner => root, group => 0, mode => '0644';
}
}
diff --git a/manifests/preferences/absent.pp b/manifests/preferences/absent.pp
index 0e96119..f32e030 100644
--- a/manifests/preferences/absent.pp
+++ b/manifests/preferences/absent.pp
@@ -2,5 +2,6 @@ class apt::preferences::absent {
file { '/etc/apt/preferences':
ensure => absent,
+ alias => 'apt_config',
}
}
diff --git a/manifests/preferences_snippet.pp b/manifests/preferences_snippet.pp
index 6a8e6bc..0bff85c 100644
--- a/manifests/preferences_snippet.pp
+++ b/manifests/preferences_snippet.pp
@@ -1,11 +1,11 @@
-define apt::preferences_snippet(
+define apt::preferences_snippet (
+ $priority,
$package = false,
$ensure = 'present',
$source = '',
$release = '',
- $pin = '',
- $priority )
-{
+ $pin = ''
+) {
$real_package = $package ? {
false => $name,
@@ -13,21 +13,19 @@ define apt::preferences_snippet(
}
if $custom_preferences == false {
- fail("Trying to define a preferences_snippet with \$custom_preferences set to false.")
+ fail('Trying to define a preferences_snippet with $custom_preferences set to false.')
}
if !$pin and !$release {
- fail("apt::preferences_snippet requires one of the 'pin' or 'release' argument to be set")
+ fail('apt::preferences_snippet requires one of the \'pin\' or \'release\' argument to be set')
}
if $pin and $release {
- fail("apt::preferences_snippet requires either a 'pin' or 'release' argument, not both")
+ fail('apt::preferences_snippet requires either a \'pin\' or \'release\' argument, not both')
}
- include apt::preferences
-
- concat::fragment{"apt_preference_${name}":
+ file { "/etc/apt/preferences.d/${name}":
ensure => $ensure,
- target => '/etc/apt/preferences',
+ owner => root, group => 0, mode => '0644';
}
# This should really work in the same manner as sources_list and apt_conf
@@ -37,19 +35,19 @@ define apt::preferences_snippet(
'': {
case $release {
'': {
- Concat::Fragment["apt_preference_${name}"]{
- content => template("apt/preferences_snippet.erb")
+ File["/etc/apt/preferences.d/${name}"]{
+ content => template('apt/preferences_snippet.erb')
}
}
default: {
- Concat::Fragment["apt_preference_${name}"]{
- content => template("apt/preferences_snippet_release.erb")
+ File["/etc/apt/preferences.d/${name}"]{
+ content => template('apt/preferences_snippet_release.erb')
}
}
}
}
default: {
- Concat::Fragment["apt_preference_${name}"]{
+ File["/etc/apt/preferences.d/${name}"]{
source => $source
}
}
diff --git a/manifests/preseeded_package.pp b/manifests/preseeded_package.pp
index d831934..9bca8b1 100644
--- a/manifests/preseeded_package.pp
+++ b/manifests/preseeded_package.pp
@@ -1,18 +1,21 @@
-define apt::preseeded_package ($content = "", $ensure = "installed") {
- $seedfile = "/var/cache/local/preseeding/$name.seeds"
- $real_content = $content ? {
- "" => template ( "site_apt/$lsbdistcodename/$name.seeds" ),
+define apt::preseeded_package (
+ $ensure = 'installed',
+ $content = ''
+) {
+ $seedfile = "/var/cache/local/preseeding/${name}.seeds"
+ $real_content = $content ? {
+ '' => template ( "site_apt/${::lsbdistcodename}/${name}.seeds" ),
default => $content
- }
+ }
file { $seedfile:
content => $real_content,
- mode => 0600, owner => root, group => root,
- }
+ mode => '0600', owner => root, group => root,
+ }
package { $name:
- ensure => $ensure,
+ ensure => $ensure,
responsefile => $seedfile,
- require => File[$seedfile],
- }
-}
+ require => File[$seedfile],
+ }
+}
diff --git a/manifests/proxy_client.pp b/manifests/proxy_client.pp
index 23e9bd1..9ba79f2 100644
--- a/manifests/proxy_client.pp
+++ b/manifests/proxy_client.pp
@@ -1,16 +1,9 @@
-class apt::proxy_client {
+class apt::proxy_client(
+ $proxy = 'http://localhost',
+ $port = '3142',
+){
- $real_apt_proxy = $apt_proxy ? {
- "" => "http://localhost",
- default => $apt_proxy
- }
-
- $real_apt_proxy_port = $apt_proxy_port ? {
- "" => "3142",
- default => $apt_proxy_port
- }
-
- apt_conf { "20proxy":
- content => template("apt/20proxy.erb"),
+ apt_conf { '20proxy':
+ content => template('apt/20proxy.erb'),
}
}
diff --git a/manifests/reboot_required_notify.pp b/manifests/reboot_required_notify.pp
index 3603aa2..722e8a5 100644
--- a/manifests/reboot_required_notify.pp
+++ b/manifests/reboot_required_notify.pp
@@ -3,7 +3,7 @@ class apt::reboot_required_notify {
# This package installs the script that created /var/run/reboot-required*.
# This script (/usr/share/update-notifier/notify-reboot-required) is
# triggered e.g. by kernel packages.
- package { update-notifier-common:
+ package { 'update-notifier-common':
ensure => installed,
}
diff --git a/manifests/sources_list.pp b/manifests/sources_list.pp
index 499116d..3367f83 100644
--- a/manifests/sources_list.pp
+++ b/manifests/sources_list.pp
@@ -1,14 +1,16 @@
define apt::sources_list (
$ensure = 'present',
$source = '',
- $content = undef )
-{
+ $content = undef
+) {
- if $source == '' and $content == undef {
- fail("One of \$source or \$content must be specified for apt_sources_snippet ${name}")
- }
- if $source != '' and $content != undef {
- fail("Only one of \$source or \$content must specified for apt_sources_snippet ${name}")
+ if $ensure == 'present' {
+ if $source == '' and $content == undef {
+ fail("One of \$source or \$content must be specified for apt_sources_snippet ${name}")
+ }
+ if $source != '' and $content != undef {
+ fail("Only one of \$source or \$content must specified for apt_sources_snippet ${name}")
+ }
}
include apt::dot_d_directories
@@ -18,7 +20,7 @@ define apt::sources_list (
# apparently doesn't.
file { "/etc/apt/sources.list.d/${name}":
ensure => $ensure,
- owner => root, group => 0, mode => 0644,
+ owner => root, group => 0, mode => '0644',
notify => Exec['refresh_apt'],
}
diff --git a/manifests/unattended_upgrades.pp b/manifests/unattended_upgrades.pp
index 23d9bd7..4f1eb20 100644
--- a/manifests/unattended_upgrades.pp
+++ b/manifests/unattended_upgrades.pp
@@ -1,21 +1,22 @@
class apt::unattended_upgrades {
package { 'unattended-upgrades':
- ensure => present,
+ ensure => present,
require => undef,
}
- apt_conf { "50unattended-upgrades":
- source => ["puppet:///modules/site_apt/$lsbdistcodename/50unattended-upgrades",
- "puppet:///modules/site_apt/50unattended-upgrades",
- "puppet:///modules/apt/$lsbdistcodename/50unattended-upgrades",
- "puppet:///modules/apt/50unattended-upgrades" ],
+ apt_conf { '50unattended-upgrades':
+ source => [
+ "puppet:///modules/site_apt/${::lsbdistcodename}/50unattended-upgrades",
+ 'puppet:///modules/site_apt/50unattended-upgrades',
+ "puppet:///modules/apt/${::lsbdistcodename}/50unattended-upgrades",
+ 'puppet:///modules/apt/50unattended-upgrades' ],
require => Package['unattended-upgrades'],
}
- if $custom_preferences != false {
- Apt_conf["50unattended-upgrades"] {
- before => Concat[apt_config],
+ if $apt::custom_preferences != false {
+ Apt_conf['50unattended-upgrades'] {
+ before => File['apt_config'],
}
}
diff --git a/manifests/update.pp b/manifests/update.pp
index ae992f4..3f45125 100644
--- a/manifests/update.pp
+++ b/manifests/update.pp
@@ -2,11 +2,12 @@ class apt::update {
exec { 'update_apt':
command => '/usr/bin/apt-get update && /usr/bin/apt-get autoclean',
- require => [ File['/etc/apt/apt.conf.d', '/etc/apt/preferences' ],
- Config_file['/etc/apt/sources.list'] ],
+ require => [
+ File['/etc/apt/apt.conf.d', '/etc/apt/preferences' ],
+ File['/etc/apt/sources.list'] ],
loglevel => info,
# Another Semaphor for all packages to reference
- alias => "apt_updated"
+ alias => 'apt_updated'
}
}
diff --git a/manifests/upgrade_package.pp b/manifests/upgrade_package.pp
index 9202624..d607150 100644
--- a/manifests/upgrade_package.pp
+++ b/manifests/upgrade_package.pp
@@ -1,6 +1,10 @@
-define apt::upgrade_package ($version = "") {
+define apt::upgrade_package (
+ $version = ''
+) {
- include apt::update
+ if $apt::disable_update == false {
+ include apt::update
+ }
$version_suffix = $version ? {
'' => '',
@@ -10,24 +14,29 @@ define apt::upgrade_package ($version = "") {
if !defined(Package['apt-show-versions']) {
package { 'apt-show-versions':
- ensure => installed,
+ ensure => installed,
require => undef,
}
}
if !defined(Package['dctrl-tools']) {
package { 'dctrl-tools':
- ensure => installed,
+ ensure => installed,
require => undef,
}
}
+ $req = $apt::disable_update ? {
+ true => Package['apt-show-versions', 'dctrl-tools'],
+ default => [
+ Exec['apt_updated'],
+ Package['apt-show-versions', 'dctrl-tools']
+ ],
+ }
+
exec { "apt-get -q -y -o 'DPkg::Options::=--force-confold' install ${name}${version_suffix}":
- onlyif => [ "grep-status -F Status installed -a -P $name -q", "apt-show-versions -u $name | grep -q upgradeable" ],
- require => [
- Exec['apt_updated'],
- Package['apt-show-versions', 'dctrl-tools'],
- ],
+ onlyif => [ "grep-status -F Status installed -a -P $name -q", "apt-show-versions -u $name | grep -q upgradeable" ],
+ require => $req
}
}