#
class apt(
+ $proxy = {},
$always_apt_update = false,
$apt_update_frequency = 'reluctantly',
$purge_sources_list = false,
$sources = undef,
) inherits ::apt::params {
- if $::osfamily != 'Debian' {
- fail('This module only works on Debian or derivatives like Ubuntu')
- }
-
include apt::update
$frequency_options = ['always','daily','weekly','reluctantly']
validate_bool($purge_sources_list, $purge_sources_list_d,
$purge_preferences, $purge_preferences_d)
+ validate_hash($proxy)
+ if $proxy['host'] {
+ validate_string($proxy['host'])
+ }
+ if $proxy['port'] {
+ unless is_integer($proxy['port']) {
+ fail('$proxy port must be an integer')
+ }
+ }
+ if $proxy['https'] {
+ validate_bool($proxy['https'])
+ }
+
+ $_proxy = merge($apt::proxy_defaults, $proxy)
+
+ if $proxy['host'] {
+ apt::setting { 'conf-proxy':
+ priority => '01',
+ content => template('apt/_header.erb', 'apt/proxy.erb'),
+ }
+ }
+
$sources_list_content = $purge_sources_list ? {
false => undef,
true => "# Repos managed by puppet.\n",
}
}
- file { '/etc/apt/apt.conf.d/15update-stamp':
- ensure => 'file',
- content => template('apt/_header.erb', 'apt/15update-stamp.erb'),
- group => 'root',
- mode => '0644',
- owner => 'root',
+ apt::setting { 'conf-update-stamp':
+ priority => 15,
+ content => template('apt/_header.erb', 'apt/15update-stamp.erb'),
}
- $root = $apt::params::root
- $apt_conf_d = $apt::params::apt_conf_d
- $sources_list_d = $apt::params::sources_list_d
- $preferences_d = $apt::params::preferences_d
- $provider = $apt::params::provider
-
file { 'sources.list':
ensure => present,
- path => "${root}/sources.list",
+ path => $::apt::sources_list,
owner => root,
group => root,
mode => '0644',
file { 'sources.list.d':
ensure => directory,
- path => $sources_list_d,
+ path => $::apt::sources_list_d,
owner => root,
group => root,
purge => $purge_sources_list_d,
if $purge_preferences {
file { 'apt-preferences':
ensure => absent,
- path => "${root}/preferences",
+ path => $::apt::preferences,
}
}
file { 'preferences.d':
ensure => directory,
- path => $preferences_d,
+ path => $::apt::preferences_d,
owner => root,
group => root,
purge => $purge_preferences_d,