Skip to content

Commit

Permalink
Update source_format parameter
Browse files Browse the repository at this point in the history
Match the possible values to the file suffix of the created source
files.
  • Loading branch information
jamesps-ebi committed Jul 15, 2024
1 parent 2b6694e commit d977450
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1039,7 +1039,7 @@ apt::source { 'puppetlabs':

```puppet
apt::source { 'puppetlabs':
source_format => 'deb822'
source_format => 'sources'
uris => ['http://apt.puppetlabs.com'],
suites => [$facts['os']['distro']['codename']],
components => ['puppet8'],
Expand Down Expand Up @@ -1077,11 +1077,11 @@ The following parameters are available in the `apt::source` defined type:

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

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

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

Default value: `'legacy'`
Default value: `'list'`

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

Expand Down
12 changes: 6 additions & 6 deletions manifests/source.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#
# @example Install the puppetlabs apt source (deb822 format)
# apt::source { 'puppetlabs':
# source_format => 'deb822'
# source_format => 'sources'
# uris => ['http://apt.puppetlabs.com'],
# suites => [$facts['os']['distro']['codename']],
# components => ['puppet8'],
Expand Down Expand Up @@ -116,7 +116,7 @@
# Specifies whether to check if the package release date is valid. Defaults to `True`.
#
define apt::source (
Enum['legacy', 'deb822'] $source_format = 'legacy',
Enum['list', 'sources'] $source_format = 'list',
Array[Enum['deb','deb-src'], 1, 2] $types = ['deb'],
Optional[String] $location = undef,
Optional[Array[String]] $uris = undef, # deb822
Expand Down Expand Up @@ -145,8 +145,8 @@
$_before = Apt::Setting["list-${title}"]

case $source_format {
'legacy': {
$_file_suffix = 'list'
'list': {
$_file_suffix = $source_format

if !$release {
if fact('os.distro.codename') {
Expand Down Expand Up @@ -292,7 +292,7 @@
create_resources('apt::pin', { "${name}" => $_pin })
}
}
'deb822': {
'sources': {
if $pin {
fail('apt::source::pin parameter is not supported with deb822 format')
}
Expand All @@ -305,7 +305,7 @@
if !$components {
fail('You must specify a list of components for the apt::source resource')
}
$_file_suffix = 'sources'
$_file_suffix = $source_format
case $ensure {
'present': {
$header = epp('apt/_header.epp')
Expand Down

0 comments on commit d977450

Please sign in to comment.