|
313 | 313 | } |
314 | 314 | } |
315 | 315 | 'sources': { |
| 316 | + $_file_suffix = $source_format |
| 317 | + |
316 | 318 | if $pin { |
317 | | - fail('apt::source::pin parameter is not supported with deb822 format') |
| 319 | + warning('apt::source::pin parameter is not supported with deb822 format.') |
318 | 320 | } |
319 | | - if !$uris { |
| 321 | + |
| 322 | + if !$location { |
320 | 323 | fail('You must specify a list of URIs for the apt::source resource') |
321 | 324 | } |
322 | | - if !$suites { |
323 | | - fail('You must specify a list of suites for the apt::source resource') |
| 325 | + if (type($location =~ String)) { |
| 326 | + warning('For deb822 sources, location must be specified as an array.') |
| 327 | + $_location = [$location] |
324 | 328 | } |
325 | | - if !$components { |
326 | | - fail('You must specify a list of components for the apt::source resource') |
| 329 | + else { |
| 330 | + $_location = $location |
327 | 331 | } |
328 | | - $_file_suffix = $source_format |
| 332 | + |
| 333 | + if !$release { |
| 334 | + if fact('os.distro.codename') { |
| 335 | + $_release = [fact('os.distro.codename')] |
| 336 | + } else { |
| 337 | + fail('os.distro.codename fact not available: release parameter required') |
| 338 | + } |
| 339 | + } else { |
| 340 | + if (type($release) =~ String) { |
| 341 | + warning("For deb822 sources, 'release' must be specified as an array. Converting to array.") |
| 342 | + $_release = [$release] |
| 343 | + } |
| 344 | + } |
| 345 | + |
| 346 | + if (type($repos) =~ String) { |
| 347 | + warning("For deb822 sources, 'repos' must be specified as an array. Converting to array.") |
| 348 | + $_repos = split($repos, /\s+/) |
| 349 | + } else { |
| 350 | + $_repos = $repos |
| 351 | + } |
| 352 | + |
| 353 | + if (type($architecture =~ String)) { |
| 354 | + warning("For deb822 sources, 'architecture' must be specified as an array. Converting to array.") |
| 355 | + $_architecture = split($architecture, '[,]') |
| 356 | + } |
| 357 | + else { |
| 358 | + $_architecture = $architecture |
| 359 | + } |
| 360 | + |
329 | 361 | case $ensure { |
330 | 362 | 'present': { |
331 | 363 | $header = epp('apt/_header.epp') |
332 | 364 | $source_content = epp('apt/source_deb822.epp', delete_undef_values({ |
333 | | - 'uris' => $uris, |
334 | | - 'suites' => $suites, |
335 | | - 'components' => $components, |
| 365 | + 'uris' => $_location, |
| 366 | + 'suites' => $_release, |
| 367 | + 'components' => $_repos, |
336 | 368 | 'types' => $types, |
337 | 369 | 'comment' => $comment, |
338 | 370 | 'enabled' => $enabled ? { true => 'yes', false => 'no' }, |
339 | | - 'architectures' => $architectures, |
| 371 | + 'architectures' => $_architecture, |
340 | 372 | 'allow_insecure' => $allow_insecure ? { true => 'yes', false => 'no', default => undef }, |
341 | 373 | 'repo_trusted' => $repo_trusted ? { true => 'yes', false => 'no', default => undef }, |
342 | 374 | 'check_valid_until' => $check_valid_until ? { true => 'yes', false => 'no', default => undef }, |
|
0 commit comments