diff options
author | Gabriel Filion <lelutin@gmail.com> | 2010-10-25 01:44:04 -0400 |
---|---|---|
committer | Gabriel Filion <lelutin@gmail.com> | 2010-10-25 01:44:04 -0400 |
commit | 27d5808299045ebd6f428e7d8131d11d9ab37712 (patch) | |
tree | 0033743f9f5e243c2e3376d5b4b4f38baba0213d | |
parent | 1b0bc415977c1c8b49390e0cdb1361769e0fdbae (diff) | |
download | puppet-apt-27d5808299045ebd6f428e7d8131d11d9ab37712.tar.gz puppet-apt-27d5808299045ebd6f428e7d8131d11d9ab37712.tar.bz2 |
rename things for easier understanding
remove the use of _snippet in names (except for preferences_snippet) so
that they represent directly a resource name.
rename custom_sources_template to sources_list.
modify sources_list to make it more flexible (gives the opportunity to
provide sources or content). this changes its behaviour in that the name
is now the name of the file in sources.list.d
rename proxy-client to proxy_client to use the same standard for its
name as the other classes.
Signed-off-by: Gabriel Filion <lelutin@gmail.com>
-rw-r--r-- | manifests/apt_conf.pp (renamed from manifests/apt_conf_snippet.pp) | 6 | ||||
-rw-r--r-- | manifests/custom_sources.pp | 7 | ||||
-rw-r--r-- | manifests/init.pp | 9 | ||||
-rw-r--r-- | manifests/proxy_client.pp (renamed from manifests/proxy-client.pp) | 4 | ||||
-rw-r--r-- | manifests/sources_list.pp | 30 | ||||
-rw-r--r-- | manifests/unattended_upgrades.pp | 2 |
6 files changed, 39 insertions, 19 deletions
diff --git a/manifests/apt_conf_snippet.pp b/manifests/apt_conf.pp index c1cd884..62e4377 100644 --- a/manifests/apt_conf_snippet.pp +++ b/manifests/apt_conf.pp @@ -1,13 +1,13 @@ -define apt::apt_conf_snippet( +define apt::apt_conf( $ensure = 'present', $source = '', $content = undef ){ if $source == '' and $content == undef { - fail("One of \$source or \$content must be specified for apt_conf_snippet ${name}") + fail("One of \$source or \$content must be specified for apt_conf ${name}") } if $source != '' and $content != undef { - fail("Only one of \$source or \$content must specified for apt_conf_snippet ${name}") + fail("Only one of \$source or \$content must specified for apt_conf ${name}") } file { "/etc/apt/apt.conf.d/${name}": diff --git a/manifests/custom_sources.pp b/manifests/custom_sources.pp deleted file mode 100644 index c9e0b9c..0000000 --- a/manifests/custom_sources.pp +++ /dev/null @@ -1,7 +0,0 @@ -define apt::custom_sources_template ($sources_file = "") { - file { "/etc/apt/sources.list.d/$sources_file": - content => template($name), - notify => Exec['refresh_apt'] - } -} - diff --git a/manifests/init.pp b/manifests/init.pp index 7d68303..695c193 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -5,8 +5,6 @@ class apt { - import "custom_sources.pp" - # See README $real_apt_clean = $apt_clean ? { '' => 'auto', @@ -21,8 +19,7 @@ class apt { include lsb config_file { # include main, security and backports - # additional sources should be included via the custom_sources_template - # define + # additional sources should be included via the apt::sources_list define "/etc/apt/sources.list": content => $custom_sources_list ? { '' => template( "apt/$operatingsystem/sources.list.erb"), @@ -32,13 +29,13 @@ class apt { } # 01autoremove already present by default - apt_conf_snippet{ "02show_upgraded": + apt_conf { "02show_upgraded": source => ["puppet:///modules/site-apt/${fqdn}/02show_upgraded", "puppet:///modules/site-apt/02show_upgraded", "puppet:///modules/apt/02show_upgraded"] } - apt_conf_snippet{ "03clean": + apt_conf { "03clean": source => ["puppet:///modules/site-apt/${fqdn}/03clean", "puppet:///modules/site-apt/03clean", "puppet:///modules/apt/03clean"] diff --git a/manifests/proxy-client.pp b/manifests/proxy_client.pp index 30bda8a..9883933 100644 --- a/manifests/proxy-client.pp +++ b/manifests/proxy_client.pp @@ -1,4 +1,4 @@ -class apt::proxy-client { +class apt::proxy_client { $real_apt_proxy = $apt_proxy ? { "" => "localhost", @@ -10,7 +10,7 @@ class apt::proxy-client { default => $apt_proxy_port } - apt_conf_snippet { "20proxy": + apt_conf { "20proxy": content => template("apt/20proxy.erb"), } } diff --git a/manifests/sources_list.pp b/manifests/sources_list.pp new file mode 100644 index 0000000..d3f18d5 --- /dev/null +++ b/manifests/sources_list.pp @@ -0,0 +1,30 @@ +define apt::sources_list ( + $ensure = 'present', + $source = '', + $content = undef +) { + if $source == '' and $content == undef { + fail("One of \$source or \$content must be specified for apt_sources_snippet ${name}") + } + if $source != '' and $content != undef { + fail("Only one of \$source or \$content must specified for apt_sources_snippet ${name}") + } + + file { "/etc/apt/sources.list.d/${name}": + ensure => $ensure, + notify => Exec['refresh_apt'], + owner => root, group => 0, mode => 0600; + } + + if $source { + File["/etc/apt/sources.list.d/${name}"] { + source => $source, + } + } + else { + File["/etc/apt/sources.list.d/${name}"] { + content => $content, + } + } +} + diff --git a/manifests/unattended_upgrades.pp b/manifests/unattended_upgrades.pp index 6a0c685..fb04193 100644 --- a/manifests/unattended_upgrades.pp +++ b/manifests/unattended_upgrades.pp @@ -4,7 +4,7 @@ class apt::unattended_upgrades { require => undef, } - apt_conf_snippet { "50unattended-upgrades": + apt_conf { "50unattended-upgrades": source => ["puppet:///modules/site-apt/50unattended-upgrades", "puppet:///modules/apt/50unattended-upgrades" ], |