|
116 | 116 | # Specifies whether to check if the package release date is valid.
|
117 | 117 | #
|
118 | 118 | define apt::source (
|
119 |
| - Enum['list', 'sources'] $source_format = 'list', |
| 119 | + Enum['list', 'sources'] $source_format = 'list', |
120 | 120 | Array[Enum['deb','deb-src'], 1, 2] $types = ['deb'],
|
121 |
| - Optional[String] $location = undef, |
| 121 | + Optional[Variant[String, Array[String]]] $location = undef, |
122 | 122 | Optional[Array[String]] $uris = undef, # deb822
|
123 | 123 | Boolean $enabled = true, # deb822
|
124 | 124 | String $comment = $name,
|
125 | 125 | String $ensure = present,
|
126 |
| - Optional[String] $release = undef, |
| 126 | + Optional[Variant[String, Array[String]]] $release = undef, |
127 | 127 | Optional[Array[String]] $suites = undef, # deb822
|
128 |
| - String $repos = 'main', |
| 128 | + Variant[String, Array[String]] $repos = 'main', |
129 | 129 | Optional[Array[String]] $components = undef, # deb822
|
130 | 130 | Variant[Hash] $include = {},
|
131 | 131 | Optional[Variant[String, Hash]] $key = undef,
|
132 | 132 | Optional[Stdlib::AbsolutePath] $keyring = undef,
|
133 | 133 | Optional[Variant[Stdlib::AbsolutePath,Array[String]]] $signed_by = undef, # deb822
|
134 | 134 | Optional[Variant[Hash, Numeric, String]] $pin = undef,
|
135 |
| - Optional[String] $architecture = undef, |
| 135 | + Optional[Variant[String, Array[String]]] $architecture = undef, |
136 | 136 | Optional[Array[String]] $architectures = undef, # deb822
|
137 | 137 | Optional[Boolean] $allow_unsigned = undef,
|
138 | 138 | Optional[Boolean] $repo_trusted = undef, # deb822
|
|
156 | 156 | }
|
157 | 157 | } else {
|
158 | 158 | $_release = $release
|
| 159 | + # If the release is given as an array, use the first element only |
| 160 | + if (type($_release) =~ Array) { |
| 161 | + warning("Parameter, 'release', must be a string for 'list' format. Using the first array element instead.") |
| 162 | + $_release = $_release[0] |
| 163 | + } |
| 164 | + } |
| 165 | + |
| 166 | + if (type($repos =~ Array)) { |
| 167 | + $_repos = join($repos, ' ') |
| 168 | + } |
| 169 | + else { |
| 170 | + $_repos = $repos |
159 | 171 | }
|
160 | 172 |
|
161 | 173 | if $release =~ Pattern[/\/$/] {
|
162 | 174 | $_components = $_release
|
163 | 175 | } else {
|
164 |
| - $_components = "${_release} ${repos}" |
| 176 | + $_components = "${_release} ${_repos}" |
165 | 177 | }
|
166 | 178 |
|
167 | 179 | if $ensure == 'present' {
|
168 | 180 | if ! $location {
|
169 | 181 | fail('cannot create a source entry without specifying a location')
|
170 | 182 | }
|
171 |
| - elsif ($apt::proxy['https_acng']) and ($location =~ /(?i:^https:\/\/)/) { |
172 |
| - $_location = regsubst($location, 'https://','http://HTTPS///') |
173 |
| - } |
174 | 183 | else {
|
175 | 184 | $_location = $location
|
| 185 | + # If the location is given as an array, use the first element only |
| 186 | + if (type($_location) =~ Array) { |
| 187 | + warning("Parameter, 'location', must be a string for 'list' format. Using the first array element instead.") |
| 188 | + $_location = $_location[0] |
| 189 | + } |
| 190 | + if ($apt::proxy['https_acng']) and ($_location =~ /(?i:^https:\/\/)/) { |
| 191 | + $_location = regsubst($_location, 'https://','http://HTTPS///') |
| 192 | + } |
176 | 193 | }
|
177 | 194 | } else {
|
178 | 195 | $_location = undef
|
|
254 | 271 |
|
255 | 272 | if $architecture {
|
256 | 273 | $_architecture = regsubst($architecture, '\baarch64\b', 'arm64')
|
| 274 | + if (type($_architecture) =~ Array) { |
| 275 | + $_architecture = join($_architecture, ',') |
| 276 | + } |
257 | 277 | } else {
|
258 | 278 | $_architecture = undef
|
259 | 279 | }
|
|
0 commit comments