From 26714ae4d2992c85082ec37e6c40d725d097f79a Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Mon, 25 Oct 2010 11:58:27 -0400 Subject: Include the protocol in the proxy URL The current proxy_client template makes it possible to communicate with the proxy only via HTTP. Add the protocol to the variable so that it's possible to change the protocol. Signed-off-by: Gabriel Filion --- manifests/proxy_client.pp | 2 +- templates/20proxy.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/proxy_client.pp b/manifests/proxy_client.pp index 9883933..23e9bd1 100644 --- a/manifests/proxy_client.pp +++ b/manifests/proxy_client.pp @@ -1,7 +1,7 @@ class apt::proxy_client { $real_apt_proxy = $apt_proxy ? { - "" => "localhost", + "" => "http://localhost", default => $apt_proxy } diff --git a/templates/20proxy.erb b/templates/20proxy.erb index 36b26a0..8f57e73 100644 --- a/templates/20proxy.erb +++ b/templates/20proxy.erb @@ -1,4 +1,4 @@ # This file is brought to you by Puppet # all local modifications will be overwritten -Acquire::http { Proxy "http://<%= real_apt_proxy %>:<%= real_apt_proxy_port %>"; }; +Acquire::http { Proxy "<%= real_apt_proxy %>:<%= real_apt_proxy_port %>"; }; -- cgit v1.2.3 From 4ebb7d463ed6e85a715f0a311378bf673a907042 Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Mon, 25 Oct 2010 12:17:50 -0400 Subject: Fix apt::preferences::absent Currently, setting the $custom_preferences variable to false fails because of the /etc/apt/preferences concatenated_file being re-defined. Fix this by setting dependencies on the resource only when we expect to create the /etc/apt/preferences file. Also, since there is no "ensure" parameter to concatenated_file, use a simple file resource to ensure that it is removed. Signed-off-by: Gabriel Filion --- manifests/init.pp | 6 +++++- manifests/preferences/absent.pp | 5 +---- manifests/preferences_snippet.pp | 4 ++++ manifests/unattended_upgrades.pp | 8 ++++++-- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 8588932..dde9c29 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -96,7 +96,11 @@ class apt { alias => "custom_keys", subscribe => File["${apt_base_dir}/keys.d"], refreshonly => true, - before => Concatenated_file[apt_config]; + } + if $custom_preferences != false { + Exec["custom_keys"] { + before => Concatenated_file[apt_config], + } } } diff --git a/manifests/preferences/absent.pp b/manifests/preferences/absent.pp index 3131aff..d8b2e10 100644 --- a/manifests/preferences/absent.pp +++ b/manifests/preferences/absent.pp @@ -1,8 +1,5 @@ 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, + file {'/etc/apt/preferences': ensure => absent, } } diff --git a/manifests/preferences_snippet.pp b/manifests/preferences_snippet.pp index a723206..9da7a8e 100644 --- a/manifests/preferences_snippet.pp +++ b/manifests/preferences_snippet.pp @@ -4,6 +4,10 @@ define apt::preferences_snippet( $release, $priority ){ + if $custom_preferences == false { + fail("Trying to define a preferences_snippet with \$custom_preferences set to false.") + } + include apt::preferences file { "${apt::preferences::apt_preferences_dir}/${name}": diff --git a/manifests/unattended_upgrades.pp b/manifests/unattended_upgrades.pp index fb04193..f52448d 100644 --- a/manifests/unattended_upgrades.pp +++ b/manifests/unattended_upgrades.pp @@ -7,8 +7,12 @@ class apt::unattended_upgrades { apt_conf { "50unattended-upgrades": source => ["puppet:///modules/site-apt/50unattended-upgrades", "puppet:///modules/apt/50unattended-upgrades" ], - - before => Concatenated_file[apt_config], require => Package['unattended-upgrades'], } + + if $custom_preferences != false { + Apt_conf["50unattended-upgrades"] { + before => Concatenated_file[apt_config], + } + } } -- cgit v1.2.3 From aaf3bd6adb6cf979ce7c18492c3a60fa2b31cba9 Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Mon, 25 Oct 2010 12:32:49 -0400 Subject: Remove $apt_unattended_upgrades Unattended upgrades are not always necessary. Including the apt::unattended_upgrades class through the main apt class is not appropriate. It is better to make nodes include the apt::unattended_upgrades class explicitly. Remove the $apt_unattended_upgrades variable along with the include in the 'apt' class. Signed-off-by: Gabriel Filion --- manifests/init.pp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index dde9c29..9298d1a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -48,14 +48,12 @@ class apt { include apt::preferences::absent } default: { + # When squeeze becomes the stable branch, transform this file's header + # into a preferences.d file include apt::preferences } } - if $apt_unattended_upgrades { - include apt::unattended_upgrades - } - # watch apt.conf.d file { "/etc/apt/apt.conf.d": ensure => directory, checksum => mtime; } -- cgit v1.2.3 From 92aa5a51e95d74604a40318558aa98f70fcf7720 Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Mon, 25 Oct 2010 12:36:59 -0400 Subject: Ensure presence of sources.list.d and watch it Add a file resource on the apt/sources.list.d directory to ensure that it is created as a directory and watch it for modifications to automatically refresh the apt cache. Signed-off-by: Gabriel Filion --- manifests/init.pp | 7 ++++++- manifests/sources_list.pp | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 9298d1a..140d2a6 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -54,8 +54,13 @@ class apt { } } - # watch apt.conf.d + # watch .d directories and ensure they are present file { "/etc/apt/apt.conf.d": ensure => directory, checksum => mtime; } + file { "/etc/apt/sources.list.d": + ensure => directory, + checksum => mtime, + notify => Exec['refresh_apt'], + } exec { # "&& sleep 1" is workaround for older(?) clients diff --git a/manifests/sources_list.pp b/manifests/sources_list.pp index d3f18d5..bbf887a 100644 --- a/manifests/sources_list.pp +++ b/manifests/sources_list.pp @@ -12,7 +12,6 @@ define apt::sources_list ( file { "/etc/apt/sources.list.d/${name}": ensure => $ensure, - notify => Exec['refresh_apt'], owner => root, group => 0, mode => 0600; } -- cgit v1.2.3