| [1c22429] | 1 | class apt::params {
|
|---|
| 2 |
|
|---|
| 3 | if $::osfamily != 'Debian' {
|
|---|
| 4 | fail('This module only works on Debian or derivatives like Ubuntu')
|
|---|
| 5 | }
|
|---|
| 6 |
|
|---|
| 7 | # prior to puppet 3.5.0, defined couldn't test if a variable was defined
|
|---|
| 8 | # strict variables wasn't added until 3.5.0, so this should be fine.
|
|---|
| 9 | if ! $::settings::strict_variables {
|
|---|
| 10 | $xfacts = {
|
|---|
| 11 | 'lsbdistcodename' => $::lsbdistcodename,
|
|---|
| 12 | 'lsbdistrelease' => $::lsbdistrelease,
|
|---|
| 13 | 'lsbmajdistrelease' => $::lsbmajdistrelease,
|
|---|
| 14 | 'lsbdistdescription' => $::lsbdistdescription,
|
|---|
| 15 | 'lsbminordistrelease' => $::lsbminordistrelease,
|
|---|
| 16 | 'lsbdistid' => $::lsbdistid,
|
|---|
| 17 | }
|
|---|
| 18 | } else {
|
|---|
| 19 | # Strict variables facts lookup compatibility
|
|---|
| 20 | $xfacts = {
|
|---|
| 21 | 'lsbdistcodename' => defined('$lsbdistcodename') ? {
|
|---|
| 22 | true => $::lsbdistcodename,
|
|---|
| 23 | default => undef,
|
|---|
| 24 | },
|
|---|
| 25 | 'lsbdistrelease' => defined('$lsbdistrelease') ? {
|
|---|
| 26 | true => $::lsbdistrelease,
|
|---|
| 27 | default => undef,
|
|---|
| 28 | },
|
|---|
| 29 | 'lsbmajdistrelease' => defined('$lsbmajdistrelease') ? {
|
|---|
| 30 | true => $::lsbmajdistrelease,
|
|---|
| 31 | default => undef,
|
|---|
| 32 | },
|
|---|
| 33 | 'lsbdistdescription' => defined('$lsbdistdescription') ? {
|
|---|
| 34 | true => $::lsbdistdescription,
|
|---|
| 35 | default => undef,
|
|---|
| 36 | },
|
|---|
| 37 | 'lsbminordistrelease' => defined('$lsbminordistrelease') ? {
|
|---|
| 38 | true => $::lsbminordistrelease,
|
|---|
| 39 | default => undef,
|
|---|
| 40 | },
|
|---|
| 41 | 'lsbdistid' => defined('$lsbdistid') ? {
|
|---|
| 42 | true => $::lsbdistid,
|
|---|
| 43 | default => undef,
|
|---|
| 44 | },
|
|---|
| 45 | }
|
|---|
| 46 | }
|
|---|
| 47 |
|
|---|
| 48 | $root = '/etc/apt'
|
|---|
| 49 | $provider = '/usr/bin/apt-get'
|
|---|
| 50 | $sources_list = "${root}/sources.list"
|
|---|
| 51 | $sources_list_d = "${root}/sources.list.d"
|
|---|
| 52 | $conf_d = "${root}/apt.conf.d"
|
|---|
| 53 | $preferences = "${root}/preferences"
|
|---|
| 54 | $preferences_d = "${root}/preferences.d"
|
|---|
| 55 | $keyserver = 'keyserver.ubuntu.com'
|
|---|
| 56 |
|
|---|
| 57 | $config_files = {
|
|---|
| 58 | 'conf' => {
|
|---|
| 59 | 'path' => $conf_d,
|
|---|
| 60 | 'ext' => '',
|
|---|
| 61 | },
|
|---|
| 62 | 'pref' => {
|
|---|
| 63 | 'path' => $preferences_d,
|
|---|
| 64 | 'ext' => '.pref',
|
|---|
| 65 | },
|
|---|
| 66 | 'list' => {
|
|---|
| 67 | 'path' => $sources_list_d,
|
|---|
| 68 | 'ext' => '.list',
|
|---|
| 69 | }
|
|---|
| 70 | }
|
|---|
| 71 |
|
|---|
| 72 | $update_defaults = {
|
|---|
| 73 | 'frequency' => 'reluctantly',
|
|---|
| 74 | 'timeout' => undef,
|
|---|
| 75 | 'tries' => undef,
|
|---|
| 76 | }
|
|---|
| 77 |
|
|---|
| 78 | $proxy_defaults = {
|
|---|
| 79 | 'ensure' => undef,
|
|---|
| 80 | 'host' => undef,
|
|---|
| 81 | 'port' => 8080,
|
|---|
| 82 | 'https' => false,
|
|---|
| 83 | }
|
|---|
| 84 |
|
|---|
| 85 | $purge_defaults = {
|
|---|
| 86 | 'sources.list' => false,
|
|---|
| 87 | 'sources.list.d' => false,
|
|---|
| 88 | 'preferences' => false,
|
|---|
| 89 | 'preferences.d' => false,
|
|---|
| 90 | }
|
|---|
| 91 |
|
|---|
| 92 | $source_key_defaults = {
|
|---|
| 93 | 'server' => $keyserver,
|
|---|
| 94 | 'options' => undef,
|
|---|
| 95 | 'content' => undef,
|
|---|
| 96 | 'source' => undef,
|
|---|
| 97 | }
|
|---|
| 98 |
|
|---|
| 99 | $include_defaults = {
|
|---|
| 100 | 'deb' => true,
|
|---|
| 101 | 'src' => false,
|
|---|
| 102 | }
|
|---|
| 103 |
|
|---|
| 104 | case $xfacts['lsbdistid'] {
|
|---|
| 105 | 'debian': {
|
|---|
| 106 | case $xfacts['lsbdistcodename'] {
|
|---|
| 107 | 'squeeze': {
|
|---|
| 108 | $backports = {
|
|---|
| 109 | 'location' => 'http://httpredir.debian.org/debian-backports',
|
|---|
| 110 | 'key' => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
|
|---|
| 111 | 'repos' => 'main contrib non-free',
|
|---|
| 112 | }
|
|---|
| 113 | }
|
|---|
| 114 | default: {
|
|---|
| 115 | $backports = {
|
|---|
| 116 | 'location' => 'http://httpredir.debian.org/debian',
|
|---|
| 117 | 'key' => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
|
|---|
| 118 | 'repos' => 'main contrib non-free',
|
|---|
| 119 | }
|
|---|
| 120 | }
|
|---|
| 121 | }
|
|---|
| 122 |
|
|---|
| 123 | $ppa_options = undef
|
|---|
| 124 | $ppa_package = undef
|
|---|
| 125 |
|
|---|
| 126 | }
|
|---|
| 127 | 'ubuntu': {
|
|---|
| 128 | $backports = {
|
|---|
| 129 | 'location' => 'http://archive.ubuntu.com/ubuntu',
|
|---|
| 130 | 'key' => '630239CC130E1A7FD81A27B140976EAF437D05B5',
|
|---|
| 131 | 'repos' => 'main universe multiverse restricted',
|
|---|
| 132 | }
|
|---|
| 133 |
|
|---|
| 134 | case $xfacts['lsbdistcodename'] {
|
|---|
| 135 | 'lucid': {
|
|---|
| 136 | $ppa_options = undef
|
|---|
| 137 | $ppa_package = 'python-software-properties'
|
|---|
| 138 | }
|
|---|
| 139 | 'precise': {
|
|---|
| 140 | $ppa_options = '-y'
|
|---|
| 141 | $ppa_package = 'python-software-properties'
|
|---|
| 142 | }
|
|---|
| 143 | 'trusty', 'utopic', 'vivid', 'wily': {
|
|---|
| 144 | $ppa_options = '-y'
|
|---|
| 145 | $ppa_package = 'software-properties-common'
|
|---|
| 146 | }
|
|---|
| 147 | default: {
|
|---|
| 148 | $ppa_options = '-y'
|
|---|
| 149 | $ppa_package = 'python-software-properties'
|
|---|
| 150 | }
|
|---|
| 151 | }
|
|---|
| 152 | }
|
|---|
| 153 | undef: {
|
|---|
| 154 | fail('Unable to determine lsbdistid, please install lsb-release first')
|
|---|
| 155 | }
|
|---|
| 156 | default: {
|
|---|
| 157 | $ppa_options = undef
|
|---|
| 158 | $ppa_package = undef
|
|---|
| 159 | $backports = undef
|
|---|
| 160 | }
|
|---|
| 161 | }
|
|---|
| 162 | }
|
|---|