Prefer if/else over ? selector with default

This commit is contained in:
Christophe Bliard 2014-08-29 16:57:09 +02:00
parent 636cacd72c
commit ec3c20e288
2 changed files with 27 additions and 25 deletions

View file

@ -39,17 +39,18 @@ class apt::backports(
}
if $::lsbdistid == 'LinuxMint' {
$distid = $::lsbdistcodename ? {
'debian' => 'debian',
default => 'ubuntu',
}
$release_real = $::lsbdistcodename ? {
'debian' => 'wheezy',
'qiana' => 'trusty',
'petra' => 'saucy',
'olivia' => 'raring',
'nadia' => 'quantal',
'maya' => 'precise',
if $::lsbdistcodename == 'debian' {
$distid = 'debian'
$release_real = 'wheezy'
} else {
$distid = 'ubuntu'
$release_real = $::lsbdistcodename ? {
'qiana' => 'trusty',
'petra' => 'saucy',
'olivia' => 'raring',
'nadia' => 'quantal',
'maya' => 'precise',
}
}
} else {
$distid = $::lsbdistid

View file

@ -6,24 +6,25 @@ class apt::params {
$preferences_d = "${root}/preferences.d"
case $::lsbdistid {
'linuxmint': {
$distid = $::lsbdistcodename ? {
'debian' => 'debian',
default => 'ubuntu',
}
$distcodename = $::lsbdistcodename ? {
'debian' => 'wheezy',
'qiana' => 'trusty',
'petra' => 'saucy',
'olivia' => 'raring',
'nadia' => 'quantal',
'maya' => 'precise',
}
}
'ubuntu', 'debian': {
$distid = $::lsbdistid
$distcodename = $::lsbdistcodename
}
'linuxmint': {
if $::lsbdistcodename == 'debian' {
$distid = 'debian'
$distcodename = 'wheezy'
} else {
$distid = 'ubuntu'
$distcodename = $::lsbdistcodename ? {
'qiana' => 'trusty',
'petra' => 'saucy',
'olivia' => 'raring',
'nadia' => 'quantal',
'maya' => 'precise',
}
}
}
'': {
fail('Unable to determine lsbdistid, is lsb-release installed?')
}