Skip to content

Commit

Permalink
Merge branch 'main' into fix-ppa-fork-file
Browse files Browse the repository at this point in the history
  • Loading branch information
llavaud authored Jan 6, 2025
2 parents 76399fc + 966d39c commit 9fc573f
Show file tree
Hide file tree
Showing 11 changed files with 488 additions and 160 deletions.
45 changes: 42 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,35 @@ All notable changes to this project will be documented in this file.

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).

## [v10.0.0](https://github.com/puppetlabs/puppetlabs-apt/tree/v10.0.0) - 2024-11-25

[Full Changelog](https://github.com/puppetlabs/puppetlabs-apt/compare/v9.4.0...v10.0.0)

### Changed

- Debian: add non-free-firmware repo component [#1180](https://github.com/puppetlabs/puppetlabs-apt/pull/1180) ([kenyon](https://github.com/kenyon))
- Drop support for EoL Debian 10 "buster" [#1177](https://github.com/puppetlabs/puppetlabs-apt/pull/1177) ([kenyon](https://github.com/kenyon))

### Added

- Add Debian 12 "bookworm" support [#1178](https://github.com/puppetlabs/puppetlabs-apt/pull/1178) ([kenyon](https://github.com/kenyon))

### Fixed

- apt::setting: Dont expect source/content when removing settings [#1208](https://github.com/puppetlabs/puppetlabs-apt/pull/1208) ([bastelfreak](https://github.com/bastelfreak))

### Other

- apt::keyring: Require "source" or "content" only if ensure=present [#1198](https://github.com/puppetlabs/puppetlabs-apt/pull/1198) ([webcompas](https://github.com/webcompas))
- Eliminate `params.pp` and `create_resources()` [#1172](https://github.com/puppetlabs/puppetlabs-apt/pull/1172) ([kenyon](https://github.com/kenyon))

## [v9.4.0](https://github.com/puppetlabs/puppetlabs-apt/tree/v9.4.0) - 2024-02-15

[Full Changelog](https://github.com/puppetlabs/puppetlabs-apt/compare/v9.2.0...v9.4.0)
[Full Changelog](https://github.com/puppetlabs/puppetlabs-apt/compare/v9.3.0...v9.4.0)

## [v9.3.0](https://github.com/puppetlabs/puppetlabs-apt/tree/v9.3.0) - 2024-02-15

[Full Changelog](https://github.com/puppetlabs/puppetlabs-apt/compare/v9.2.0...v9.3.0)

### Added

Expand Down Expand Up @@ -42,6 +68,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
[Full Changelog](https://github.com/puppetlabs/puppetlabs-apt/compare/v9.0.2...v9.1.0)

### Changed

- (CONT-773) Add Support for Puppet 8 / Remove Support for Puppet 6 [#1101](https://github.com/puppetlabs/puppetlabs-apt/pull/1101) ([david22swan](https://github.com/david22swan))

### Added
Expand Down Expand Up @@ -85,6 +112,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
[Full Changelog](https://github.com/puppetlabs/puppetlabs-apt/compare/v8.5.0...v9.0.0)

### Changed

- Harden PPA defined type [#1052](https://github.com/puppetlabs/puppetlabs-apt/pull/1052) ([chelnak](https://github.com/chelnak))

### Added
Expand Down Expand Up @@ -117,6 +145,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
[Full Changelog](https://github.com/puppetlabs/puppetlabs-apt/compare/v8.3.0...v8.4.0)

### Changed

- (GH-iac-334) Remove code specific to unsupported OSs [#1024](https://github.com/puppetlabs/puppetlabs-apt/pull/1024) ([david22swan](https://github.com/david22swan))

### Added
Expand Down Expand Up @@ -194,6 +223,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
[Full Changelog](https://github.com/puppetlabs/puppetlabs-apt/compare/v7.7.1...v8.0.0)

### Changed

- pdksync - Remove Puppet 5 from testing and bump minimal version to 6.0.0 [#969](https://github.com/puppetlabs/puppetlabs-apt/pull/969) ([carabasdaniel](https://github.com/carabasdaniel))

## [v7.7.1](https://github.com/puppetlabs/puppetlabs-apt/tree/v7.7.1) - 2021-02-16
Expand Down Expand Up @@ -282,8 +312,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a

### Fixed

- MODULES-10063, extend apt::key to support deeplinks, this time with f… [#894](https://github.com/puppetlabs/puppetlabs-apt/pull/894) ([atarax](https://github.com/atarax))
- MODULES-10063, extend apt::key to support deeplinks [#892](https://github.com/puppetlabs/puppetlabs-apt/pull/892) ([atarax](https://github.com/atarax))
- MODULES-10063, extend apt::key to support deeplinks, this time with f… [#894](https://github.com/puppetlabs/puppetlabs-apt/pull/894) ([kaessert](https://github.com/kaessert))
- MODULES-10063, extend apt::key to support deeplinks [#892](https://github.com/puppetlabs/puppetlabs-apt/pull/892) ([kaessert](https://github.com/kaessert))

## [v7.2.0](https://github.com/puppetlabs/puppetlabs-apt/tree/v7.2.0) - 2019-10-29

Expand Down Expand Up @@ -317,6 +347,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
[Full Changelog](https://github.com/puppetlabs/puppetlabs-apt/compare/6.3.0...7.0.0)

### Changed

- pdksync - (MODULES-8444) - Raise lower Puppet bound [#853](https://github.com/puppetlabs/puppetlabs-apt/pull/853) ([david22swan](https://github.com/david22swan))

### Added
Expand Down Expand Up @@ -389,6 +420,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
[Full Changelog](https://github.com/puppetlabs/puppetlabs-apt/compare/5.0.1...6.0.0)

### Changed

- (MODULES-7668) Remove support for Puppet 4.7 [#780](https://github.com/puppetlabs/puppetlabs-apt/pull/780) ([jarretlavallee](https://github.com/jarretlavallee))

### Added
Expand All @@ -409,6 +441,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
[Full Changelog](https://github.com/puppetlabs/puppetlabs-apt/compare/4.5.1...5.0.0)

### Changed

- [FM-6956] Removal of unsupported Debian 7 from apt [#760](https://github.com/puppetlabs/puppetlabs-apt/pull/760) ([david22swan](https://github.com/david22swan))

### Added
Expand Down Expand Up @@ -521,6 +554,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
[Full Changelog](https://github.com/puppetlabs/puppetlabs-apt/compare/2.3.0...2.4.0)

### Changed

- Use stdlib deprecation [#641](https://github.com/puppetlabs/puppetlabs-apt/pull/641) ([DavidS](https://github.com/DavidS))

### Added
Expand Down Expand Up @@ -618,6 +652,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
[Full Changelog](https://github.com/puppetlabs/puppetlabs-apt/compare/2.0.1...2.1.0)

### Changed

- API compatibility between 1.8.x and 2.x for apt::source [#529](https://github.com/puppetlabs/puppetlabs-apt/pull/529) ([underscorgan](https://github.com/underscorgan))

### Added
Expand Down Expand Up @@ -666,6 +701,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
[Full Changelog](https://github.com/puppetlabs/puppetlabs-apt/compare/1.7.0...1.8.0)

### Changed

- Various major behavioural changes [#447](https://github.com/puppetlabs/puppetlabs-apt/pull/447) ([daenney](https://github.com/daenney))
- V2.0.0 Prep work: Removing old code / Adding placeholders [#424](https://github.com/puppetlabs/puppetlabs-apt/pull/424) ([underscorgan](https://github.com/underscorgan))

Expand Down Expand Up @@ -822,6 +858,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
[Full Changelog](https://github.com/puppetlabs/puppetlabs-apt/compare/1.4.0...1.4.1)

### Changed

- Handling of release parameter and apt provider in force manifest [#140](https://github.com/puppetlabs/puppetlabs-apt/pull/140) ([hunner](https://github.com/hunner))

### Added
Expand Down Expand Up @@ -880,6 +917,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
[Full Changelog](https://github.com/puppetlabs/puppetlabs-apt/compare/1.1.0...1.1.1)

### Changed

- Restrict the versions and add 3.1 [#112](https://github.com/puppetlabs/puppetlabs-apt/pull/112) ([richardc](https://github.com/richardc))

### Added
Expand Down Expand Up @@ -909,6 +947,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
[Full Changelog](https://github.com/puppetlabs/puppetlabs-apt/compare/0.0.4...1.0.0)

### Changed

- Without puppetlabs/stdlib, you will get "err: Could not retrieve catalog... [#75](https://github.com/puppetlabs/puppetlabs-apt/pull/75) ([ytjohn](https://github.com/ytjohn))

### Added
Expand Down
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,27 @@ apt::source { 'puppetlabs':

<a id="configure-apt-from-hiera"></a>

### Generating a DEB822 .sources file

You can also generate a DEB822 format .sources file. This example covers most of the available options.

Use the `source_format` parameter to choose between 'list' and 'sources' (DEB822) formats.
```puppet
apt::source { 'debian':
source_format => 'sources'
comment => 'Official Debian Repository',
enabled => true,
types => ['deb', 'deb-src'],
location => ['http://fr.debian.org/debian', 'http://de.debian.org/debian']
release => ['stable', 'stable-updates', 'stable-backports'],
repos => ['main', 'contrib', 'non-free'],
architecture => ['amd64', 'i386'],
allow_unsigned => true,
keyring => '/etc/apt/keyrings/debian.gpg'
notify_update => false
}
```

### Configure Apt from Hiera

Instead of specifying your sources directly as resources, you can instead just include the `apt` class, which will pick up the values automatically from hiera.
Expand Down
68 changes: 57 additions & 11 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,10 @@ Default value:
'path' => $sources_list_d,
'ext' => '.list',
},
'sources' => {
'path' => $sources_list_d,
'ext' => '.sources',
},
}
```

Expand Down Expand Up @@ -1088,11 +1092,25 @@ apt::source { 'puppetlabs':
}
```

##### Install the puppetlabs apt source (deb822 format)

```puppet
apt::source { 'puppetlabs':
source_format => 'sources'
location => ['http://apt.puppetlabs.com'],
repos => ['puppet8'],
keyring => '/etc/apt/keyrings/puppetlabs.gpg',
}
```

#### Parameters

The following parameters are available in the `apt::source` defined type:

* [`source_format`](#-apt--source--source_format)
* [`location`](#-apt--source--location)
* [`types`](#-apt--source--types)
* [`enabled`](#-apt--source--enabled)
* [`comment`](#-apt--source--comment)
* [`ensure`](#-apt--source--ensure)
* [`release`](#-apt--source--release)
Expand All @@ -1107,14 +1125,39 @@ The following parameters are available in the `apt::source` defined type:
* [`notify_update`](#-apt--source--notify_update)
* [`check_valid_until`](#-apt--source--check_valid_until)

##### <a name="-apt--source--source_format"></a>`source_format`

Data type: `Enum['list', 'sources']`

The file format to use for the apt source. See https://wiki.debian.org/SourcesList

Default value: `'list'`

##### <a name="-apt--source--location"></a>`location`

Data type: `Optional[String[1]]`
Data type: `Optional[Variant[String[1], Array[String[1]]]]`

Required, unless ensure is set to 'absent'. Specifies an Apt repository.
Required, unless ensure is set to 'absent'. Specifies an Apt repository. Valid options: a string containing a repository URL.
DEB822: Supports an array of URL values

Default value: `undef`

##### <a name="-apt--source--types"></a>`types`

Data type: `Array[Enum['deb','deb-src'], 1, 2]`

DEB822: The package types this source manages.

Default value: `['deb']`

##### <a name="-apt--source--enabled"></a>`enabled`

Data type: `Boolean`

DEB822: Enable or Disable the APT source.

Default value: `true`

##### <a name="-apt--source--comment"></a>`comment`

Data type: `String[1]`
Expand All @@ -1133,17 +1176,19 @@ Default value: `present`

##### <a name="-apt--source--release"></a>`release`

Data type: `Optional[String[0]]`
Data type: `Optional[Variant[String[0], Array[String[0]]]]`

Specifies a distribution of the Apt repository.
DEB822: Supports an array of values

Default value: `undef`

##### <a name="-apt--source--repos"></a>`repos`

Data type: `String[1]`
Data type: `Variant[String[1], Array[String[1]]]`

Specifies a component of the Apt repository.
DEB822: Supports an array of values

Default value: `'main'`

Expand Down Expand Up @@ -1194,29 +1239,30 @@ Default value: `undef`

##### <a name="-apt--source--architecture"></a>`architecture`

Data type: `Optional[String[1]]`
Data type: `Optional[Variant[String[1], Array[String[1]]]]`

Tells Apt to only download information for specified architectures. Valid options: a string containing one or more architecture names,
separated by commas (e.g., 'i386' or 'i386,alpha,powerpc').
(if unspecified, Apt downloads information for all architectures defined in the Apt::Architectures option)
DEB822: Supports an array of values

Default value: `undef`

##### <a name="-apt--source--allow_unsigned"></a>`allow_unsigned`

Data type: `Boolean`
Data type: `Optional[Boolean]`

Specifies whether to authenticate packages from this release, even if the Release file is not signed or the signature can't be checked.

Default value: `false`
Default value: `undef`

##### <a name="-apt--source--allow_insecure"></a>`allow_insecure`

Data type: `Boolean`
Data type: `Optional[Boolean]`

Specifies whether to allow downloads from insecure repositories.

Default value: `false`
Default value: `undef`

##### <a name="-apt--source--notify_update"></a>`notify_update`

Expand All @@ -1228,11 +1274,11 @@ Default value: `true`

##### <a name="-apt--source--check_valid_until"></a>`check_valid_until`

Data type: `Boolean`
Data type: `Optional[Boolean]`

Specifies whether to check if the package release date is valid.

Default value: `true`
Default value: `undef`

## Data types

Expand Down
2 changes: 1 addition & 1 deletion lib/facter/apt_sources.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
confine osfamily: 'Debian'
setcode do
sources = ['sources.list']
Dir.glob('/etc/apt/sources.list.d/*.list').each do |file|
Dir.glob('/etc/apt/sources.list.d/*.{list,sources}').each do |file|
sources.push(File.basename(file))
end
sources
Expand Down
4 changes: 4 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,10 @@
'path' => $sources_list_d,
'ext' => '.list',
},
'sources' => {
'path' => $sources_list_d,
'ext' => '.sources',
},
},
Boolean $sources_list_force = false,
Hash $source_key_defaults = {
Expand Down
6 changes: 5 additions & 1 deletion manifests/ppa.pp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@
$underscore_filename_no_slashes = regsubst($underscore_filename, '/', '-', 'G')
$underscore_filename_no_specialchars = regsubst($underscore_filename_no_slashes, '[\.\+]', '_', 'G')

$sources_list_d_filename = "${dash_filename_no_specialchars}-${release}.list"
$sources_list_d_filename = if versioncmp($facts['os']['release']['full'], '23.10') < 0 {
"${dash_filename_no_specialchars}-${release}.list"
} else {
"${dash_filename_no_specialchars}-${release}.sources"
}

if versioncmp($facts['os']['release']['full'], '21.04') < 0 {
$trusted_gpg_d_filename = "${underscore_filename_no_specialchars}.gpg"
Expand Down
6 changes: 3 additions & 3 deletions manifests/setting.pp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
$setting_type = $title_array[0]
$base_name = join(delete_at($title_array, 0), '-')

assert_type(Pattern[/\Aconf\z/, /\Apref\z/, /\Alist\z/], $setting_type) |$a, $b| {
fail("apt::setting resource name/title must start with either 'conf-', 'pref-' or 'list-'")
assert_type(Pattern[/\Aconf\z/, /\Apref\z/, /\Alist\z/, /\Asources\z/], $setting_type) |$a, $b| {
fail("apt::setting resource name/title must start with either 'conf-', 'pref-', 'list-', or 'sources-'")
}

if $priority !~ Integer {
Expand All @@ -51,7 +51,7 @@
}
}

if ($setting_type == 'list') or ($setting_type == 'pref') {
if $setting_type in ['list', 'pref', 'sources'] {
$_priority = ''
} else {
$_priority = $priority
Expand Down
Loading

0 comments on commit 9fc573f

Please sign in to comment.