- if ($pin != false) {
- # Get the host portion out of the url so we can pin to origin
- $url_split = split($location, '/')
- $host = $url_split[2]
-
- apt::pin { $name:
- ensure => $ensure,
- priority => $pin,
- before => $_before,
- origin => $host,
+ if $pin {
+ if is_hash($pin) {
+ $_pin = merge($pin, { 'ensure' => $ensure, 'before' => $_before })
+ } elsif (is_numeric($pin) or is_string($pin)) {
+ $url_split = split($location, '/')
+ $host = $url_split[2]
+ $_pin = {
+ 'ensure' => $ensure,
+ 'priority' => $pin,
+ 'before' => $_before,
+ 'origin' => $host,
+ }
+ } else {
+ fail('Received invalid value for pin parameter')