summaryrefslogtreecommitdiff
path: root/manifests/params.pp
blob: 49aec2081095294c3a23d147c30fd60ca7c3cd77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
class unattended_upgrades::params {

  if $::osfamily != 'Debian' {
    fail('This module only works on Debian or derivatives like Ubuntu')
  }

  $default_auto                 = { 'fix_interrupted_dpkg' => true, 'remove' => true, 'reboot' => false, 'clean' => 0, }
  $default_mail                 = { 'only_on_errors'       => true, 'to'     => undef, }
  $default_backup               = { 'archive_interval'     => 0, 'level'     => 3, }
  $default_age                  = { 'min'                  => 2, 'max'       => 0, }
  $default_size                 = { 'max'                  => 0, }
  $default_upgradeable_packages = { 'download_only'        => 0, 'debdelta'  => 1, }

  # Strict variables facts lookup compatibility
  $xfacts = {
    'lsbdistid' => defined('$lsbdistid') ? {
      true    => $::lsbdistid,
      default => undef,
    },
    'lsbdistcodename' => defined('$lsbdistcodename') ? {
      true    => $::lsbdistcodename,
      default => undef,
    },
  }

  case $xfacts['lsbdistid'] {
    'debian': {
      case $xfacts['lsbdistcodename'] {
        'squeeze': {
          $legacy_origin = true
          $origins       = ['${distro_id} oldstable', #lint:ignore:single_quote_string_with_variables
                            '${distro_id} ${distro_codename}-security', #lint:ignore:single_quote_string_with_variables
                            '${distro_id} ${distro_codename}-lts',] #lint:ignore:single_quote_string_with_variables
        }
        default: {
          $legacy_origin = false
          $origins       = ['origin=Debian,archive=stable,label=Debian-Security']
        }
      }
    }
    'ubuntu': {
      $legacy_origin = true
      $origins       = ['${distro_id} {$distro_codename}-security', #lint:ignore:single_quote_string_with_variables
                        '${distro_id} {$distro_codename}-updates',] #lint:ignore:single_quote_string_with_variables
    }
    default: {
      fail('Please explicitly specify unattended_upgrades::legacy_origin and unattended_upgrades::origins')
    }
  }
}