Skip to content

Commit

Permalink
Merge pull request #560 from mhaskel/MODULES-2446
Browse files Browse the repository at this point in the history
MODULES-2446 - Fix pinning for backports
  • Loading branch information
bmjen committed Aug 26, 2015
2 parents 3df188f + 9f43b2d commit 418820a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
22 changes: 14 additions & 8 deletions manifests/backports.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@
}
$_key = $key
}
unless is_hash($pin) {
unless (is_numeric($pin) or is_string($pin)) {
fail('pin must be either a string, number or hash')
}
}

if ($::apt::xfacts['lsbdistid'] == 'debian' or $::apt::xfacts['lsbdistid'] == 'ubuntu') {
unless $location {
$_location = $::apt::backports['location']
Expand All @@ -48,12 +42,24 @@
}
}

if is_hash($pin) {
$_pin = $pin
} elsif is_numeric($pin) or is_string($pin) {
# apt::source defaults to pinning to origin, but we should pin to release
# for backports
$_pin = {
'priority' => $pin,
'release' => $_release,
}
} else {
fail('pin must be either a string, number or hash')
}

apt::source { 'backports':
location => $_location,
release => $_release,
repos => $_repos,
key => $_key,
pin => $pin,
pin => $_pin,
}

}
10 changes: 5 additions & 5 deletions spec/classes/apt_backports_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
:key => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
:repos => 'main contrib non-free',
:release => 'wheezy-backports',
:pin => 200,
:pin => { 'priority' => 200, 'release' => 'wheezy-backports' },
})
}
end
Expand All @@ -36,7 +36,7 @@
:key => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
:repos => 'main contrib non-free',
:release => 'squeeze-backports',
:pin => 200,
:pin => { 'priority' => 200, 'release' => 'squeeze-backports' },
})
}
end
Expand All @@ -54,7 +54,7 @@
:key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
:repos => 'main universe multiverse restricted',
:release => 'trusty-backports',
:pin => 200,
:pin => { 'priority' => 200, 'release' => 'trusty-backports' },
})
}
end
Expand All @@ -81,7 +81,7 @@
:key => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
:repos => 'main',
:release => 'vivid',
:pin => 90,
:pin => { 'priority' => 90, 'release' => 'vivid' },
})
}
end
Expand Down Expand Up @@ -134,7 +134,7 @@
:key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
:repos => 'main universe multiverse restricted',
:release => 'trusty-backports',
:pin => 200,
:pin => { 'priority' => 200, 'release' => 'trusty-backports' },
})
}
end
Expand Down

0 comments on commit 418820a

Please sign in to comment.