Code Review
/
puppet-modules
/
puppetlabs-apt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge pull request #48 from nanliu/tb/lint
[puppet-modules/puppetlabs-apt.git]
/
manifests
/
init.pp
diff --git
a/manifests/init.pp
b/manifests/init.pp
index 29db697c14c104ef3963de0141586a9e3ec66582..7d243edd7b947369f0334f096a4d8f98c08b2688 100644
(file)
--- a/
manifests/init.pp
+++ b/
manifests/init.pp
@@
-42,12
+42,18
@@
class apt(
}
$sources_list_content = $purge_sources_list ? {
}
$sources_list_content = $purge_sources_list ? {
- false =>
undef,
+ false => undef,
true => "# Repos managed by puppet.\n",
}
true => "# Repos managed by puppet.\n",
}
+
+ $root = $apt::params::root
+ $apt_conf_d = $apt::params::apt_conf_d
+ $sources_list_d = $apt::params::sources_list_d
+ $provider = $apt::params::provider
+
file { 'sources.list':
ensure => present,
file { 'sources.list':
ensure => present,
- path => "${
apt::params::
root}/sources.list",
+ path => "${root}/sources.list",
owner => root,
group => root,
mode => '0644',
owner => root,
group => root,
mode => '0644',
@@
-56,7
+62,7
@@
class apt(
file { 'sources.list.d':
ensure => directory,
file { 'sources.list.d':
ensure => directory,
- path =>
"${apt::params::root}/sources.list.d"
,
+ path =>
$sources_list_d
,
owner => root,
group => root,
purge => $purge_sources_list_d,
owner => root,
group => root,
purge => $purge_sources_list_d,
@@
-64,7
+70,7
@@
class apt(
}
exec { 'apt_update':
}
exec { 'apt_update':
- command => "${
apt::params::
provider} update",
+ command => "${provider} update",
subscribe => [ File['sources.list'], File['sources.list.d'] ],
refreshonly => $refresh_only_apt_update,
}
subscribe => [ File['sources.list'], File['sources.list.d'] ],
refreshonly => $refresh_only_apt_update,
}
@@
-74,23
+80,24
@@
class apt(
file { '99unauth':
ensure => present,
content => "APT::Get::AllowUnauthenticated 1;\n",
file { '99unauth':
ensure => present,
content => "APT::Get::AllowUnauthenticated 1;\n",
- path =>
'/etc/apt/apt.conf.d/99unauth'
,
+ path =>
"${apt_conf_d}/99unauth"
,
}
}
false: {
file { '99unauth':
ensure => absent,
}
}
false: {
file { '99unauth':
ensure => absent,
- path =>
'/etc/apt/apt.conf.d/99unauth'
,
+ path =>
"${apt_conf_d}/99unauth"
,
}
}
undef: { } # do nothing
default: { fail('Valid values for disable_keys are true or false') }
}
}
}
undef: { } # do nothing
default: { fail('Valid values for disable_keys are true or false') }
}
- if($proxy_host) {
+ if
($proxy_host) {
file { 'configure-apt-proxy':
file { 'configure-apt-proxy':
- path =>
'/etc/apt/apt.conf.d/proxy'
,
+ path =>
"${apt_conf_d}/proxy"
,
content => "Acquire::http::Proxy \"http://${proxy_host}:${proxy_port}\";",
content => "Acquire::http::Proxy \"http://${proxy_host}:${proxy_port}\";",
+ notify => Exec['apt_update'],
}
}
}
}
}
}