- Timestamp:
- Aug 1, 2017, 3:45:14 PM (9 years ago)
- Branches:
- debian/bullseye, debian/jessie
- Children:
- ce0f6a4
- Parents:
- bcf0be5 (diff), cd0f9cc (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/puppetcode/environments/gnuboat/modules/apt/manifests/init.pp
rbcf0be5 rad28f83 1 # == Class: apt 1 2 # 2 class apt( 3 $update = {}, 4 $purge = {}, 5 $proxy = {}, 6 $sources = {}, 7 $keys = {}, 8 $ppas = {}, 9 $pins = {}, 10 $settings = {}, 11 ) inherits ::apt::params { 3 # Manage APT (Advanced Packaging Tool) 4 # 5 class apt ( 6 Hash $update_defaults = $apt::params::update_defaults, 7 Hash $purge_defaults = $apt::params::purge_defaults, 8 Hash $proxy_defaults = $apt::params::proxy_defaults, 9 Hash $include_defaults = $apt::params::include_defaults, 10 String $provider = $apt::params::provider, 11 String $keyserver = $apt::params::keyserver, 12 Optional[String] $ppa_options = $apt::params::ppa_options, 13 Optional[String] $ppa_package = $apt::params::ppa_package, 14 Optional[Hash] $backports = $apt::params::backports, 15 Hash $confs = $apt::params::confs, 16 Hash $update = $apt::params::update, 17 Hash $purge = $apt::params::purge, 18 Hash $proxy = $apt::params::proxy, 19 Hash $sources = $apt::params::sources, 20 Hash $keys = $apt::params::keys, 21 Hash $ppas = $apt::params::ppas, 22 Hash $pins = $apt::params::pins, 23 Hash $settings = $apt::params::settings, 24 String $root = $apt::params::root, 25 String $sources_list = $apt::params::sources_list, 26 String $sources_list_d = $apt::params::sources_list_d, 27 String $conf_d = $apt::params::conf_d, 28 String $preferences = $apt::params::preferences, 29 String $preferences_d = $apt::params::preferences_d, 30 Hash $config_files = $apt::params::config_files, 31 Hash $source_key_defaults = $apt::params::source_key_defaults 32 ) inherits apt::params { 33 34 if $facts['osfamily'] != 'Debian' { 35 fail('This module only works on Debian or derivatives like Ubuntu') 36 } 12 37 13 38 $frequency_options = ['always','daily','weekly','reluctantly'] 14 validate_hash($update) 39 15 40 if $update['frequency'] { 16 41 validate_re($update['frequency'], $frequency_options) 17 42 } 18 43 if $update['timeout'] { 19 unless is_integer($update['timeout']) { 20 fail('timeout value for update must be an integer') 21 } 44 assert_type(Integer, $update['timeout']) 22 45 } 23 46 if $update['tries'] { 24 unless is_integer($update['tries']) { 25 fail('tries value for update must be an integer') 26 } 47 assert_type(Integer, $update['tries']) 27 48 } 28 49 … … 30 51 include ::apt::update 31 52 32 validate_hash($purge)33 53 if $purge['sources.list'] { 34 validate_bool($purge['sources.list'])54 assert_type(Boolean, $purge['sources.list']) 35 55 } 36 56 if $purge['sources.list.d'] { 37 validate_bool($purge['sources.list.d'])57 assert_type(Boolean, $purge['sources.list.d']) 38 58 } 39 59 if $purge['preferences'] { 40 validate_bool($purge['preferences'])60 assert_type(Boolean, $purge['preferences']) 41 61 } 42 62 if $purge['preferences.d'] { 43 validate_bool($purge['preferences.d'])63 assert_type(Boolean, $purge['preferences.d']) 44 64 } 45 65 46 66 $_purge = merge($::apt::purge_defaults, $purge) 47 67 48 validate_hash($proxy)49 68 if $proxy['ensure'] { 50 69 validate_re($proxy['ensure'], ['file', 'present', 'absent']) 51 70 } 52 71 if $proxy['host'] { 53 validate_string($proxy['host'])72 assert_type(String, $proxy['host']) 54 73 } 55 74 if $proxy['port'] { 56 unless is_integer($proxy['port']) { 57 fail('$proxy port must be an integer') 58 } 75 assert_type(Integer, $proxy['port']) 59 76 } 60 if $proxy['https'] {61 validate_bool($proxy['https'])77 if $proxy['https']{ 78 assert_type(Boolean, $proxy['https']) 62 79 } 63 80 64 81 $_proxy = merge($apt::proxy_defaults, $proxy) 65 82 66 validate_hash($sources) 67 validate_hash($keys) 68 validate_hash($settings) 69 validate_hash($ppas) 70 validate_hash($pins) 83 $confheadertmp = epp('apt/_conf_header.epp') 84 $proxytmp = epp('apt/proxy.epp', {'proxies' => $_proxy}) 85 $updatestamptmp = epp('apt/15update-stamp.epp') 71 86 72 87 if $_proxy['ensure'] == 'absent' or $_proxy['host'] { … … 74 89 ensure => $_proxy['ensure'], 75 90 priority => '01', 76 content => template('apt/_conf_header.erb', 'apt/proxy.erb'),91 content => "${confheadertmp}${proxytmp}", 77 92 } 78 93 } … … 96 111 apt::setting { 'conf-update-stamp': 97 112 priority => 15, 98 content => template('apt/_conf_header.erb', 'apt/15update-stamp.erb'),113 content => "${confheadertmp}${updatestamptmp}", 99 114 } 100 115 … … 140 155 } 141 156 157 if $confs { 158 create_resources('apt::conf', $confs) 159 } 142 160 # manage sources if present 143 161 if $sources {
Note:
See TracChangeset
for help on using the changeset viewer.
