Skip to content

Commit

Permalink
keyring: rename parameters to remove redundancy
Browse files Browse the repository at this point in the history
We don't need apt::keyring::keyring_thing, it should just be
apt::keyring::thing.
  • Loading branch information
kenyon committed Nov 21, 2023
1 parent 782a790 commit 84be574
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
18 changes: 9 additions & 9 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -665,39 +665,39 @@ apt::source { 'puppet8-release':

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

* [`keyring_dir`](#-apt--keyring--keyring_dir)
* [`keyring_filename`](#-apt--keyring--keyring_filename)
* [`keyring_file`](#-apt--keyring--keyring_file)
* [`keyring_file_mode`](#-apt--keyring--keyring_file_mode)
* [`dir`](#-apt--keyring--dir)
* [`filename`](#-apt--keyring--filename)
* [`file`](#-apt--keyring--file)
* [`mode`](#-apt--keyring--mode)
* [`source`](#-apt--keyring--source)
* [`content`](#-apt--keyring--content)
* [`ensure`](#-apt--keyring--ensure)

##### <a name="-apt--keyring--keyring_dir"></a>`keyring_dir`
##### <a name="-apt--keyring--dir"></a>`dir`

Data type: `Stdlib::Absolutepath`

Path to the directory where the keyring will be stored.

Default value: `'/etc/apt/keyrings'`

##### <a name="-apt--keyring--keyring_filename"></a>`keyring_filename`
##### <a name="-apt--keyring--filename"></a>`filename`

Data type: `String[1]`

Optional filename for the keyring. It should also contain extension along with the filename.

Default value: `$name`

##### <a name="-apt--keyring--keyring_file"></a>`keyring_file`
##### <a name="-apt--keyring--file"></a>`file`

Data type: `Stdlib::Absolutepath`

File path of the keyring.

Default value: `"${keyring_dir}/${keyring_filename}"`
Default value: `"${dir}/${filename}"`

##### <a name="-apt--keyring--keyring_file_mode"></a>`keyring_file_mode`
##### <a name="-apt--keyring--mode"></a>`mode`

Data type: `Stdlib::Filemode`

Expand Down
24 changes: 12 additions & 12 deletions manifests/keyring.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
# }
# }
#
# @param keyring_dir
# @param dir
# Path to the directory where the keyring will be stored.
#
# @param keyring_filename
# @param filename
# Optional filename for the keyring. It should also contain extension along with the filename.
#
# @param keyring_file
# @param file
# File path of the keyring.
#
# @param keyring_file_mode
# @param mode
# File permissions of the keyring.
#
# @param source
Expand All @@ -36,15 +36,15 @@
# Ensure presence or absence of the resource.
#
define apt::keyring (
Stdlib::Absolutepath $keyring_dir = '/etc/apt/keyrings',
String[1] $keyring_filename = $name,
Stdlib::Absolutepath $keyring_file = "${keyring_dir}/${keyring_filename}",
Stdlib::Filemode $keyring_file_mode = '0644',
Stdlib::Absolutepath $dir = '/etc/apt/keyrings',
String[1] $filename = $name,
Stdlib::Absolutepath $file = "${dir}/${filename}",
Stdlib::Filemode $mode = '0644',
Optional[Stdlib::Filesource] $source = undef,
Optional[String[1]] $content = undef,
Enum['present','absent'] $ensure = 'present',
) {
ensure_resource('file', $keyring_dir, { ensure => 'directory', mode => '0755', })
ensure_resource('file', $dir, { ensure => 'directory', mode => '0755', })
if $source and $content {
fail("Parameters 'source' and 'content' are mutually exclusive")
} elsif ! $source and ! $content {
Expand All @@ -53,17 +53,17 @@

case $ensure {
'present': {
file { $keyring_file:
file { $file:
ensure => 'file',
mode => $keyring_file_mode,
mode => $mode,
owner => 'root',
group => 'root',
source => $source,
content => $content,
}
}
'absent': {
file { $keyring_file:
file { $file:
ensure => $ensure,
}
}
Expand Down
10 changes: 5 additions & 5 deletions manifests/source.pp
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,11 @@
# Modern apt keyrings
elsif $_key =~ Hash and $_key['name'] {
apt::keyring { $_key['name']:
ensure => $_key_ensure,
content => $_key['content'],
source => $_key['source'],
keyring_filename => $_key['filename'],
before => $_before,
ensure => $_key_ensure,
content => $_key['content'],
source => $_key['source'],
filename => $_key['filename'],
before => $_before,
}
# TODO replace this block with a reference to the apt::keyring's final filename/full_path
if $_key['filename'] {
Expand Down

0 comments on commit 84be574

Please sign in to comment.