From 4d28e6668f0c26d7484198c1cdf418c83898b3c7 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 17 Oct 2010 13:58:59 +0200 Subject: introduce preferences snippet Now, we have the possibility to externally add snippes, so that we can preferences for packages that are for example only in backports or unstable. --- README | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'README') diff --git a/README b/README index e624bba..b52a024 100644 --- a/README +++ b/README @@ -50,17 +50,6 @@ following variable before including this class will pull in the templates/apt/sources.list file: $custom_sources_list ='template("apt/sources.list")' -$custom_preferences --------------------- -By default this module will use a basic apt/preferences file with -unstable and testing pinned to very low values so that any package -installation will not accidentally pull in packages from those suites -unless you explicitly specify the version number. You can set this -variable to pull in a customized apt/preferences template, for -example, setting the following variable before including this class -will pull in the templates/apt/preferences file: -$custom_preferences = 'template("apt/preferences")' - $custom_key_dir --------------- If you have different apt-key files that you want to get added to your @@ -81,6 +70,14 @@ Classes This module contains only the apt class, which sets up all described functionality. +Defines +======= + +apt::preferences_snippet +------------------------ + +A way to add pinning information to /etc/apt/preferences + Resources ========= -- cgit v1.2.3 From 9d1a018eedee3f65e2651cd1e3bdd9da5ae5518d Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 17 Oct 2010 14:43:06 +0200 Subject: improve example --- README | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'README') diff --git a/README b/README index b52a024..5f8225a 100644 --- a/README +++ b/README @@ -78,6 +78,13 @@ 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 ========= -- cgit v1.2.3 From e19c94dcd20c966143c933e22d5a63f350649b6e Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 17 Oct 2010 15:18:08 +0200 Subject: minor improvements, especially do not refresh apt every run --- README | 4 ++-- manifests/init.pp | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'README') diff --git a/README b/README index 5f8225a..833008e 100644 --- a/README +++ b/README @@ -89,8 +89,8 @@ Example: 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/init.pp b/manifests/init.pp index 12096a0..675c78d 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -46,13 +46,13 @@ class apt { 'refresh_apt': command => '/usr/bin/apt-get update && sleep 1', refreshonly => true, - subscribe => [ File["/etc/apt/sources.list"], - File["/etc/apt/apt.conf.d"], - Concatenated_file[apt_config] ]; + subscribe => File['/etc/apt/sources.list', + '/etc/apt/apt.conf.d', + '/etc/apt/preferences']; 'update_apt': command => '/usr/bin/apt-get update && /usr/bin/apt-get autoclean', - require => [ File["/etc/apt/sources.list"], - File["/etc/apt/preferences"], Concatenated_file[apt_config] ], + require => File['/etc/apt/sources.list', + '/etc/apt/preferences'], loglevel => info, # Another Semaphor for all packages to reference alias => apt_updated; -- cgit v1.2.3 From 4dbcd092817708292de6463777b331c8dbc7e727 Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Mon, 18 Oct 2010 01:45:22 -0400 Subject: Make it possible to ensure preferences is absent The current code makes it mandatory to have a file /etc/apt/preferences present. In the event that this file is empty or contains a space, apt-get update cannot execute. Add a case with the special value "false" that ensures the file does not exist. Signed-off-by: Gabriel Filion --- README | 4 ++++ manifests/init.pp | 6 ++++++ 2 files changed, 10 insertions(+) (limited to 'README') diff --git a/README b/README index 131ae1d..dbcf383 100644 --- a/README +++ b/README @@ -62,6 +62,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 diff --git a/manifests/init.pp b/manifests/init.pp index 57a685c..60c95a1 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -40,6 +40,12 @@ class apt { '': { include apt::default_preferences } + false: { + config_file { "/etc/apt/preferences": + alias => "apt_config", + ensure => absent; + } + } default: { config_file { "/etc/apt/preferences": content => $custom_preferences, -- cgit v1.2.3