X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=manifests%2Finit.pp;h=7d243edd7b947369f0334f096a4d8f98c08b2688;hb=0ac5939f9b8225af4780bd5836a7939ec121e303;hp=29db697c14c104ef3963de0141586a9e3ec66582;hpb=cd7a3efdf0d82d47efd711d39284fb690f1a4883;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/manifests/init.pp b/manifests/init.pp index 29db697..7d243ed 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -42,12 +42,18 @@ class apt( } $sources_list_content = $purge_sources_list ? { - false => undef, + false => undef, 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, - path => "${apt::params::root}/sources.list", + path => "${root}/sources.list", owner => root, group => root, mode => '0644', @@ -56,7 +62,7 @@ class apt( 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, @@ -64,7 +70,7 @@ class apt( } exec { 'apt_update': - command => "${apt::params::provider} update", + command => "${provider} 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", - path => '/etc/apt/apt.conf.d/99unauth', + path => "${apt_conf_d}/99unauth", } } 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') } } - if($proxy_host) { + if ($proxy_host) { 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}\";", + notify => Exec['apt_update'], } } }