From 27d5808299045ebd6f428e7d8131d11d9ab37712 Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Mon, 25 Oct 2010 01:44:04 -0400 Subject: 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 --- manifests/apt_conf.pp | 29 +++++++++++++++++++++++++++++ manifests/apt_conf_snippet.pp | 29 ----------------------------- manifests/custom_sources.pp | 7 ------- manifests/init.pp | 9 +++------ manifests/proxy-client.pp | 16 ---------------- manifests/proxy_client.pp | 16 ++++++++++++++++ manifests/sources_list.pp | 30 ++++++++++++++++++++++++++++++ manifests/unattended_upgrades.pp | 2 +- 8 files changed, 79 insertions(+), 59 deletions(-) create mode 100644 manifests/apt_conf.pp delete mode 100644 manifests/apt_conf_snippet.pp delete mode 100644 manifests/custom_sources.pp delete mode 100644 manifests/proxy-client.pp create mode 100644 manifests/proxy_client.pp create mode 100644 manifests/sources_list.pp (limited to 'manifests') diff --git a/manifests/apt_conf.pp b/manifests/apt_conf.pp new file mode 100644 index 0000000..62e4377 --- /dev/null +++ b/manifests/apt_conf.pp @@ -0,0 +1,29 @@ +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 ${name}") + } + if $source != '' and $content != undef { + fail("Only one of \$source or \$content must specified for apt_conf ${name}") + } + + file { "/etc/apt/apt.conf.d/${name}": + ensure => $ensure, + notify => Exec["refresh_apt"], + owner => root, group => 0, mode => 0600; + } + + if $source { + File["/etc/apt/apt.conf.d/${name}"] { + source => $source, + } + } + else { + File["/etc/apt/apt.conf.d/${name}"] { + content => $content, + } + } +} diff --git a/manifests/apt_conf_snippet.pp b/manifests/apt_conf_snippet.pp deleted file mode 100644 index c1cd884..0000000 --- a/manifests/apt_conf_snippet.pp +++ /dev/null @@ -1,29 +0,0 @@ -define apt::apt_conf_snippet( - $ensure = 'present', - $source = '', - $content = undef -){ - if $source == '' and $content == undef { - fail("One of \$source or \$content must be specified for apt_conf_snippet ${name}") - } - if $source != '' and $content != undef { - fail("Only one of \$source or \$content must specified for apt_conf_snippet ${name}") - } - - file { "/etc/apt/apt.conf.d/${name}": - ensure => $ensure, - notify => Exec["refresh_apt"], - owner => root, group => 0, mode => 0600; - } - - if $source { - File["/etc/apt/apt.conf.d/${name}"] { - source => $source, - } - } - else { - File["/etc/apt/apt.conf.d/${name}"] { - content => $content, - } - } -} 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 deleted file mode 100644 index 30bda8a..0000000 --- a/manifests/proxy-client.pp +++ /dev/null @@ -1,16 +0,0 @@ -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 - } - - apt_conf_snippet { "20proxy": - content => template("apt/20proxy.erb"), - } -} diff --git a/manifests/proxy_client.pp b/manifests/proxy_client.pp new file mode 100644 index 0000000..9883933 --- /dev/null +++ b/manifests/proxy_client.pp @@ -0,0 +1,16 @@ +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 + } + + 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" ], -- cgit v1.2.3