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. --- manifests/preferences_snippet.pp | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 manifests/preferences_snippet.pp (limited to 'manifests/preferences_snippet.pp') diff --git a/manifests/preferences_snippet.pp b/manifests/preferences_snippet.pp new file mode 100644 index 0000000..52edf97 --- /dev/null +++ b/manifests/preferences_snippet.pp @@ -0,0 +1,11 @@ +define apt::preferences_snippet( + $ensure => 'present', + $content +){ + file { "/var/lib/puppet/modules/apt/preferences/${name}": + ensure => $ensure, + content => "${content}\n", + notify => Exec['concat_/var/lib/puppet/modules/apt/preferences'], + owner => root, group => 0, mode => 0600; + } +} -- cgit v1.2.3 From 822d482f4d6e94546cb5454d571b4d58525af94b Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 17 Oct 2010 14:13:02 +0200 Subject: improve prefrences snippet --- manifests/preferences_snippet.pp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'manifests/preferences_snippet.pp') diff --git a/manifests/preferences_snippet.pp b/manifests/preferences_snippet.pp index 52edf97..8d82a42 100644 --- a/manifests/preferences_snippet.pp +++ b/manifests/preferences_snippet.pp @@ -1,10 +1,14 @@ define apt::preferences_snippet( - $ensure => 'present', - $content + $ensure = 'present', + $release, + $priority ){ file { "/var/lib/puppet/modules/apt/preferences/${name}": ensure => $ensure, - content => "${content}\n", + content => "Package: ${name} +Pin: release a=${release} +Pin-Priority: ${priority} +", notify => Exec['concat_/var/lib/puppet/modules/apt/preferences'], owner => root, group => 0, mode => 0600; } -- cgit v1.2.3 From b989192dfd5c6604afe6e0562f9d39a7487b6cf4 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 17 Oct 2010 14:27:27 +0200 Subject: fix modules directory stuff --- manifests/module_dir.pp | 3 --- manifests/preferences.pp | 5 +++-- manifests/preferences_snippet.pp | 5 +++-- 3 files changed, 6 insertions(+), 7 deletions(-) delete mode 100644 manifests/module_dir.pp (limited to 'manifests/preferences_snippet.pp') diff --git a/manifests/module_dir.pp b/manifests/module_dir.pp deleted file mode 100644 index 6dcfca3..0000000 --- a/manifests/module_dir.pp +++ /dev/null @@ -1,3 +0,0 @@ -class apt::module_dir { - module_dir{'apt': } -} diff --git a/manifests/preferences.pp b/manifests/preferences.pp index b106153..e806f9f 100644 --- a/manifests/preferences.pp +++ b/manifests/preferences.pp @@ -1,9 +1,10 @@ class apt::preferences { - include apt::module_dir + include common::moduledir + $apt_preferences_dir = "${common::moduledir::module_dir_path}/apt/preferences" module_dir{'apt/preferences': } concatenated_file{'/etc/apt/preferences': - dir => '/var/lib/puppet/modules/apt/preferences', + dir => $apt_preferences_dir, header => 'Package: * Pin: release a=unstable Pin-Priority: 1 diff --git a/manifests/preferences_snippet.pp b/manifests/preferences_snippet.pp index 8d82a42..e5393bd 100644 --- a/manifests/preferences_snippet.pp +++ b/manifests/preferences_snippet.pp @@ -3,13 +3,14 @@ define apt::preferences_snippet( $release, $priority ){ - file { "/var/lib/puppet/modules/apt/preferences/${name}": + include apt::preferences_snippet + file { "${apt::preferences::apt_preferences_dir}/${name}": ensure => $ensure, content => "Package: ${name} Pin: release a=${release} Pin-Priority: ${priority} ", - notify => Exec['concat_/var/lib/puppet/modules/apt/preferences'], + notify => Exec["concat_${apt::preferences::apt_preferences_dir}"], owner => root, group => 0, mode => 0600; } } -- cgit v1.2.3 From 80ad2d086edb86456c3e944f7f440fbaf96cfad3 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 17 Oct 2010 14:29:01 +0200 Subject: fix classname --- manifests/preferences_snippet.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests/preferences_snippet.pp') diff --git a/manifests/preferences_snippet.pp b/manifests/preferences_snippet.pp index e5393bd..71c095b 100644 --- a/manifests/preferences_snippet.pp +++ b/manifests/preferences_snippet.pp @@ -3,7 +3,7 @@ define apt::preferences_snippet( $release, $priority ){ - include apt::preferences_snippet + include apt::preferences file { "${apt::preferences::apt_preferences_dir}/${name}": ensure => $ensure, content => "Package: ${name} -- cgit v1.2.3 From b497ed88efd04852cb4deefacc9b19b9a3f625d6 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 17 Oct 2010 14:40:27 +0200 Subject: empty line between snippets --- manifests/preferences.pp | 1 + manifests/preferences_snippet.pp | 1 + 2 files changed, 2 insertions(+) (limited to 'manifests/preferences_snippet.pp') diff --git a/manifests/preferences.pp b/manifests/preferences.pp index 479e910..232b8f7 100644 --- a/manifests/preferences.pp +++ b/manifests/preferences.pp @@ -11,6 +11,7 @@ Pin-Priority: 1 Package: * Pin: release a=testing Pin-Priority: 2 + ', } diff --git a/manifests/preferences_snippet.pp b/manifests/preferences_snippet.pp index 71c095b..21dfe86 100644 --- a/manifests/preferences_snippet.pp +++ b/manifests/preferences_snippet.pp @@ -9,6 +9,7 @@ define apt::preferences_snippet( content => "Package: ${name} Pin: release a=${release} Pin-Priority: ${priority} + ", notify => Exec["concat_${apt::preferences::apt_preferences_dir}"], owner => root, group => 0, mode => 0600; -- cgit v1.2.3