summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2010-11-10 10:11:18 +0100
committerintrigeri <intrigeri@boum.org>2010-11-10 10:19:06 +0100
commit2cd9496999af2dd00a203f38c4e1f4393c7f3f62 (patch)
treea74f18ccf51d7f48752b37d3a8f39705972eac05
parentc43bfac6b80489cf789fe448abb3561a6655a969 (diff)
parent5bf01f148d2c2db8523febc0d73591444c5965c9 (diff)
Merge remote branch 'nadir/master'
Conflicts: README manifests/custom_sources.pp manifests/default_preferences.pp manifests/init.pp manifests/unattended_upgrades.pp templates/Debian/sources.list.volatile.erb
-rw-r--r--README24
-rw-r--r--manifests/custom_sources.pp7
-rw-r--r--manifests/default_preferences.pp18
-rw-r--r--manifests/init.pp28
-rw-r--r--manifests/preferences.pp26
-rw-r--r--manifests/preferences/absent.pp8
-rw-r--r--manifests/preferences_snippet.pp17
-rw-r--r--manifests/proxy-client.pp18
-rw-r--r--manifests/unattended_upgrades.pp10
9 files changed, 112 insertions, 44 deletions
diff --git a/README b/README
index 8c32ca4..12ec3fa 100644
--- a/README
+++ b/README
@@ -67,6 +67,10 @@ example, setting the following variable before including this class
will pull in the templates/apt/preferences file:
$custom_preferences = 'template("apt/preferences")'
+Also, if you need the preferences file to be absent, set this variable to false:
+
+$custom_preferences = false
+
$custom_key_dir
---------------
If you have different apt-key files that you want to get added to your
@@ -144,11 +148,27 @@ apt::cron::dist-upgrade
This class sets up cron-apt so that it dist-upgrades the system and
email when upgrades are performed.
+Defines
+=======
+
+apt::preferences_snippet
+------------------------
+
+A way to add pinning information to /etc/apt/preferences
+
+Example:
+
+ apt::preferences_snippet{
+ 'irssi-plugin-otr':
+ release => 'lenny-backports',
+ priority => 999;
+ }
+
Resources
=========
-File[apt_config]
-----------------
+Concatenated_file[apt_config]
+-----------------------------
Use this resource to depend on or add to a completed apt configuration
Exec[apt_updated]
diff --git a/manifests/custom_sources.pp b/manifests/custom_sources.pp
index 31d685a..c9e0b9c 100644
--- a/manifests/custom_sources.pp
+++ b/manifests/custom_sources.pp
@@ -1,10 +1,7 @@
define apt::custom_sources_template ($sources_file = "") {
file { "/etc/apt/sources.list.d/$sources_file":
content => template($name),
+ notify => Exec['refresh_apt']
}
- exec { "/usr/bin/apt-get update":
- subscribe => File["/etc/apt/sources.list.d/$sources_file"],
- refreshonly => true,
- }
- }
+}
diff --git a/manifests/default_preferences.pp b/manifests/default_preferences.pp
deleted file mode 100644
index 165b364..0000000
--- a/manifests/default_preferences.pp
+++ /dev/null
@@ -1,18 +0,0 @@
-class apt::default_preferences {
- case $operatingsystem {
- 'debian': {
- config_file {
- "/etc/apt/preferences":
- content => template("apt/${operatingsystem}/preferences_${codename}.erb"),
- # use File[apt_config] to reference a completed configuration
- # See "The Puppet Semaphor" 2007-06-25 on the puppet-users ML
- alias => apt_config,
- # only update together
- require => File["/etc/apt/sources.list"];
- }
- }
- 'ubuntu': {
- notice('There is no support for default Ubuntu APT preferences')
- }
- }
-}
diff --git a/manifests/init.pp b/manifests/init.pp
index cbdd8d7..1247b45 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -6,7 +6,7 @@
class apt {
import "custom_sources.pp"
-
+
# See README
$real_apt_clean = $apt_clean ? {
'' => 'auto',
@@ -95,15 +95,11 @@ class apt {
}
case $custom_preferences {
- '': {
- include apt::default_preferences
+ false: {
+ include apt::preferences::absent
}
default: {
- config_file { "/etc/apt/preferences":
- content => $custom_preferences,
- alias => "apt_config",
- require => Config_file["/etc/apt/sources.list"];
- }
+ include apt::preferences
}
}
@@ -112,13 +108,13 @@ class apt {
append_if_no_such_line { 'apt-get-show-upgraded':
file => "/etc/apt/apt.conf.d/99from_puppet",
line => "APT::Get::Show-Upgraded true;",
- before => Config_file[apt_config],
+ before => Concatenated_file['/etc/apt/preferences'],
require => Config_file['/etc/apt/apt.conf.d/99from_puppet'],
}
append_if_no_such_line { 'dselect-clean':
file => "/etc/apt/apt.conf.d/99from_puppet",
line => "DSelect::Clean ${real_apt_clean};",
- before => Config_file[apt_config],
+ before => Concatenated_file['/etc/apt/preferences'],
require => Config_file['/etc/apt/apt.conf.d/99from_puppet'],
}
# backward compatibility: upgrade from previous versions of this module.
@@ -145,12 +141,13 @@ class apt {
'refresh_apt':
command => '/usr/bin/apt-get update && sleep 1',
refreshonly => true,
- subscribe => [ File["/etc/apt/apt.conf.d"],
- Config_file["/etc/apt/sources.list"] ];
+ subscribe => [ File['/etc/apt/apt.conf.d'],
+ Config_file['/etc/apt/sources.list'] ];
'update_apt':
command => '/usr/bin/apt-get update && /usr/bin/apt-get autoclean',
- require => [ File["/etc/apt/apt.conf.d"],
- Config_file["/etc/apt/sources.list"] ],
+ require => [ File['/etc/apt/apt.conf.d',
+ '/etc/apt/preferences'],
+ Config_file['/etc/apt/sources.list'] ],
loglevel => info,
# Another Semaphor for all packages to reference
alias => "apt_updated";
@@ -158,6 +155,7 @@ class apt {
## This package should really always be current
package { "debian-archive-keyring": ensure => latest }
+
# backports uses the normal archive key now
package { "debian-backports-keyring": ensure => absent }
@@ -171,7 +169,7 @@ class apt {
alias => "custom_keys",
subscribe => File["${apt_base_dir}/keys.d"],
refreshonly => true,
- before => Config_file[apt_config];
+ before => Concatenated_file[apt_config];
}
}
diff --git a/manifests/preferences.pp b/manifests/preferences.pp
new file mode 100644
index 0000000..4acfdaf
--- /dev/null
+++ b/manifests/preferences.pp
@@ -0,0 +1,26 @@
+class apt::preferences {
+
+ include common::moduledir
+ $apt_preferences_dir = "${common::moduledir::module_dir_path}/apt/preferences"
+ module_dir{'apt/preferences': }
+ file{"${apt_preferences_dir}_header":
+ content => $custom_preferences ? {
+ '' => $operatingsystem ? {
+ 'debian' => template("apt/${operatingsystem}/preferences_${codename}.erb"),
+ 'ubuntu' => '',
+ },
+ default => $custom_preferences
+ },
+ }
+
+ concatenated_file{'/etc/apt/preferences':
+ dir => $apt_preferences_dir,
+ header => "${apt_preferences_dir}_header",
+ # use Concatenated_file[apt_config] to reference a completed configuration
+ # See "The Puppet Semaphor" 2007-06-25 on the puppet-users ML
+ alias => apt_config,
+ # only update together
+ require => File["/etc/apt/sources.list"];
+ }
+
+}
diff --git a/manifests/preferences/absent.pp b/manifests/preferences/absent.pp
new file mode 100644
index 0000000..3131aff
--- /dev/null
+++ b/manifests/preferences/absent.pp
@@ -0,0 +1,8 @@
+class apt::preferences::absent {
+ include common::moduledir
+ $apt_preferences_dir = "${common::moduledir::module_dir_path}/apt/preferences"
+ concatenated_file{'/etc/apt/preferences':
+ dir => $apt_preferences_dir,
+ ensure => absent,
+ }
+}
diff --git a/manifests/preferences_snippet.pp b/manifests/preferences_snippet.pp
new file mode 100644
index 0000000..21dfe86
--- /dev/null
+++ b/manifests/preferences_snippet.pp
@@ -0,0 +1,17 @@
+define apt::preferences_snippet(
+ $ensure = 'present',
+ $release,
+ $priority
+){
+ include apt::preferences
+ file { "${apt::preferences::apt_preferences_dir}/${name}":
+ ensure => $ensure,
+ content => "Package: ${name}
+Pin: release a=${release}
+Pin-Priority: ${priority}
+
+",
+ notify => Exec["concat_${apt::preferences::apt_preferences_dir}"],
+ owner => root, group => 0, mode => 0600;
+ }
+}
diff --git a/manifests/proxy-client.pp b/manifests/proxy-client.pp
new file mode 100644
index 0000000..ea0a29c
--- /dev/null
+++ b/manifests/proxy-client.pp
@@ -0,0 +1,18 @@
+class apt::proxy-client {
+
+ $real_apt_proxy = $apt_proxy ? {
+ "" => "localhost",
+ default => $apt_proxy
+ }
+
+ $real_apt_proxy_port = $apt_proxy_port ? {
+ "" => "3142",
+ default => $apt_proxy_port
+ }
+
+ file { "/etc/apt/apt.conf.d/20proxy":
+ ensure => present,
+ content => "Acquire::http { Proxy \"http://$real_apt_proxy:$real_apt_proxy_port\"; };\n",
+ owner => root, group => 0, mode => 0644;
+ }
+}
diff --git a/manifests/unattended_upgrades.pp b/manifests/unattended_upgrades.pp
index 805b0ed..e1080a0 100644
--- a/manifests/unattended_upgrades.pp
+++ b/manifests/unattended_upgrades.pp
@@ -5,11 +5,13 @@ class apt::unattended_upgrades {
}
config_file {
- "/etc/apt/apt.conf.d/50unattended-upgrades":
- source => ["puppet:///modules/site-apt/50unattended-upgrades",
- "puppet:///modules/apt/50unattended-upgrades" ],
+ "/etc/apt/apt.conf.d/50unattended-upgrades":
+ source => ["puppet:///modules/site-apt/50unattended-upgrades",
+ "puppet:///modules/apt/50unattended-upgrades" ],
- before => Config_file[apt_config],
+ # err: Could not run Puppet configuration client: Could not find dependent Config_file[apt_config] for Config_file[/etc/apt/apt.conf.d/50unattended-upgrades] at /etc/puppet/modules/apt/manifests/unattended_upgrades.pp:14
+
+ #before => Config_file[apt_config],
require => Package['unattended-upgrades'],
}
}