Skip to content

Commit 89c55e8

Browse files
committed
use more specific data types
Also includes some corrections to documentation.
1 parent 5415131 commit 89c55e8

File tree

10 files changed

+166
-166
lines changed

10 files changed

+166
-166
lines changed

REFERENCE.md

Lines changed: 74 additions & 74 deletions
Large diffs are not rendered by default.

manifests/backports.pp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
# - Ubuntu: 'http://archive.ubuntu.com/ubuntu'
1313
#
1414
# @param release
15-
# Specifies a distribution of the Apt repository containing the backports to manage. Used in populating the `source.list` configuration file.
15+
# Specifies a distribution of the Apt repository containing the backports to manage. Used in populating the `sources.list` configuration file.
1616
# Default: on Debian and Ubuntu, `${fact('os.distro.codename')}-backports`. We recommend keeping this default, except on other operating
1717
# systems.
1818
#
1919
# @param repos
20-
# Specifies a component of the Apt repository containing the backports to manage. Used in populating the `source.list` configuration file.
20+
# Specifies a component of the Apt repository containing the backports to manage. Used in populating the `sources.list` configuration file.
2121
# Default value for Debian and Ubuntu varies:
2222
#
2323
# - Debian: 'main contrib non-free'
@@ -41,13 +41,13 @@
4141
# Specifies whether to include 'deb' or 'src', or both.
4242
#
4343
class apt::backports (
44-
Optional[String] $location = undef,
45-
Optional[String] $release = undef,
46-
Optional[String] $repos = undef,
47-
Optional[Variant[String, Hash]] $key = undef,
48-
Stdlib::AbsolutePath $keyring = "/usr/share/keyrings/${facts['os']['name'].downcase}-archive-keyring.gpg",
49-
Variant[Integer, String, Hash] $pin = 200,
50-
Variant[Hash] $include = {},
44+
Optional[Stdlib::HTTPUrl] $location = undef,
45+
Optional[String[1]] $release = undef,
46+
Optional[String[1]] $repos = undef,
47+
Optional[Variant[String[1], Hash]] $key = undef,
48+
Stdlib::AbsolutePath $keyring = "/usr/share/keyrings/${facts['os']['name'].downcase}-archive-keyring.gpg",
49+
Variant[Integer, String[1], Hash] $pin = 200,
50+
Hash $include = {},
5151
) {
5252
include apt
5353

manifests/conf.pp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44
# Required unless `ensure` is set to 'absent'. Directly supplies content for the configuration file.
55
#
66
# @param ensure
7-
# Specifies whether the configuration file should exist. Valid options: 'present' and 'absent'.
7+
# Specifies whether the configuration file should exist.
88
#
99
# @param priority
10-
# Determines the order in which Apt processes the configuration file. Files with lower priority numbers are loaded first.
10+
# Determines the order in which Apt processes the configuration file. Files with lower priority numbers are loaded first.
1111
# Valid options: a string containing an integer or an integer.
1212
#
1313
# @param notify_update
1414
# Specifies whether to trigger an `apt-get update` run.
1515
#
1616
define apt::conf (
17-
Optional[String] $content = undef,
18-
Enum['present', 'absent'] $ensure = present,
19-
Variant[String, Integer] $priority = 50,
20-
Optional[Boolean] $notify_update = undef,
17+
Optional[String[1]] $content = undef,
18+
Enum['present', 'absent'] $ensure = present,
19+
Variant[String[1], Integer[0]] $priority = 50,
20+
Optional[Boolean] $notify_update = undef,
2121
) {
2222
unless $ensure == 'absent' {
2323
unless $content {

manifests/init.pp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,11 @@
174174
'deb' => true,
175175
'src' => false,
176176
},
177-
String $provider = '/usr/bin/apt-get',
178-
String $keyserver = 'keyserver.ubuntu.com',
179-
Optional[String] $key_options = undef,
180-
Optional[Array[String]] $ppa_options = undef,
181-
Optional[String] $ppa_package = undef,
177+
Stdlib::Absolutepath $provider = '/usr/bin/apt-get',
178+
Stdlib::Host $keyserver = 'keyserver.ubuntu.com',
179+
Optional[String[1]] $key_options = undef,
180+
Optional[Array[String[1]]] $ppa_options = undef,
181+
Optional[String[1]] $ppa_package = undef,
182182
Optional[Hash] $backports = undef,
183183
Hash $confs = {},
184184
Hash $update = {},
@@ -192,14 +192,14 @@
192192
Hash $settings = {},
193193
Boolean $manage_auth_conf = true,
194194
Array[Apt::Auth_conf_entry] $auth_conf_entries = [],
195-
String $auth_conf_owner = '_apt',
196-
String $root = '/etc/apt',
197-
String $sources_list = "${root}/sources.list",
198-
String $sources_list_d = "${root}/sources.list.d",
199-
String $conf_d = "${root}/apt.conf.d",
200-
String $preferences = "${root}/preferences",
201-
String $preferences_d = "${root}/preferences.d",
202-
String $apt_conf_d = "${root}/apt.conf.d",
195+
String[1] $auth_conf_owner = '_apt',
196+
Stdlib::Absolutepath $root = '/etc/apt',
197+
Stdlib::Absolutepath $sources_list = "${root}/sources.list",
198+
Stdlib::Absolutepath $sources_list_d = "${root}/sources.list.d",
199+
Stdlib::Absolutepath $conf_d = "${root}/apt.conf.d",
200+
Stdlib::Absolutepath $preferences = "${root}/preferences",
201+
Stdlib::Absolutepath $preferences_d = "${root}/preferences.d",
202+
Stdlib::Absolutepath $apt_conf_d = "${root}/apt.conf.d",
203203
Hash $config_files = {
204204
'conf' => {
205205
'path' => $conf_d,

manifests/key.pp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# @summary Manages the GPG keys that Apt uses to authenticate packages.
1+
# @summary Manages the GPG keys that Apt uses to authenticate packages.
22
#
3-
# @note
3+
# @note
44
# The apt::key defined type makes use of the apt_key type, but includes extra functionality to help prevent duplicate keys.
55
#
66
# @example Declare Apt key for apt.puppetlabs.com source
@@ -11,38 +11,39 @@
1111
# }
1212
#
1313
# @param id
14-
# Specifies a GPG key to authenticate Apt package signatures. Valid options: a string containing a key ID (8 or 16 hexadecimal
14+
# Specifies a GPG key to authenticate Apt package signatures. Valid options: a string containing a key ID (8 or 16 hexadecimal
1515
# characters, optionally prefixed with "0x") or a full key fingerprint (40 hexadecimal characters).
1616
#
1717
# @param ensure
18-
# Specifies whether the key should exist. Valid options: 'present', 'absent' or 'refreshed'. Using 'refreshed' will make keys auto
19-
# update when they have expired (assuming a new key exists on the key server).
18+
# Specifies whether the key should exist. Using `refreshed` will make keys
19+
# auto update when they have expired (assuming a new key exists on the key
20+
# server).
2021
#
2122
# @param content
2223
# Supplies the entire GPG key. Useful in case the key can't be fetched from a remote location and using a file resource is inconvenient.
2324
#
2425
# @param source
25-
# Specifies the location of an existing GPG key file to copy. Valid options: a string containing a URL (ftp://, http://, or https://) or
26+
# Specifies the location of an existing GPG key file to copy. Valid options: a string containing a URL (ftp://, http://, or https://) or
2627
# an absolute path.
2728
#
2829
# @param server
2930
# Specifies a keyserver to provide the GPG key. Valid options: a string containing a domain name or a full URL (http://, https://,
3031
# hkp:// or hkps://). The hkps:// protocol is currently only supported on Ubuntu 18.04.
3132
#
3233
# @param weak_ssl
33-
# Specifies whether strict SSL verification on a https URL should be disabled. Valid options: true or false.
34+
# Specifies whether strict SSL verification on a https URL should be disabled.
3435
#
3536
# @param options
3637
# Passes additional options to `apt-key adv --keyserver-options`.
3738
#
3839
define apt::key (
3940
Pattern[/\A(0x)?[0-9a-fA-F]{8}\Z/, /\A(0x)?[0-9a-fA-F]{16}\Z/, /\A(0x)?[0-9a-fA-F]{40}\Z/] $id = $title,
4041
Enum['present', 'absent', 'refreshed'] $ensure = present,
41-
Optional[String] $content = undef,
42+
Optional[String[1]] $content = undef,
4243
Optional[Pattern[/\Ahttps?:\/\//, /\Aftp:\/\//, /\A\/\w+/]] $source = undef,
4344
Pattern[/\A((hkp|hkps|http|https):\/\/)?([a-z\d])([a-z\d-]{0,61}\.)+[a-z\d]+(:\d{2,5})?(\/[a-zA-Z\d\-_.]+)*\/?$/] $server = $apt::keyserver,
4445
Boolean $weak_ssl = false,
45-
Optional[String] $options = $apt::key_options,
46+
Optional[String[1]] $options = $apt::key_options,
4647
) {
4748
case $ensure {
4849
/^(refreshed|present)$/: {

manifests/mark.pp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# @summary Manages apt-mark settings
22
#
33
# @param setting
4-
# auto, manual, hold, unhold
5-
# specifies the behavior of apt in case of no more dependencies installed
4+
# Specifies the behavior of apt in case of no more dependencies installed
65
# https://manpages.debian.org/stable/apt/apt-mark.8.en.html
76
#
87
define apt::mark (

manifests/pin.pp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# @summary Manages Apt pins. Does not trigger an apt-get update run.
22
#
3-
# @see http://linux.die.net/man/5/apt_preferences for context on these parameters
3+
# @see https://manpages.debian.org/stable/apt/apt_preferences.5.en.html for context on these parameters
44
#
55
# @param ensure
6-
# Specifies whether the pin should exist. Valid options: 'file', 'present', and 'absent'.
6+
# Specifies whether the pin should exist.
77
#
88
# @param explanation
99
# Supplies a comment to explain the pin. Default: "${caller_module_name}: ${name}".
@@ -15,8 +15,8 @@
1515
# Specifies which package(s) to pin.
1616
#
1717
# @param priority
18-
# Sets the priority of the package. If multiple versions of a given package are available, `apt-get` installs the one with the highest
19-
# priority number (subject to dependency constraints). Valid options: an integer.
18+
# Sets the priority of the package. If multiple versions of a given package are available, `apt-get` installs the one with the highest
19+
# priority number (subject to dependency constraints).
2020
#
2121
# @param release
2222
# Tells APT to prefer packages that support the specified release. Typical values include 'stable', 'testing', and 'unstable'.
@@ -34,28 +34,28 @@
3434
# Names the label of the packages in the directory tree of the Release file.
3535
#
3636
# @param origin
37-
# The package origin
37+
# The package origin (the hostname part of the package's sources.list entry)
3838
#
3939
# @param version
4040
# The version of the package
4141
#
4242
# @param codename
43-
# The codename of the package
43+
# The codename of the release
4444
#
4545
define apt::pin (
4646
Enum['file', 'present', 'absent'] $ensure = present,
47-
Optional[String] $explanation = undef,
48-
Variant[Integer] $order = 50,
49-
Variant[String, Array] $packages = '*',
50-
Variant[Numeric, String] $priority = 0,
51-
Optional[String] $release = undef, # a=
52-
Optional[String] $origin = undef,
53-
Optional[String] $version = undef,
54-
Optional[String] $codename = undef, # n=
55-
Optional[String] $release_version = undef, # v=
56-
Optional[String] $component = undef, # c=
57-
Optional[String] $originator = undef, # o=
58-
Optional[String] $label = undef, # l=
47+
Optional[String[1]] $explanation = undef,
48+
Variant[Integer[0]] $order = 50,
49+
Variant[String[1], Array[String[1]]] $packages = '*',
50+
Variant[Integer, String[1]] $priority = 0,
51+
Optional[String[1]] $release = undef, # a=
52+
Optional[String[1]] $origin = undef,
53+
Optional[String[1]] $version = undef,
54+
Optional[String[1]] $codename = undef, # n=
55+
Optional[String[1]] $release_version = undef, # v=
56+
Optional[String[1]] $component = undef, # c=
57+
Optional[String[1]] $originator = undef, # o=
58+
Optional[String[1]] $label = undef, # l=
5959
) {
6060
if $explanation {
6161
$_explanation = $explanation

manifests/ppa.pp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# @summary Manages PPA repositories using `add-apt-repository`. Not supported on Debian.
22
#
3-
# @example Example declaration of an Apt PPA
4-
# apt::ppa{ 'ppa:openstack-ppa/bleeding-edge': }
3+
# @example Declaration of an Apt PPA
4+
# apt::ppa { 'ppa:openstack-ppa/bleeding-edge': }
55
#
66
# @param ensure
7-
# Specifies whether the PPA should exist. Valid options: 'present' and 'absent'.
7+
# Specifies whether the PPA should exist.
88
#
99
# @param options
10-
# Supplies options to be passed to the `add-apt-repository` command. Default: '-y'.
10+
# Supplies options to be passed to the `add-apt-repository` command.
1111
#
1212
# @param release
1313
# Specifies the operating system of your node. Valid options: a string containing a valid LSB distribution codename.
@@ -18,17 +18,17 @@
1818
# Optional if `puppet facts show os.name` returns your correct distribution name.
1919
#
2020
# @param package_name
21-
# Names the package that provides the `apt-add-repository` command. Default: 'software-properties-common'.
21+
# Names the package that provides the `apt-add-repository` command.
2222
#
2323
# @param package_manage
2424
# Specifies whether Puppet should manage the package that provides `apt-add-repository`.
2525
#
2626
define apt::ppa (
27-
String $ensure = 'present',
28-
Optional[Array[String]] $options = $apt::ppa_options,
29-
Optional[String] $release = fact('os.distro.codename'),
30-
Optional[String] $dist = $facts['os']['name'],
31-
Optional[String] $package_name = $apt::ppa_package,
27+
Enum['present', 'absent'] $ensure = 'present',
28+
Optional[Array[String[1]]] $options = $apt::ppa_options,
29+
Optional[String[1]] $release = fact('os.distro.codename'),
30+
Optional[String[1]] $dist = $facts['os']['name'],
31+
Optional[String[1]] $package_name = $apt::ppa_package,
3232
Boolean $package_manage = false,
3333
) {
3434
unless $release {

manifests/setting.pp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
# @summary Manages Apt configuration files.
22
#
3-
# @see https://docs.puppetlabs.com/references/latest/type.html#file-attributes for more information on source and content parameters
3+
# @see https://www.puppet.com/docs/puppet/latest/types/file.html#file-attributes for more information on source and content parameters
44
#
55
# @param priority
66
# Determines the order in which Apt processes the configuration file. Files with higher priority numbers are loaded first.
77
#
88
# @param ensure
9-
# Specifies whether the file should exist. Valid options: 'present', 'absent', and 'file'.
9+
# Specifies whether the file should exist.
1010
#
1111
# @param source
12-
# Required, unless `content` is set. Specifies a source file to supply the content of the configuration file. Cannot be used in combination
12+
# Required, unless `content` is set. Specifies a source file to supply the content of the configuration file. Cannot be used in combination
1313
# with `content`. Valid options: see link above for Puppet's native file type source attribute.
1414
#
1515
# @param content
16-
# Required, unless `source` is set. Directly supplies content for the configuration file. Cannot be used in combination with `source`. Valid
16+
# Required, unless `source` is set. Directly supplies content for the configuration file. Cannot be used in combination with `source`. Valid
1717
# options: see link above for Puppet's native file type content attribute.
1818
#
1919
# @param notify_update
2020
# Specifies whether to trigger an `apt-get update` run.
2121
#
2222
define apt::setting (
23-
Variant[String, Integer, Array] $priority = 50,
24-
Enum['file', 'present', 'absent'] $ensure = file,
25-
Optional[String] $source = undef,
26-
Optional[String] $content = undef,
27-
Boolean $notify_update = true,
23+
Variant[String[1], Integer[0]] $priority = 50,
24+
Enum['file', 'present', 'absent'] $ensure = file,
25+
Optional[String[1]] $source = undef,
26+
Optional[String[1]] $content = undef,
27+
Boolean $notify_update = true,
2828
) {
2929
if $content and $source {
3030
fail('apt::setting cannot have both content and source')

manifests/source.pp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# }
2323
#
2424
# @param location
25-
# Required, unless ensure is set to 'absent'. Specifies an Apt repository. Valid options: a string containing a repository URL.
25+
# Required, unless ensure is set to 'absent'. Specifies an Apt repository.
2626
#
2727
# @param comment
2828
# Supplies a comment for adding to the Apt source file.
@@ -59,7 +59,7 @@
5959
# See https://wiki.debian.org/DebianRepository/UseThirdParty for details.
6060
#
6161
# @param pin
62-
# Creates a declaration of the apt::pin defined type. Valid options: a number or string to be passed to the `id` parameter of the
62+
# Creates a declaration of the apt::pin defined type. Valid options: a number or string to be passed to the `priority` parameter of the
6363
# `apt::pin` defined type, or a hash of `parameter => value` pairs to be passed to `apt::pin`'s corresponding parameters.
6464
#
6565
# @param architecture
@@ -80,20 +80,20 @@
8080
# Specifies whether to check if the package release date is valid.
8181
#
8282
define apt::source (
83-
Optional[String] $location = undef,
84-
String $comment = $name,
85-
String $ensure = present,
86-
Optional[String] $release = undef,
87-
String $repos = 'main',
88-
Variant[Hash] $include = {},
89-
Optional[Variant[String, Hash]] $key = undef,
90-
Optional[Stdlib::AbsolutePath] $keyring = undef,
91-
Optional[Variant[Hash, Numeric, String]] $pin = undef,
92-
Optional[String] $architecture = undef,
93-
Boolean $allow_unsigned = false,
94-
Boolean $allow_insecure = false,
95-
Boolean $notify_update = true,
96-
Boolean $check_valid_until = true,
83+
Optional[String[1]] $location = undef,
84+
String[1] $comment = $name,
85+
Enum['present', 'absent'] $ensure = present,
86+
Optional[String[0]] $release = undef,
87+
String[1] $repos = 'main',
88+
Hash $include = {},
89+
Optional[Variant[String[1], Hash]] $key = undef,
90+
Optional[Stdlib::AbsolutePath] $keyring = undef,
91+
Optional[Variant[Hash, Integer, String[1]]] $pin = undef,
92+
Optional[String[1]] $architecture = undef,
93+
Boolean $allow_unsigned = false,
94+
Boolean $allow_insecure = false,
95+
Boolean $notify_update = true,
96+
Boolean $check_valid_until = true,
9797
) {
9898
include apt
9999

0 commit comments

Comments
 (0)