2011-05-30 19:18:13 +02:00
|
|
|
class apt::params {
|
2015-02-24 21:43:36 +01:00
|
|
|
|
2015-03-02 22:40:06 +01:00
|
|
|
if $::osfamily != 'Debian' {
|
|
|
|
fail('This module only works on Debian or derivatives like Ubuntu')
|
|
|
|
}
|
|
|
|
|
2016-07-27 06:23:12 +02:00
|
|
|
# prior to puppet 3.5.0, defined() couldn't test if a variable was defined.
|
|
|
|
# strict_variables wasn't added until 3.5.0, so this should be fine.
|
|
|
|
if $::puppetversion and versioncmp($::puppetversion, '3.5.0') < 0 {
|
2015-04-27 20:31:39 +02:00
|
|
|
$xfacts = {
|
|
|
|
'lsbdistcodename' => $::lsbdistcodename,
|
|
|
|
'lsbdistrelease' => $::lsbdistrelease,
|
|
|
|
'lsbdistid' => $::lsbdistid,
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
# Strict variables facts lookup compatibility
|
|
|
|
$xfacts = {
|
|
|
|
'lsbdistcodename' => defined('$lsbdistcodename') ? {
|
|
|
|
true => $::lsbdistcodename,
|
|
|
|
default => undef,
|
|
|
|
},
|
|
|
|
'lsbdistrelease' => defined('$lsbdistrelease') ? {
|
|
|
|
true => $::lsbdistrelease,
|
|
|
|
default => undef,
|
|
|
|
},
|
|
|
|
'lsbdistid' => defined('$lsbdistid') ? {
|
|
|
|
true => $::lsbdistid,
|
|
|
|
default => undef,
|
|
|
|
},
|
|
|
|
}
|
2015-03-02 22:40:06 +01:00
|
|
|
}
|
|
|
|
|
2012-02-24 23:03:51 +01:00
|
|
|
$root = '/etc/apt'
|
|
|
|
$provider = '/usr/bin/apt-get'
|
2015-02-20 00:09:44 +01:00
|
|
|
$sources_list = "${root}/sources.list"
|
2012-02-24 23:03:51 +01:00
|
|
|
$sources_list_d = "${root}/sources.list.d"
|
2015-02-20 00:09:44 +01:00
|
|
|
$conf_d = "${root}/apt.conf.d"
|
|
|
|
$preferences = "${root}/preferences"
|
2012-04-11 23:54:13 +02:00
|
|
|
$preferences_d = "${root}/preferences.d"
|
2015-03-01 14:42:39 +01:00
|
|
|
$keyserver = 'keyserver.ubuntu.com'
|
2012-04-11 23:54:13 +02:00
|
|
|
|
2015-02-20 13:00:17 +01:00
|
|
|
$config_files = {
|
|
|
|
'conf' => {
|
|
|
|
'path' => $conf_d,
|
|
|
|
'ext' => '',
|
|
|
|
},
|
|
|
|
'pref' => {
|
|
|
|
'path' => $preferences_d,
|
2015-08-24 18:53:02 +02:00
|
|
|
'ext' => '.pref',
|
2015-02-20 13:00:17 +01:00
|
|
|
},
|
|
|
|
'list' => {
|
|
|
|
'path' => $sources_list_d,
|
|
|
|
'ext' => '.list',
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-28 16:48:48 +01:00
|
|
|
$update_defaults = {
|
|
|
|
'frequency' => 'reluctantly',
|
|
|
|
'timeout' => undef,
|
|
|
|
'tries' => undef,
|
|
|
|
}
|
|
|
|
|
2015-02-27 12:34:05 +01:00
|
|
|
$proxy_defaults = {
|
2015-08-04 21:58:32 +02:00
|
|
|
'ensure' => undef,
|
|
|
|
'host' => undef,
|
|
|
|
'port' => 8080,
|
|
|
|
'https' => false,
|
2015-02-25 02:03:50 +01:00
|
|
|
}
|
|
|
|
|
2015-02-28 16:12:47 +01:00
|
|
|
$purge_defaults = {
|
2015-04-14 20:03:17 +02:00
|
|
|
'sources.list' => false,
|
|
|
|
'sources.list.d' => false,
|
|
|
|
'preferences' => false,
|
|
|
|
'preferences.d' => false,
|
2015-02-28 16:12:47 +01:00
|
|
|
}
|
|
|
|
|
2015-02-28 18:02:23 +01:00
|
|
|
$source_key_defaults = {
|
2015-03-01 14:42:39 +01:00
|
|
|
'server' => $keyserver,
|
2015-02-28 18:02:23 +01:00
|
|
|
'options' => undef,
|
|
|
|
'content' => undef,
|
|
|
|
'source' => undef,
|
|
|
|
}
|
|
|
|
|
2015-03-05 17:37:51 +01:00
|
|
|
$include_defaults = {
|
|
|
|
'deb' => true,
|
|
|
|
'src' => false,
|
|
|
|
}
|
|
|
|
|
2015-03-03 18:07:48 +01:00
|
|
|
case $xfacts['lsbdistid'] {
|
2015-04-07 13:51:10 +02:00
|
|
|
'debian': {
|
2015-04-08 00:45:20 +02:00
|
|
|
case $xfacts['lsbdistcodename'] {
|
2015-04-07 13:51:10 +02:00
|
|
|
'squeeze': {
|
2015-04-07 21:12:06 +02:00
|
|
|
$backports = {
|
2015-07-05 08:56:38 +02:00
|
|
|
'location' => 'http://httpredir.debian.org/debian-backports',
|
2015-04-07 21:12:06 +02:00
|
|
|
'key' => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
|
|
|
|
'repos' => 'main contrib non-free',
|
2015-04-07 13:51:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
default: {
|
2015-04-07 21:12:06 +02:00
|
|
|
$backports = {
|
2015-07-05 08:56:38 +02:00
|
|
|
'location' => 'http://httpredir.debian.org/debian',
|
2015-04-07 21:12:06 +02:00
|
|
|
'key' => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
|
|
|
|
'repos' => 'main contrib non-free',
|
2015-04-07 13:51:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-04-27 20:31:39 +02:00
|
|
|
|
|
|
|
$ppa_options = undef
|
|
|
|
$ppa_package = undef
|
|
|
|
|
2015-04-07 13:51:10 +02:00
|
|
|
}
|
2012-04-11 23:54:13 +02:00
|
|
|
'ubuntu': {
|
2015-04-07 21:12:06 +02:00
|
|
|
$backports = {
|
|
|
|
'location' => 'http://archive.ubuntu.com/ubuntu',
|
|
|
|
'key' => '630239CC130E1A7FD81A27B140976EAF437D05B5',
|
|
|
|
'repos' => 'main universe multiverse restricted',
|
2015-04-07 13:51:10 +02:00
|
|
|
}
|
2015-04-07 21:12:06 +02:00
|
|
|
|
2016-04-29 14:20:53 +02:00
|
|
|
if $xfacts['lsbdistcodename'] == 'lucid' {
|
2014-03-27 13:51:08 +01:00
|
|
|
$ppa_options = undef
|
2015-02-20 23:25:53 +01:00
|
|
|
$ppa_package = 'python-software-properties'
|
2016-04-29 14:20:53 +02:00
|
|
|
} elsif $xfacts['lsbdistcodename'] == 'precise' {
|
2014-03-27 13:51:08 +01:00
|
|
|
$ppa_options = '-y'
|
2015-02-20 23:25:53 +01:00
|
|
|
$ppa_package = 'python-software-properties'
|
2016-04-29 14:20:53 +02:00
|
|
|
} elsif versioncmp($xfacts['lsbdistrelease'], '14.04') >= 0 {
|
2015-02-20 23:25:53 +01:00
|
|
|
$ppa_options = '-y'
|
|
|
|
$ppa_package = 'software-properties-common'
|
2016-04-29 14:20:53 +02:00
|
|
|
} else {
|
2014-03-27 13:51:08 +01:00
|
|
|
$ppa_options = '-y'
|
2015-02-20 23:25:53 +01:00
|
|
|
$ppa_package = 'python-software-properties'
|
2012-04-11 23:54:13 +02:00
|
|
|
}
|
|
|
|
}
|
2015-04-08 00:45:20 +02:00
|
|
|
undef: {
|
2015-04-23 22:54:17 +02:00
|
|
|
fail('Unable to determine lsbdistid, please install lsb-release first')
|
2015-04-08 00:45:20 +02:00
|
|
|
}
|
|
|
|
default: {
|
2015-03-02 22:40:06 +01:00
|
|
|
$ppa_options = undef
|
|
|
|
$ppa_package = undef
|
2015-04-07 21:12:06 +02:00
|
|
|
$backports = undef
|
2015-03-02 22:40:06 +01:00
|
|
|
}
|
2012-04-11 23:54:13 +02:00
|
|
|
}
|
2011-05-30 19:18:13 +02:00
|
|
|
}
|