|
5 | 5 | # @example |
6 | 6 | # apt::source_deb822 { 'namevar': } |
7 | 7 | define apt::source_deb822 ( |
8 | | - Array[String] $uris, |
9 | | - Array[String] $suites, |
10 | | - Array[String] $components, |
11 | | - Array[Enum['deb','deb-src'], 1, 2] $types = ['deb'], |
12 | | - Enum['present','absent'] $ensure = 'present', |
13 | 8 | String $comment = $name, |
14 | 9 | Boolean $enabled = true, |
| 10 | + Array[Enum['deb','deb-src'], 1, 2] $types = ['deb'], |
15 | 11 | Boolean $notify_update = true, |
| 12 | + Enum['present','absent'] $ensure = 'present', |
| 13 | + Optional[Array[String]] $uris = undef, |
| 14 | + Optional[Array[String]] $suites = undef, |
| 15 | + Optional[Array[String]] $components = undef, |
16 | 16 | Optional[Array[String]] $architectures = undef, |
17 | 17 | Optional[Boolean] $allow_insecure = undef, |
18 | | - Optional[Boolean] $trusted = undef, |
19 | | - Optional[Variant[Array[Stdlib::AbsolutePath], String]] $signed_by = undef, |
| 18 | + Optional[Boolean] $repo_trusted = undef, |
| 19 | + Optional[Variant[Array[Stdlib::AbsolutePath],String]] $signed_by = undef, |
20 | 20 | Optional[Boolean] $check_valid_until = undef, |
21 | | - Optional[Hash] $options = undef |
22 | 21 | ) { |
23 | | - $header = epp('apt/_header.epp') |
24 | | - $source_content = epp('apt/source_deb822.epp') |
| 22 | + case $ensure { |
| 23 | + 'present': { |
| 24 | + $header = epp('apt/_header.epp') |
| 25 | + $source_content = epp('apt/source_deb822.epp', delete_undef_values({ |
| 26 | + 'uris' => $uris, |
| 27 | + 'suites' => $suites, |
| 28 | + 'components' => $components, |
| 29 | + 'types' => $types, |
| 30 | + 'comment' => $comment, |
| 31 | + 'enabled' => $enabled ? { true => 'yes', false => 'no' }, |
| 32 | + 'architectures' => $architectures, |
| 33 | + 'allow_insecure' => $allow_insecure ? { true => 'yes', false => 'no', default => undef }, |
| 34 | + 'repo_trusted' => $repo_trusted ? { true => 'yes', false => 'no', default => undef }, |
| 35 | + 'check_valid_until' => $check_valid_until ? { true => 'yes', false => 'no', default => undef }, |
| 36 | + 'signed_by' => $signed_by, |
| 37 | + } |
| 38 | + ) |
| 39 | + ) |
| 40 | + } |
| 41 | + 'absent': { |
| 42 | + $header = undef |
| 43 | + $source_content = undef |
| 44 | + } |
| 45 | + } |
25 | 46 |
|
26 | 47 | apt::setting { "source-${name}": |
27 | 48 | ensure => $ensure, |
|
0 commit comments