|
39 | 39 | # @param types |
40 | 40 | # DEB822: The package types this source manages. |
41 | 41 | # |
42 | | -# @param uris |
43 | | -# DEB822: A list of URIs for the APT source. |
44 | | -# |
45 | 42 | # @param enabled |
46 | 43 | # DEB822: Enable or Disable the APT source. |
47 | 44 | # |
|
54 | 51 | # @param release |
55 | 52 | # Specifies a distribution of the Apt repository. |
56 | 53 | # |
57 | | -# @param suites |
58 | | -# DEB822: A list of suites for the APT source ('jammy-updates', 'bookworm', 'stable', etc.). |
59 | | -# |
60 | 54 | # @param repos |
61 | 55 | # Specifies a component of the Apt repository. |
62 | 56 | # |
63 | | -# @param components |
64 | | -# DEB822: A list of components for the APT source ('main', 'contrib', 'non-free', etc.). |
65 | | -# |
66 | 57 | # @param include |
67 | 58 | # Configures include options. Valid options: a hash of available keys. |
68 | 59 | # |
|
85 | 76 | # This is not necessary if the key is installed with `key` param above. |
86 | 77 | # See https://wiki.debian.org/DebianRepository/UseThirdParty for details. |
87 | 78 | # |
88 | | -# @param signed_by |
89 | | -# DEB822: Either an absolute path to a PGP keyring file used to sign this repository OR a list of key fingerprints to trust. |
90 | | -# |
91 | 79 | # @param pin |
92 | 80 | # Creates a declaration of the apt::pin defined type. Valid options: a number or string to be passed to the `id` parameter of the |
93 | 81 | # `apt::pin` defined type, or a hash of `parameter => value` pairs to be passed to `apt::pin`'s corresponding parameters. |
|
97 | 85 | # separated by commas (e.g., 'i386' or 'i386,alpha,powerpc'). |
98 | 86 | # (if unspecified, Apt downloads information for all architectures defined in the Apt::Architectures option) |
99 | 87 | # |
100 | | -# @param architectures |
101 | | -# DEB822: A list of supported architectures for the APT source ('amd64', 'i386', etc.). |
102 | | -# |
103 | 88 | # @param allow_unsigned |
104 | 89 | # Specifies whether to authenticate packages from this release, even if the Release file is not signed or the signature can't be checked. |
105 | 90 | # |
106 | | -# @param repo_trusted |
107 | | -# DEB822: Consider the APT source trusted, even if authentication checks fail. |
108 | | -# |
109 | 91 | # @param allow_insecure |
110 | 92 | # Specifies whether to allow downloads from insecure repositories. |
111 | 93 | # |
|
116 | 98 | # Specifies whether to check if the package release date is valid. |
117 | 99 | # |
118 | 100 | define apt::source ( |
119 | | - Enum['list', 'sources'] $source_format = 'list', |
120 | | - Array[Enum['deb','deb-src'], 1, 2] $types = ['deb'], |
121 | | - Optional[String] $location = undef, |
122 | | - Optional[Array[String]] $uris = undef, # deb822 |
123 | | - Boolean $enabled = true, # deb822 |
124 | | - String $comment = $name, |
125 | | - String $ensure = present, |
126 | | - Optional[String] $release = undef, |
127 | | - Optional[Array[String]] $suites = undef, # deb822 |
128 | | - String $repos = 'main', |
129 | | - Optional[Array[String]] $components = undef, # deb822 |
130 | | - Variant[Hash] $include = {}, |
131 | | - Optional[Variant[String, Hash]] $key = undef, |
132 | | - Optional[Stdlib::AbsolutePath] $keyring = undef, |
133 | | - Optional[Variant[Stdlib::AbsolutePath,Array[String]]] $signed_by = undef, # deb822 |
134 | | - Optional[Variant[Hash, Numeric, String]] $pin = undef, |
135 | | - Optional[String] $architecture = undef, |
136 | | - Optional[Array[String]] $architectures = undef, # deb822 |
137 | | - Optional[Boolean] $allow_unsigned = undef, |
138 | | - Optional[Boolean] $repo_trusted = undef, # deb822 |
139 | | - Optional[Boolean] $allow_insecure = undef, |
140 | | - Optional[Boolean] $check_valid_until = undef, |
141 | | - Boolean $notify_update = true, |
| 101 | + Enum['list', 'sources'] $source_format = 'list', |
| 102 | + Array[Enum['deb','deb-src'], 1, 2] $types = ['deb'], |
| 103 | + Optional[Variant[String, Array[String]]] $location = undef, |
| 104 | + Boolean $enabled = true, # deb822 |
| 105 | + String $comment = $name, |
| 106 | + String $ensure = present, |
| 107 | + Optional[Variant[String, Array[String]]] $release = undef, |
| 108 | + Variant[String, Array[String]] $repos = 'main', |
| 109 | + Variant[Hash] $include = {}, |
| 110 | + Optional[Variant[String, Hash]] $key = undef, |
| 111 | + Optional[Stdlib::AbsolutePath] $keyring = undef, |
| 112 | + Optional[Variant[Hash, Numeric, String]] $pin = undef, |
| 113 | + Optional[Variant[String, Array[String]]] $architecture = undef, |
| 114 | + Optional[Boolean] $allow_unsigned = undef, |
| 115 | + Optional[Boolean] $allow_insecure = undef, |
| 116 | + Optional[Boolean] $check_valid_until = undef, |
| 117 | + Boolean $notify_update = true, |
142 | 118 | ) { |
143 | 119 | include apt |
144 | 120 |
|
|
305 | 281 | if !$location { |
306 | 282 | fail('You must specify a list of URIs for the apt::source resource') |
307 | 283 | } |
308 | | - if (type($location =~ String)) { |
| 284 | + if (type($location, 'generalized') !~ Type[Array]) { |
309 | 285 | warning('For deb822 sources, location must be specified as an array.') |
310 | 286 | $_location = [$location] |
311 | 287 | } |
|
320 | 296 | fail('os.distro.codename fact not available: release parameter required') |
321 | 297 | } |
322 | 298 | } else { |
323 | | - if (type($release) =~ String) { |
| 299 | + if (type($release, 'generalized') !~ Type[Array]) { |
324 | 300 | warning("For deb822 sources, 'release' must be specified as an array. Converting to array.") |
325 | 301 | $_release = [$release] |
326 | 302 | } else { |
327 | 303 | $_release = $release |
328 | 304 | } |
329 | 305 | } |
330 | 306 |
|
331 | | - if (type($repos) =~ String) { |
| 307 | + if (type($repos, 'generalized') !~ Type[Array]) { |
332 | 308 | warning("For deb822 sources, 'repos' must be specified as an array. Converting to array.") |
333 | 309 | $_repos = split($repos, /\s+/) |
334 | 310 | } else { |
335 | 311 | $_repos = $repos |
336 | 312 | } |
337 | 313 |
|
338 | 314 | if $architecture != undef { |
339 | | - if (type($architecture =~ String)) { |
| 315 | + if (type($architecture, 'generalized') !~ Type[Array]) { |
340 | 316 | warning("For deb822 sources, 'architecture' must be specified as an array. Converting to array.") |
341 | 317 | $_architecture = split($architecture, '[,]') |
342 | 318 | } |
|
358 | 334 | 'enabled' => $enabled ? { true => 'yes', false => 'no' }, |
359 | 335 | 'architectures' => $_architecture, |
360 | 336 | 'allow_insecure' => $allow_insecure ? { true => 'yes', false => 'no', default => undef }, |
361 | | - 'repo_trusted' => $repo_trusted ? { true => 'yes', false => 'no', default => undef }, |
| 337 | + 'repo_trusted' => $allow_unsigned ? { true => 'yes', false => 'no', default => undef }, |
362 | 338 | 'check_valid_until' => $check_valid_until ? { true => 'yes', false => 'no', default => undef }, |
363 | | - 'signed_by' => $signed_by, |
| 339 | + 'signed_by' => $keyring, |
364 | 340 | } |
365 | 341 | ) |
366 | 342 | ) |
|
0 commit comments