summaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2016-03-16 14:23:08 +0000
committerintrigeri <intrigeri@boum.org>2016-03-16 14:23:08 +0000
commit46b2f3d2e8c9c8646dfd51280c634ce517d795e6 (patch)
treeca4e9d9448b51b075c4c98f752c7281c636e23cb /manifests
parent3630285006d9fb60c5fbecebc976623c37dd1395 (diff)
parent8c8bd7bb1e5cc0f5297db9629ece783452233d1f (diff)
Merge remote-tracking branch 'shared/master' into bugfix/reboot-required-jessie
Diffstat (limited to 'manifests')
-rw-r--r--manifests/apt_conf.pp2
-rw-r--r--manifests/apticron.pp2
-rw-r--r--manifests/dist_upgrade.pp11
-rw-r--r--manifests/dot_d_directories.pp11
-rw-r--r--manifests/init.pp55
-rw-r--r--manifests/key.pp13
-rw-r--r--manifests/key/plain.pp13
-rw-r--r--manifests/listchanges.pp2
-rw-r--r--manifests/params.pp11
-rw-r--r--manifests/preferences.pp4
-rw-r--r--manifests/preferences_snippet.pp3
-rw-r--r--manifests/preseeded_package.pp2
-rw-r--r--manifests/sources_list.pp2
-rw-r--r--manifests/unattended_upgrades.pp13
-rw-r--r--manifests/update.pp12
-rw-r--r--manifests/upgrade_package.pp15
16 files changed, 90 insertions, 81 deletions
diff --git a/manifests/apt_conf.pp b/manifests/apt_conf.pp
index f446c69..949f615 100644
--- a/manifests/apt_conf.pp
+++ b/manifests/apt_conf.pp
@@ -38,7 +38,7 @@ define apt::apt_conf(
if $refresh_apt {
File["/etc/apt/apt.conf.d/${name}"] {
- notify => Exec['refresh_apt'],
+ notify => Exec['apt_updated'],
}
}
diff --git a/manifests/apticron.pp b/manifests/apticron.pp
index 54d7b71..9c94f9c 100644
--- a/manifests/apticron.pp
+++ b/manifests/apticron.pp
@@ -1,6 +1,6 @@
class apt::apticron(
$ensure_version = 'installed',
- $config = "apt/${::operatingsystem}/apticron_${::lsbdistcodename}.erb",
+ $config = "apt/${::operatingsystem}/apticron_${::debian_codename}.erb",
$email = 'root',
$diff_only = '1',
$listchanges_profile = 'apticron',
diff --git a/manifests/dist_upgrade.pp b/manifests/dist_upgrade.pp
index bf78dcc..19c031e 100644
--- a/manifests/dist_upgrade.pp
+++ b/manifests/dist_upgrade.pp
@@ -1,18 +1,9 @@
class apt::dist_upgrade {
- 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',
refreshonly => true,
- require => $req
+ before => Exec['apt_updated']
}
}
diff --git a/manifests/dot_d_directories.pp b/manifests/dot_d_directories.pp
index 37c3fc8..0ace863 100644
--- a/manifests/dot_d_directories.pp
+++ b/manifests/dot_d_directories.pp
@@ -5,18 +5,11 @@ class apt::dot_d_directories {
'/etc/apt/apt.conf.d':
ensure => directory,
checksum => mtime,
- notify => Exec['refresh_apt'];
+ notify => Exec['apt_updated'];
'/etc/apt/sources.list.d':
ensure => directory,
checksum => mtime,
- notify => Exec['refresh_apt'];
- }
-
- exec {
- # "&& sleep 1" is workaround for older(?) clients
- 'refresh_apt':
- command => '/usr/bin/apt-get update && sleep 1',
- refreshonly => true,
+ notify => Exec['apt_updated'];
}
}
diff --git a/manifests/init.pp b/manifests/init.pp
index 062be4c..4c44af2 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -4,7 +4,6 @@
# See LICENSE for the full license granted to you.
class apt(
- $codename = $apt::params::codename,
$use_lts = $apt::params::use_lts,
$use_volatile = $apt::params::use_volatile,
$use_backports = $apt::params::use_backports,
@@ -19,7 +18,6 @@ class apt(
$repos = $apt::params::repos,
$custom_preferences = $apt::params::custom_preferences,
$custom_sources_list = '',
- $disable_update = $apt::params::disable_update,
$custom_key_dir = $apt::params::custom_key_dir
) inherits apt::params {
case $::operatingsystem {
@@ -42,32 +40,16 @@ class apt(
require => undef,
}
- include lsb
-
- # 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: {
- $release = debian_release($codename)
- }
- }
- $release_version = debian_release_version($codename)
- $next_codename = debian_nextcodename($codename)
- $next_release = debian_nextrelease($release)
-
$sources_content = $custom_sources_list ? {
'' => template( "apt/${::operatingsystem}/sources.list.erb"),
default => $custom_sources_list
}
file {
- # include main, security and backports
+ # include main and security
# additional sources should be included via the apt::sources_list define
'/etc/apt/sources.list':
content => $sources_content,
- require => Package['lsb'],
- notify => Exec['refresh_apt'],
+ notify => Exec['apt_updated'],
owner => root,
group => 0,
mode => '0644';
@@ -114,6 +96,19 @@ class apt(
# backports uses the normal archive key now
package { 'debian-backports-keyring': ensure => absent }
+ if ($use_backports and !($::debian_release in ['testing', 'unstable', 'experimental'])) {
+ apt::sources_list {
+ 'backports':
+ content => "deb $backports_url ${::debian_codename}-backports ${apt::real_repos}",
+ }
+ if $include_src {
+ apt::sources_list {
+ 'backports-src':
+ content => "deb-src $backports_url ${::debian_codename}-backports ${apt::real_repos}",
+ }
+ }
+ }
+
include common::moduledir
common::module_dir { 'apt': }
$apt_base_dir = "${common::moduledir::module_dir_path}/apt"
@@ -127,21 +122,29 @@ class apt(
mode => '0755',
}
exec { 'custom_keys':
- command => "find ${apt_base_dir}/keys.d -type f -exec apt-key add '{}' \\; && /usr/bin/apt-get update",
+ command => "find ${apt_base_dir}/keys.d -type f -exec apt-key add '{}' \\;",
subscribe => File["${apt_base_dir}/keys.d"],
refreshonly => true,
+ notify => Exec[refresh_apt]
}
if $custom_preferences != false {
Exec['custom_keys'] {
- before => [ Exec[refresh_apt], File['apt_config'] ]
- }
- } else {
- Exec['custom_keys'] {
- before => Exec[refresh_apt]
+ before => File['apt_config']
}
}
}
# workaround for preseeded_package component
file { [ '/var/cache', '/var/cache/local', '/var/cache/local/preseeding' ]: ensure => directory }
+
+ exec { 'update_apt':
+ command => '/usr/bin/apt-get update',
+ require => [
+ File['/etc/apt/apt.conf.d', '/etc/apt/preferences' ],
+ File['/etc/apt/sources.list'] ],
+ refreshonly => true,
+ # Another Semaphor for all packages to reference
+ alias => [ 'apt_updated', 'refresh_apt']
+ }
+
}
diff --git a/manifests/key.pp b/manifests/key.pp
new file mode 100644
index 0000000..cb70ec6
--- /dev/null
+++ b/manifests/key.pp
@@ -0,0 +1,13 @@
+define apt::key ($source, $ensure = 'present') {
+ validate_re(
+ $name, '\.gpg$',
+ 'An apt::key resource name must have the .gpg extension',
+ )
+
+ file {
+ "/etc/apt/trusted.gpg.d/${name}":
+ ensure => $ensure,
+ source => $source,
+ notify => Exec['apt_updated'],
+ }
+}
diff --git a/manifests/key/plain.pp b/manifests/key/plain.pp
new file mode 100644
index 0000000..dff8b51
--- /dev/null
+++ b/manifests/key/plain.pp
@@ -0,0 +1,13 @@
+define apt::key::plain ($source) {
+ file {
+ "${apt::apt_base_dir}/keys/${name}":
+ source => $source;
+ "${apt::apt_base_dir}/keys":
+ ensure => directory;
+ }
+ exec { "apt-key add '${apt::apt_base_dir}/keys/${name}'":
+ subscribe => File["${apt::apt_base_dir}/keys/${name}"],
+ refreshonly => true,
+ notify => Exec['apt_updated'],
+ }
+}
diff --git a/manifests/listchanges.pp b/manifests/listchanges.pp
index 0c163ae..e64bb1b 100644
--- a/manifests/listchanges.pp
+++ b/manifests/listchanges.pp
@@ -1,6 +1,6 @@
class apt::listchanges(
$ensure_version = 'installed',
- $config = "apt/${::operatingsystem}/listchanges_${::lsbdistcodename}.erb",
+ $config = "apt/${::operatingsystem}/listchanges_${::debian_codename}.erb",
$frontend = 'mail',
$email = 'root',
$confirm = '0',
diff --git a/manifests/params.pp b/manifests/params.pp
index a1c7392..28af06e 100644
--- a/manifests/params.pp
+++ b/manifests/params.pp
@@ -1,5 +1,4 @@
class apt::params () {
- $codename = $::lsbdistcodename
$use_lts = false
$use_volatile = false
$use_backports = true
@@ -7,15 +6,17 @@ class apt::params () {
$use_next_release = false
$debian_url = 'http://httpredir.debian.org/debian/'
$security_url = 'http://security.debian.org/'
- $backports_url = $::lsbdistcodename ? {
+ $ubuntu_url = 'http://archive.ubuntu.com/ubuntu'
+ $backports_url = $::debian_codename ? {
'squeeze' => 'http://backports.debian.org/debian-backports/',
- default => $debian_url
+ default => $::operatingsystem ? {
+ 'Ubuntu' => $ubuntu_url,
+ default => $debian_url,
+ }
}
$lts_url = $debian_url
$volatile_url = 'http://volatile.debian.org/debian-volatile/'
- $ubuntu_url = 'http://archive.ubuntu.com/ubuntu'
$repos = 'auto'
$custom_preferences = ''
- $disable_update = false
$custom_key_dir = false
}
diff --git a/manifests/preferences.pp b/manifests/preferences.pp
index 9ed24c1..6982ca0 100644
--- a/manifests/preferences.pp
+++ b/manifests/preferences.pp
@@ -2,8 +2,8 @@ class apt::preferences {
$pref_contents = $apt::custom_preferences ? {
'' => $::operatingsystem ? {
- 'debian' => template("apt/${::operatingsystem}/preferences_${apt::codename}.erb"),
- 'ubuntu' => template("apt/${::operatingsystem}/preferences_${apt::codename}.erb"),
+ 'debian' => template("apt/${::operatingsystem}/preferences_${::debian_codename}.erb"),
+ 'ubuntu' => template("apt/${::operatingsystem}/preferences_${::ubuntu_codename}.erb"),
},
default => $apt::custom_preferences
}
diff --git a/manifests/preferences_snippet.pp b/manifests/preferences_snippet.pp
index 0c7b7bb..b7dba0d 100644
--- a/manifests/preferences_snippet.pp
+++ b/manifests/preferences_snippet.pp
@@ -31,7 +31,8 @@ define apt::preferences_snippet (
file { "/etc/apt/preferences.d/${name}":
ensure => $ensure,
- owner => root, group => 0, mode => '0644';
+ owner => root, group => 0, mode => '0644',
+ before => Exec['apt_updated'];
}
case $source {
diff --git a/manifests/preseeded_package.pp b/manifests/preseeded_package.pp
index 9bca8b1..3ef0687 100644
--- a/manifests/preseeded_package.pp
+++ b/manifests/preseeded_package.pp
@@ -4,7 +4,7 @@ define apt::preseeded_package (
) {
$seedfile = "/var/cache/local/preseeding/${name}.seeds"
$real_content = $content ? {
- '' => template ( "site_apt/${::lsbdistcodename}/${name}.seeds" ),
+ '' => template ( "site_apt/${::debian_codename}/${name}.seeds" ),
default => $content
}
diff --git a/manifests/sources_list.pp b/manifests/sources_list.pp
index aefad2d..0ee068d 100644
--- a/manifests/sources_list.pp
+++ b/manifests/sources_list.pp
@@ -23,7 +23,7 @@ define apt::sources_list (
file { "/etc/apt/sources.list.d/${realname}.list":
ensure => $ensure,
owner => root, group => 0, mode => '0644',
- notify => Exec['refresh_apt'],
+ notify => Exec['apt_updated'],
}
if $source {
diff --git a/manifests/unattended_upgrades.pp b/manifests/unattended_upgrades.pp
index 6cb0518..52d7542 100644
--- a/manifests/unattended_upgrades.pp
+++ b/manifests/unattended_upgrades.pp
@@ -1,5 +1,6 @@
class apt::unattended_upgrades (
$config_content = undef,
+ $config_template = 'apt/50unattended-upgrades.erb',
$mailonlyonerror = true,
$mail_recipient = 'root',
$blacklisted_packages = [],
@@ -10,8 +11,18 @@ class apt::unattended_upgrades (
ensure => $ensure_version
}
+ # For some reason, this directory is sometimes absent, which causes
+ # unattended-upgrades to crash.
+ file { '/var/log/unattended-upgrades':
+ ensure => directory,
+ owner => 'root',
+ group => 0,
+ mode => '0755',
+ require => Package['unattended-upgrades'],
+ }
+
$file_content = $config_content ? {
- undef => template('apt/50unattended-upgrades.erb'),
+ undef => template($config_template),
default => $config_content
}
diff --git a/manifests/update.pp b/manifests/update.pp
index 3f45125..dde8320 100644
--- a/manifests/update.pp
+++ b/manifests/update.pp
@@ -1,13 +1,7 @@
-class apt::update {
+class apt::update inherits ::apt {
- exec { 'update_apt':
- command => '/usr/bin/apt-get update && /usr/bin/apt-get autoclean',
- 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'
+ Exec['update_apt'] {
+ refreshonly => false
}
}
diff --git a/manifests/upgrade_package.pp b/manifests/upgrade_package.pp
index d607150..30572c9 100644
--- a/manifests/upgrade_package.pp
+++ b/manifests/upgrade_package.pp
@@ -2,10 +2,6 @@ define apt::upgrade_package (
$version = ''
) {
- if $apt::disable_update == false {
- include apt::update
- }
-
$version_suffix = $version ? {
'' => '',
'latest' => '',
@@ -26,17 +22,10 @@ define apt::upgrade_package (
}
}
- $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 => $req
+ require => Package['apt-show-versions', 'dctrl-tools'],
+ before => Exec['apt_updated']
}
}