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