-define site::aptrepo ($key = undef, $keyid = undef, $template = undef, $config = undef, $ensure = present) {
+define site::aptrepo (
+ $url='',
+ $suite='',
+ $components=[],
+ $key = undef,
+ $keyid = undef,
+ $ensure = present
+) {
case $ensure {
present: {
}
} elsif $keyid {
exec { "apt-key-del-${keyid}":
- command => "apt-key del ${keyid}",
+ command => "apt-key del ${keyid}",
}
}
}
default: { fail ( "Unknown ensure value: '$ensure'" ) }
}
- if $ensure == present {
- if ! ($config or $template) {
- fail ( "No configuration found for ${name}" )
- }
- if ($config and $template) {
- fail ( "Can't specify both config and template for ${name}" )
+ case $ensure {
+ present: {
+ if !($url and $suite) {
+ fail ( "Need both url and suite for $name" )
+ }
}
+ default: {}
}
file { "/etc/apt/sources.list.d/${name}.list":
ensure => $ensure,
- content => template($template),
- source => $config,
+ content => template('site/aptrepo.erb'),
notify => Exec['apt-get update'],
}
}