Skip to content

Commit 9e318cb

Browse files
authored
Merge branch 'main' into bwitt/ubuntu-24.04
2 parents 7d7194d + 677b2b3 commit 9e318cb

File tree

10 files changed

+184
-5
lines changed

10 files changed

+184
-5
lines changed

CHANGELOG.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,32 @@ All notable changes to this project will be documented in this file.
55

66
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org).
77

8-
## [v10.0.1](https://github.com/puppetlabs/puppetlabs-apt/tree/v10.0.1) - 2025-01-24
8+
## [v11.1.0](https://github.com/puppetlabs/puppetlabs-apt/tree/v11.1.0) - 2025-09-22
9+
10+
[Full Changelog](https://github.com/puppetlabs/puppetlabs-apt/compare/v11.0.0...v11.1.0)
11+
12+
### Added
13+
14+
- add auth.conf.d resources [#1087](https://github.com/puppetlabs/puppetlabs-apt/pull/1087) ([aba-rechsteiner](https://github.com/aba-rechsteiner))
15+
16+
## [v11.0.0](https://github.com/puppetlabs/puppetlabs-apt/tree/v11.0.0) - 2025-09-05
17+
18+
[Full Changelog](https://github.com/puppetlabs/puppetlabs-apt/compare/v10.0.1...v11.0.0)
19+
20+
### Changed
21+
22+
- (CAT-2354) Puppetcore update [#1240](https://github.com/puppetlabs/puppetlabs-apt/pull/1240) ([LukasAud](https://github.com/LukasAud))
23+
24+
### Fixed
25+
26+
- join key dir and key filename/name with slash "/" [#1233](https://github.com/puppetlabs/puppetlabs-apt/pull/1233) ([wolfaba](https://github.com/wolfaba))
27+
- Suites with a path don't get components [#1229](https://github.com/puppetlabs/puppetlabs-apt/pull/1229) ([jstraw](https://github.com/jstraw))
28+
29+
### Other
30+
31+
- (MODULES-11617) Replace apt with apt-cache when using with grep [#1248](https://github.com/puppetlabs/puppetlabs-apt/pull/1248) ([shubhamshinde360](https://github.com/shubhamshinde360))
32+
33+
## [v10.0.1](https://github.com/puppetlabs/puppetlabs-apt/tree/v10.0.1) - 2025-01-27
934

1035
[Full Changelog](https://github.com/puppetlabs/puppetlabs-apt/compare/v10.0.0...v10.0.1)
1136

REFERENCE.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
### Defined types
1919

20+
* [`apt::auth`](#apt--auth)
2021
* [`apt::conf`](#apt--conf): Specifies a custom Apt configuration file.
2122
* [`apt::key`](#apt--key): Manages the GPG keys that Apt uses to authenticate packages.
2223
* [`apt::keyring`](#apt--keyring): Manage GPG keyrings for apt repositories
@@ -72,6 +73,7 @@ The following parameters are available in the `apt` class:
7273
* [`proxy`](#-apt--proxy)
7374
* [`proxy_defaults`](#-apt--proxy_defaults)
7475
* [`sources`](#-apt--sources)
76+
* [`auths`](#-apt--auths)
7577
* [`keys`](#-apt--keys)
7678
* [`keyrings`](#-apt--keyrings)
7779
* [`ppas`](#-apt--ppas)
@@ -90,6 +92,7 @@ The following parameters are available in the `apt` class:
9092
* [`sources_list_force`](#-apt--sources_list_force)
9193
* [`include_defaults`](#-apt--include_defaults)
9294
* [`apt_conf_d`](#-apt--apt_conf_d)
95+
* [`auth_conf_d`](#-apt--auth_conf_d)
9396
* [`source_key_defaults`](#-apt--source_key_defaults)
9497

9598
##### <a name="-apt--provider"></a>`provider`
@@ -226,6 +229,7 @@ Default value:
226229
'preferences' => false,
227230
'preferences.d' => false,
228231
'apt.conf.d' => false,
232+
'auth.conf.d' => false,
229233
}
230234
```
231235

@@ -264,6 +268,14 @@ Hash of `apt::source` resources.
264268

265269
Default value: `{}`
266270

271+
##### <a name="-apt--auths"></a>`auths`
272+
273+
Data type: `Hash`
274+
275+
Creates new `apt::auth` resources. Valid options: a hash to be passed to the create_resources function linked above.
276+
277+
Default value: `{}`
278+
267279
##### <a name="-apt--keys"></a>`keys`
268280

269281
Data type: `Hash`
@@ -440,6 +452,14 @@ The path to the file `apt.conf.d`
440452

441453
Default value: `"${root}/apt.conf.d"`
442454

455+
##### <a name="-apt--auth_conf_d"></a>`auth_conf_d`
456+
457+
Data type: `Stdlib::Absolutepath`
458+
459+
The path to the file `auth_conf.d`
460+
461+
Default value: `"${root}/auth.conf.d"`
462+
443463
##### <a name="-apt--source_key_defaults"></a>`source_key_defaults`
444464

445465
Data type: `Hash`
@@ -555,6 +575,51 @@ Default value: `{}`
555575

556576
## Defined types
557577

578+
### <a name="apt--auth"></a>`apt::auth`
579+
580+
The apt::auth class.
581+
582+
#### Parameters
583+
584+
The following parameters are available in the `apt::auth` defined type:
585+
586+
* [`ensure`](#-apt--auth--ensure)
587+
* [`machine`](#-apt--auth--machine)
588+
* [`login`](#-apt--auth--login)
589+
* [`password`](#-apt--auth--password)
590+
591+
##### <a name="-apt--auth--ensure"></a>`ensure`
592+
593+
Data type: `String`
594+
595+
596+
597+
Default value: `'present'`
598+
599+
##### <a name="-apt--auth--machine"></a>`machine`
600+
601+
Data type: `String`
602+
603+
604+
605+
Default value: `$name`
606+
607+
##### <a name="-apt--auth--login"></a>`login`
608+
609+
Data type: `String`
610+
611+
612+
613+
Default value: `undef`
614+
615+
##### <a name="-apt--auth--password"></a>`password`
616+
617+
Data type: `String`
618+
619+
620+
621+
Default value: `undef`
622+
558623
### <a name="apt--conf"></a>`apt::conf`
559624

560625
Specifies a custom Apt configuration file.

data/os/Debian/11.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
apt::backports:
2+
location: http://archive.debian.org/debian
3+
repos: main contrib non-free

manifests/auth.pp

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# @summary Manages the Apt auth conf in /etc/apt/auth.conf.d/.
2+
#
3+
# @example Install the puppetlabs apt auth
4+
# apt::auth { 'puppetlabs':
5+
# machine => 'apt.puppetlabs.com',
6+
# login => 'apt',
7+
# password => 'password',
8+
# }
9+
#
10+
# @param ensure
11+
# Specifies whether the Apt auth file should exist. Valid options: 'present' and 'absent'.
12+
#
13+
# @param machine
14+
# The machine entry specifies the auth URI.
15+
#
16+
# @param login
17+
# The username to be used.
18+
#
19+
# @param password
20+
# The password to be used.
21+
#
22+
23+
define apt::auth (
24+
String $ensure = 'present',
25+
String $machine = $name,
26+
String $login = undef,
27+
String $password = undef,
28+
) {
29+
$content = epp('apt/auth_conf.d.epp',
30+
machine => $machine,
31+
login => $login,
32+
password => $password
33+
)
34+
35+
file { "${apt::auth_conf_d}/${name}.conf":
36+
ensure => $ensure,
37+
owner => $apt::auth_conf_owner,
38+
group => 'root',
39+
mode => '0600',
40+
content => Sensitive($content),
41+
notify => Class['apt::update'],
42+
}
43+
}

manifests/init.pp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@
8787
# @param sources
8888
# Hash of `apt::source` resources.
8989
#
90+
# @param auths
91+
# Creates new `apt::auth` resources. Valid options: a hash to be passed to the create_resources function linked above.
92+
#
9093
# @param keys
9194
# Hash of `apt::key` resources.
9295
#
@@ -145,6 +148,9 @@
145148
# @param apt_conf_d
146149
# The path to the file `apt.conf.d`
147150
#
151+
# @param auth_conf_d
152+
# The path to the file `auth_conf.d`
153+
#
148154
# @param source_key_defaults
149155
# The fault `source_key` settings
150156
#
@@ -161,6 +167,7 @@
161167
'preferences' => false,
162168
'preferences.d' => false,
163169
'apt.conf.d' => false,
170+
'auth.conf.d' => false,
164171
},
165172
Hash $proxy_defaults = {
166173
'ensure' => undef,
@@ -185,6 +192,7 @@
185192
Hash $purge = {},
186193
Apt::Proxy $proxy = {},
187194
Hash $sources = {},
195+
Hash $auths = {},
188196
Hash $keys = {},
189197
Hash $keyrings = {},
190198
Hash $ppas = {},
@@ -200,6 +208,7 @@
200208
Stdlib::Absolutepath $preferences = "${root}/preferences",
201209
Stdlib::Absolutepath $preferences_d = "${root}/preferences.d",
202210
Stdlib::Absolutepath $apt_conf_d = "${root}/apt.conf.d",
211+
Stdlib::Absolutepath $auth_conf_d = "${root}/auth.conf.d",
203212
Hash $config_files = {
204213
'conf' => {
205214
'path' => $conf_d,
@@ -264,6 +273,9 @@
264273
if $purge['apt.conf.d'] {
265274
assert_type(Boolean, $purge['apt.conf.d'])
266275
}
276+
if $purge['auth.conf.d'] {
277+
assert_type(Boolean, $purge['auth.conf.d'])
278+
}
267279

268280
$_purge = $apt::purge_defaults + $purge
269281

@@ -379,6 +391,16 @@
379391
notify => Class['apt::update'],
380392
}
381393

394+
file { 'auth.conf.d':
395+
ensure => directory,
396+
path => $apt::auth_conf_d,
397+
owner => root,
398+
group => root,
399+
purge => $_purge['auth.conf.d'],
400+
recurse => $_purge['auth.conf.d'],
401+
notify => Class['apt::update'],
402+
}
403+
382404
$confs.each |$key, $value| {
383405
apt::conf { $key:
384406
* => $value,
@@ -391,6 +413,12 @@
391413
}
392414
}
393415

416+
$auths.each |$key, $value| {
417+
apt::auth { $key:
418+
* => $value,
419+
}
420+
}
421+
394422
$keys.each |$key, $value| {
395423
apt::key { $key:
396424
* => $value,

manifests/source.pp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,11 @@
217217
}
218218

219219
$_list_keyring = if $_key['dir'] and $_key['filename'] {
220-
"${_key['dir']}${_key['filename']}"
220+
"${_key['dir']}/${_key['filename']}"
221221
} elsif $_key['filename'] {
222222
"/etc/apt/keyrings/${_key['filename']}"
223223
} elsif $_key['dir'] {
224-
"${_key['dir']}${_key['name']}"
224+
"${_key['dir']}/${_key['name']}"
225225
} else {
226226
"/etc/apt/keyrings/${_key['name']}"
227227
}

metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "puppetlabs-apt",
3-
"version": "10.0.1",
3+
"version": "11.1.0",
44
"author": "puppetlabs",
55
"summary": "Provides an interface for managing Apt source, key, and definitions with Puppet",
66
"license": "Apache-2.0",

spec/acceptance/apt_backports_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
end
1818

1919
it 'provides backports apt sources' do
20-
run_shell('apt policy | grep --quiet backports')
20+
run_shell('apt-cache policy | grep --quiet backports')
2121
end
2222
end
2323
end

spec/classes/apt_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@
3838
recurse: false,
3939
notify: 'Class[Apt::Update]' }
4040

41+
auth_conf_d = { ensure: 'directory',
42+
path: '/etc/apt/auth.conf.d',
43+
owner: 'root',
44+
group: 'root',
45+
purge: false,
46+
recurse: false,
47+
notify: 'Class[Apt::Update]' }
48+
4149
describe 'apt' do
4250
let(:facts) do
4351
{
@@ -77,6 +85,10 @@
7785
expect(subject).to contain_file('apt.conf.d').that_notifies('Class[Apt::Update]').only_with(apt_conf_d)
7886
}
7987

88+
it {
89+
is_expected.to contain_file('auth.conf.d').that_notifies('Class[Apt::Update]').only_with(auth_conf_d)
90+
}
91+
8092
it { is_expected.to contain_file('/etc/apt/auth.conf').with_ensure('absent') }
8193

8294
it 'lays down /etc/apt/apt.conf.d/15update-stamp' do

templates/auth_conf.d.epp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
machine <%= $machine %>
2+
login <%= $login %>
3+
password <%= $password %>

0 commit comments

Comments
 (0)