From 1e1baadf8158a878562b8aab1924a3db5b777a0c Mon Sep 17 00:00:00 2001 From: Kenyon Ralph Date: Tue, 9 Apr 2024 00:05:21 -0700 Subject: [PATCH 1/3] use more specific data types Also includes some corrections to documentation. --- REFERENCE.md | 148 ++++++++++++++++++++--------------------- manifests/backports.pp | 18 ++--- manifests/conf.pp | 12 ++-- manifests/init.pp | 26 ++++---- manifests/key.pp | 19 +++--- manifests/mark.pp | 3 +- manifests/pin.pp | 36 +++++----- manifests/ppa.pp | 20 +++--- manifests/setting.pp | 18 ++--- manifests/source.pp | 32 ++++----- 10 files changed, 166 insertions(+), 166 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index b3597d71a5..60c2435cc1 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -94,7 +94,7 @@ The following parameters are available in the `apt` class: ##### `provider` -Data type: `String` +Data type: `Stdlib::Absolutepath` Specifies the provider that should be used by apt::update. @@ -102,7 +102,7 @@ Default value: `'/usr/bin/apt-get'` ##### `keyserver` -Data type: `String` +Data type: `Stdlib::Host` Specifies a keyserver to provide the GPG key. Valid options: a string containing a domain name or a full URL (http://, https://, or hkp://). @@ -111,7 +111,7 @@ Default value: `'keyserver.ubuntu.com'` ##### `key_options` -Data type: `Optional[String]` +Data type: `Optional[String[1]]` Specifies the default options for apt::key resources. @@ -119,7 +119,7 @@ Default value: `undef` ##### `ppa_options` -Data type: `Optional[Array[String]]` +Data type: `Optional[Array[String[1]]]` Supplies options to be passed to the `add-apt-repository` command. @@ -127,7 +127,7 @@ Default value: `undef` ##### `ppa_package` -Data type: `Optional[String]` +Data type: `Optional[String[1]]` Names the package that provides the `apt-add-repository` command. @@ -326,7 +326,7 @@ Default value: `[]` ##### `auth_conf_owner` -Data type: `String` +Data type: `String[1]` The owner of the file /etc/apt/auth.conf. @@ -334,7 +334,7 @@ Default value: `'_apt'` ##### `root` -Data type: `String` +Data type: `Stdlib::Absolutepath` Specifies root directory of Apt executable. @@ -342,7 +342,7 @@ Default value: `'/etc/apt'` ##### `sources_list` -Data type: `String` +Data type: `Stdlib::Absolutepath` Specifies the path of the sources_list file to use. @@ -350,7 +350,7 @@ Default value: `"${root}/sources.list"` ##### `sources_list_d` -Data type: `String` +Data type: `Stdlib::Absolutepath` Specifies the path of the sources_list.d file to use. @@ -358,7 +358,7 @@ Default value: `"${root}/sources.list.d"` ##### `conf_d` -Data type: `String` +Data type: `Stdlib::Absolutepath` Specifies the path of the conf.d file to use. @@ -366,7 +366,7 @@ Default value: `"${root}/apt.conf.d"` ##### `preferences` -Data type: `String` +Data type: `Stdlib::Absolutepath` Specifies the path of the preferences file to use. @@ -374,7 +374,7 @@ Default value: `"${root}/preferences"` ##### `preferences_d` -Data type: `String` +Data type: `Stdlib::Absolutepath` Specifies the path of the preferences.d file to use. @@ -430,7 +430,7 @@ Default value: ##### `apt_conf_d` -Data type: `String` +Data type: `Stdlib::Absolutepath` The path to the file `apt.conf.d` @@ -479,7 +479,7 @@ The following parameters are available in the `apt::backports` class: ##### `location` -Data type: `Optional[String]` +Data type: `Optional[Stdlib::HTTPUrl]` Specifies an Apt repository containing the backports to manage. Valid options: a string containing a URL. Default value for Debian and Ubuntu varies: @@ -492,9 +492,9 @@ Default value: `undef` ##### `release` -Data type: `Optional[String]` +Data type: `Optional[String[1]]` -Specifies a distribution of the Apt repository containing the backports to manage. Used in populating the `source.list` configuration file. +Specifies a distribution of the Apt repository containing the backports to manage. Used in populating the `sources.list` configuration file. Default: on Debian and Ubuntu, `${fact('os.distro.codename')}-backports`. We recommend keeping this default, except on other operating systems. @@ -502,9 +502,9 @@ Default value: `undef` ##### `repos` -Data type: `Optional[String]` +Data type: `Optional[String[1]]` -Specifies a component of the Apt repository containing the backports to manage. Used in populating the `source.list` configuration file. +Specifies a component of the Apt repository containing the backports to manage. Used in populating the `sources.list` configuration file. Default value for Debian and Ubuntu varies: - Debian: 'main contrib non-free' @@ -515,7 +515,7 @@ Default value: `undef` ##### `key` -Data type: `Optional[Variant[String, Hash]]` +Data type: `Optional[Variant[String[1], Hash]]` Specifies a key to authenticate the backports. Valid options: a string to be passed to the id parameter of the apt::key defined type, or a hash of parameter => value pairs to be passed to apt::key's id, server, content, source, and/or options parameters. @@ -534,7 +534,7 @@ Default value: `"/usr/share/keyrings/${facts['os']['name'].downcase}-archive-key ##### `pin` -Data type: `Variant[Integer, String, Hash]` +Data type: `Variant[Integer, String[1], Hash]` Specifies a pin priority for the backports. Valid options: a number or string to be passed to the `id` parameter of the `apt::pin` defined type, or a hash of `parameter => value` pairs to be passed to `apt::pin`'s corresponding parameters. @@ -543,7 +543,7 @@ Default value: `200` ##### `include` -Data type: `Variant[Hash]` +Data type: `Hash` Specifies whether to include 'deb' or 'src', or both. @@ -566,7 +566,7 @@ The following parameters are available in the `apt::conf` defined type: ##### `content` -Data type: `Optional[String]` +Data type: `Optional[String[1]]` Required unless `ensure` is set to 'absent'. Directly supplies content for the configuration file. @@ -576,13 +576,13 @@ Default value: `undef` Data type: `Enum['present', 'absent']` -Specifies whether the configuration file should exist. Valid options: 'present' and 'absent'. +Specifies whether the configuration file should exist. Default value: `present` ##### `priority` -Data type: `Variant[String, Integer]` +Data type: `Variant[String[1], Integer[0]]` Determines the order in which Apt processes the configuration file. Files with lower priority numbers are loaded first. Valid options: a string containing an integer or an integer. @@ -640,14 +640,15 @@ Default value: `$title` Data type: `Enum['present', 'absent', 'refreshed']` -Specifies whether the key should exist. Valid options: 'present', 'absent' or 'refreshed'. Using 'refreshed' will make keys auto -update when they have expired (assuming a new key exists on the key server). +Specifies whether the key should exist. Using `refreshed` will make keys +auto update when they have expired (assuming a new key exists on the key +server). Default value: `present` ##### `content` -Data type: `Optional[String]` +Data type: `Optional[String[1]]` 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. @@ -675,13 +676,13 @@ Default value: `$apt::keyserver` Data type: `Boolean` -Specifies whether strict SSL verification on a https URL should be disabled. Valid options: true or false. +Specifies whether strict SSL verification on a https URL should be disabled. Default value: `false` ##### `options` -Data type: `Optional[String]` +Data type: `Optional[String[1]]` Passes additional options to `apt-key adv --keyserver-options`. @@ -787,8 +788,7 @@ The following parameters are available in the `apt::mark` defined type: Data type: `Enum['auto','manual','hold','unhold']` -auto, manual, hold, unhold -specifies the behavior of apt in case of no more dependencies installed +Specifies the behavior of apt in case of no more dependencies installed https://manpages.debian.org/stable/apt/apt-mark.8.en.html ### `apt::pin` @@ -796,7 +796,7 @@ https://manpages.debian.org/stable/apt/apt-mark.8.en.html Manages Apt pins. Does not trigger an apt-get update run. * **See also** - * http://linux.die.net/man/5/apt_preferences + * https://manpages.debian.org/stable/apt/apt_preferences.5.en.html * for context on these parameters #### Parameters @@ -821,13 +821,13 @@ The following parameters are available in the `apt::pin` defined type: Data type: `Enum['file', 'present', 'absent']` -Specifies whether the pin should exist. Valid options: 'file', 'present', and 'absent'. +Specifies whether the pin should exist. Default value: `present` ##### `explanation` -Data type: `Optional[String]` +Data type: `Optional[String[1]]` Supplies a comment to explain the pin. Default: "${caller_module_name}: ${name}". @@ -835,7 +835,7 @@ Default value: `undef` ##### `order` -Data type: `Variant[Integer]` +Data type: `Variant[Integer[0]]` Determines the order in which Apt processes the pin file. Files with lower order numbers are loaded first. @@ -843,7 +843,7 @@ Default value: `50` ##### `packages` -Data type: `Variant[String, Array]` +Data type: `Variant[String[1], Array[String[1]]]` Specifies which package(s) to pin. @@ -851,16 +851,16 @@ Default value: `'*'` ##### `priority` -Data type: `Variant[Numeric, String]` +Data type: `Variant[Integer, String[1]]` Sets the priority of the package. If multiple versions of a given package are available, `apt-get` installs the one with the highest -priority number (subject to dependency constraints). Valid options: an integer. +priority number (subject to dependency constraints). Default value: `0` ##### `release` -Data type: `Optional[String]` +Data type: `Optional[String[1]]` Tells APT to prefer packages that support the specified release. Typical values include 'stable', 'testing', and 'unstable'. @@ -868,7 +868,7 @@ Default value: `undef` ##### `release_version` -Data type: `Optional[String]` +Data type: `Optional[String[1]]` Tells APT to prefer packages that support the specified operating system release version (such as Debian release version 7). @@ -876,7 +876,7 @@ Default value: `undef` ##### `component` -Data type: `Optional[String]` +Data type: `Optional[String[1]]` Names the licensing component associated with the packages in the directory tree of the Release file. @@ -884,7 +884,7 @@ Default value: `undef` ##### `originator` -Data type: `Optional[String]` +Data type: `Optional[String[1]]` Names the originator of the packages in the directory tree of the Release file. @@ -892,7 +892,7 @@ Default value: `undef` ##### `label` -Data type: `Optional[String]` +Data type: `Optional[String[1]]` Names the label of the packages in the directory tree of the Release file. @@ -900,15 +900,15 @@ Default value: `undef` ##### `origin` -Data type: `Optional[String]` +Data type: `Optional[String[1]]` -The package origin +The package origin (the hostname part of the package's sources.list entry) Default value: `undef` ##### `version` -Data type: `Optional[String]` +Data type: `Optional[String[1]]` The version of the package @@ -916,9 +916,9 @@ Default value: `undef` ##### `codename` -Data type: `Optional[String]` +Data type: `Optional[String[1]]` -The codename of the package +The codename of the release Default value: `undef` @@ -928,10 +928,10 @@ Manages PPA repositories using `add-apt-repository`. Not supported on Debian. #### Examples -##### Example declaration of an Apt PPA +##### Declaration of an Apt PPA ```puppet -apt::ppa{ 'ppa:openstack-ppa/bleeding-edge': } +apt::ppa { 'ppa:openstack-ppa/bleeding-edge': } ``` #### Parameters @@ -947,23 +947,23 @@ The following parameters are available in the `apt::ppa` defined type: ##### `ensure` -Data type: `String` +Data type: `Enum['present', 'absent']` -Specifies whether the PPA should exist. Valid options: 'present' and 'absent'. +Specifies whether the PPA should exist. Default value: `'present'` ##### `options` -Data type: `Optional[Array[String]]` +Data type: `Optional[Array[String[1]]]` -Supplies options to be passed to the `add-apt-repository` command. Default: '-y'. +Supplies options to be passed to the `add-apt-repository` command. Default value: `$apt::ppa_options` ##### `release` -Data type: `Optional[String]` +Data type: `Optional[String[1]]` Specifies the operating system of your node. Valid options: a string containing a valid LSB distribution codename. Optional if `puppet facts show os.distro.codename` returns your correct distribution release codename. @@ -972,7 +972,7 @@ Default value: `fact('os.distro.codename')` ##### `dist` -Data type: `Optional[String]` +Data type: `Optional[String[1]]` Specifies the distribution of your node. Valid options: a string containing a valid distribution codename. Optional if `puppet facts show os.name` returns your correct distribution name. @@ -981,9 +981,9 @@ Default value: `$facts['os']['name']` ##### `package_name` -Data type: `Optional[String]` +Data type: `Optional[String[1]]` -Names the package that provides the `apt-add-repository` command. Default: 'software-properties-common'. +Names the package that provides the `apt-add-repository` command. Default value: `$apt::ppa_package` @@ -1000,7 +1000,7 @@ Default value: `false` Manages Apt configuration files. * **See also** - * https://docs.puppetlabs.com/references/latest/type.html#file-attributes + * https://www.puppet.com/docs/puppet/latest/types/file.html#file-attributes * for more information on source and content parameters #### Parameters @@ -1015,7 +1015,7 @@ The following parameters are available in the `apt::setting` defined type: ##### `priority` -Data type: `Variant[String, Integer, Array]` +Data type: `Variant[String[1], Integer[0]]` Determines the order in which Apt processes the configuration file. Files with higher priority numbers are loaded first. @@ -1025,13 +1025,13 @@ Default value: `50` Data type: `Enum['file', 'present', 'absent']` -Specifies whether the file should exist. Valid options: 'present', 'absent', and 'file'. +Specifies whether the file should exist. Default value: `file` ##### `source` -Data type: `Optional[String]` +Data type: `Optional[String[1]]` Required, unless `content` is set. Specifies a source file to supply the content of the configuration file. Cannot be used in combination with `content`. Valid options: see link above for Puppet's native file type source attribute. @@ -1040,7 +1040,7 @@ Default value: `undef` ##### `content` -Data type: `Optional[String]` +Data type: `Optional[String[1]]` Required, unless `source` is set. Directly supplies content for the configuration file. Cannot be used in combination with `source`. Valid options: see link above for Puppet's native file type content attribute. @@ -1109,15 +1109,15 @@ The following parameters are available in the `apt::source` defined type: ##### `location` -Data type: `Optional[String]` +Data type: `Optional[String[1]]` -Required, unless ensure is set to 'absent'. Specifies an Apt repository. Valid options: a string containing a repository URL. +Required, unless ensure is set to 'absent'. Specifies an Apt repository. Default value: `undef` ##### `comment` -Data type: `String` +Data type: `String[1]` Supplies a comment for adding to the Apt source file. @@ -1125,7 +1125,7 @@ Default value: `$name` ##### `ensure` -Data type: `String` +Data type: `Enum['present', 'absent']` Specifies whether the Apt source file should exist. @@ -1133,7 +1133,7 @@ Default value: `present` ##### `release` -Data type: `Optional[String]` +Data type: `Optional[String[0]]` Specifies a distribution of the Apt repository. @@ -1141,7 +1141,7 @@ Default value: `undef` ##### `repos` -Data type: `String` +Data type: `String[1]` Specifies a component of the Apt repository. @@ -1149,7 +1149,7 @@ Default value: `'main'` ##### `include` -Data type: `Variant[Hash]` +Data type: `Hash` Configures include options. Valid options: a hash of available keys. @@ -1162,7 +1162,7 @@ Default value: `{}` ##### `key` -Data type: `Optional[Variant[String, Hash]]` +Data type: `Optional[Variant[String[1], Hash]]` Creates an `apt::keyring` in `/etc/apt/keyrings` (or anywhere on disk given `filename`) Valid options: * a hash of `parameter => value` pairs to be passed to `file`: `name` (title), `content`, `source`, `filename` @@ -1185,16 +1185,16 @@ Default value: `undef` ##### `pin` -Data type: `Optional[Variant[Hash, Numeric, String]]` +Data type: `Optional[Variant[Hash, Integer, String[1]]]` -Creates a declaration of the apt::pin defined type. Valid options: a number or string to be passed to the `id` parameter of the +Creates a declaration of the apt::pin defined type. Valid options: a number or string to be passed to the `priority` parameter of the `apt::pin` defined type, or a hash of `parameter => value` pairs to be passed to `apt::pin`'s corresponding parameters. Default value: `undef` ##### `architecture` -Data type: `Optional[String]` +Data type: `Optional[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'). diff --git a/manifests/backports.pp b/manifests/backports.pp index 7606a4b463..a47c23a8d9 100644 --- a/manifests/backports.pp +++ b/manifests/backports.pp @@ -12,12 +12,12 @@ # - Ubuntu: 'http://archive.ubuntu.com/ubuntu' # # @param release -# Specifies a distribution of the Apt repository containing the backports to manage. Used in populating the `source.list` configuration file. +# Specifies a distribution of the Apt repository containing the backports to manage. Used in populating the `sources.list` configuration file. # Default: on Debian and Ubuntu, `${fact('os.distro.codename')}-backports`. We recommend keeping this default, except on other operating # systems. # # @param repos -# Specifies a component of the Apt repository containing the backports to manage. Used in populating the `source.list` configuration file. +# Specifies a component of the Apt repository containing the backports to manage. Used in populating the `sources.list` configuration file. # Default value for Debian and Ubuntu varies: # # - Debian: 'main contrib non-free' @@ -41,13 +41,13 @@ # Specifies whether to include 'deb' or 'src', or both. # class apt::backports ( - Optional[String] $location = undef, - Optional[String] $release = undef, - Optional[String] $repos = undef, - Optional[Variant[String, Hash]] $key = undef, - Stdlib::AbsolutePath $keyring = "/usr/share/keyrings/${facts['os']['name'].downcase}-archive-keyring.gpg", - Variant[Integer, String, Hash] $pin = 200, - Variant[Hash] $include = {}, + Optional[Stdlib::HTTPUrl] $location = undef, + Optional[String[1]] $release = undef, + Optional[String[1]] $repos = undef, + Optional[Variant[String[1], Hash]] $key = undef, + Stdlib::AbsolutePath $keyring = "/usr/share/keyrings/${facts['os']['name'].downcase}-archive-keyring.gpg", + Variant[Integer, String[1], Hash] $pin = 200, + Hash $include = {}, ) { include apt diff --git a/manifests/conf.pp b/manifests/conf.pp index 0aec66dd63..8bd712578e 100644 --- a/manifests/conf.pp +++ b/manifests/conf.pp @@ -4,20 +4,20 @@ # Required unless `ensure` is set to 'absent'. Directly supplies content for the configuration file. # # @param ensure -# Specifies whether the configuration file should exist. Valid options: 'present' and 'absent'. +# Specifies whether the configuration file should exist. # # @param priority -# Determines the order in which Apt processes the configuration file. Files with lower priority numbers are loaded first. +# Determines the order in which Apt processes the configuration file. Files with lower priority numbers are loaded first. # Valid options: a string containing an integer or an integer. # # @param notify_update # Specifies whether to trigger an `apt-get update` run. # define apt::conf ( - Optional[String] $content = undef, - Enum['present', 'absent'] $ensure = present, - Variant[String, Integer] $priority = 50, - Optional[Boolean] $notify_update = undef, + Optional[String[1]] $content = undef, + Enum['present', 'absent'] $ensure = present, + Variant[String[1], Integer[0]] $priority = 50, + Optional[Boolean] $notify_update = undef, ) { unless $ensure == 'absent' { unless $content { diff --git a/manifests/init.pp b/manifests/init.pp index 5ad48433f5..e0027ff3ca 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -174,11 +174,11 @@ 'deb' => true, 'src' => false, }, - String $provider = '/usr/bin/apt-get', - String $keyserver = 'keyserver.ubuntu.com', - Optional[String] $key_options = undef, - Optional[Array[String]] $ppa_options = undef, - Optional[String] $ppa_package = undef, + Stdlib::Absolutepath $provider = '/usr/bin/apt-get', + Stdlib::Host $keyserver = 'keyserver.ubuntu.com', + Optional[String[1]] $key_options = undef, + Optional[Array[String[1]]] $ppa_options = undef, + Optional[String[1]] $ppa_package = undef, Optional[Hash] $backports = undef, Hash $confs = {}, Hash $update = {}, @@ -192,14 +192,14 @@ Hash $settings = {}, Boolean $manage_auth_conf = true, Array[Apt::Auth_conf_entry] $auth_conf_entries = [], - String $auth_conf_owner = '_apt', - String $root = '/etc/apt', - String $sources_list = "${root}/sources.list", - String $sources_list_d = "${root}/sources.list.d", - String $conf_d = "${root}/apt.conf.d", - String $preferences = "${root}/preferences", - String $preferences_d = "${root}/preferences.d", - String $apt_conf_d = "${root}/apt.conf.d", + String[1] $auth_conf_owner = '_apt', + Stdlib::Absolutepath $root = '/etc/apt', + Stdlib::Absolutepath $sources_list = "${root}/sources.list", + Stdlib::Absolutepath $sources_list_d = "${root}/sources.list.d", + Stdlib::Absolutepath $conf_d = "${root}/apt.conf.d", + Stdlib::Absolutepath $preferences = "${root}/preferences", + Stdlib::Absolutepath $preferences_d = "${root}/preferences.d", + Stdlib::Absolutepath $apt_conf_d = "${root}/apt.conf.d", Hash $config_files = { 'conf' => { 'path' => $conf_d, diff --git a/manifests/key.pp b/manifests/key.pp index 793fa13cbe..8549742caf 100644 --- a/manifests/key.pp +++ b/manifests/key.pp @@ -1,6 +1,6 @@ -# @summary Manages the GPG keys that Apt uses to authenticate packages. +# @summary Manages the GPG keys that Apt uses to authenticate packages. # -# @note +# @note # The apt::key defined type makes use of the apt_key type, but includes extra functionality to help prevent duplicate keys. # # @example Declare Apt key for apt.puppetlabs.com source @@ -11,18 +11,19 @@ # } # # @param id -# Specifies a GPG key to authenticate Apt package signatures. Valid options: a string containing a key ID (8 or 16 hexadecimal +# Specifies a GPG key to authenticate Apt package signatures. Valid options: a string containing a key ID (8 or 16 hexadecimal # characters, optionally prefixed with "0x") or a full key fingerprint (40 hexadecimal characters). # # @param ensure -# Specifies whether the key should exist. Valid options: 'present', 'absent' or 'refreshed'. Using 'refreshed' will make keys auto -# update when they have expired (assuming a new key exists on the key server). +# Specifies whether the key should exist. Using `refreshed` will make keys +# auto update when they have expired (assuming a new key exists on the key +# server). # # @param content # 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. # # @param source -# Specifies the location of an existing GPG key file to copy. Valid options: a string containing a URL (ftp://, http://, or https://) or +# Specifies the location of an existing GPG key file to copy. Valid options: a string containing a URL (ftp://, http://, or https://) or # an absolute path. # # @param server @@ -30,7 +31,7 @@ # hkp:// or hkps://). The hkps:// protocol is currently only supported on Ubuntu 18.04. # # @param weak_ssl -# Specifies whether strict SSL verification on a https URL should be disabled. Valid options: true or false. +# Specifies whether strict SSL verification on a https URL should be disabled. # # @param options # Passes additional options to `apt-key adv --keyserver-options`. @@ -38,11 +39,11 @@ define apt::key ( 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, Enum['present', 'absent', 'refreshed'] $ensure = present, - Optional[String] $content = undef, + Optional[String[1]] $content = undef, Optional[Pattern[/\Ahttps?:\/\//, /\Aftp:\/\//, /\A\/\w+/]] $source = undef, 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, Boolean $weak_ssl = false, - Optional[String] $options = $apt::key_options, + Optional[String[1]] $options = $apt::key_options, ) { case $ensure { /^(refreshed|present)$/: { diff --git a/manifests/mark.pp b/manifests/mark.pp index b2146b0a54..8de4d611db 100644 --- a/manifests/mark.pp +++ b/manifests/mark.pp @@ -1,8 +1,7 @@ # @summary Manages apt-mark settings # # @param setting -# auto, manual, hold, unhold -# specifies the behavior of apt in case of no more dependencies installed +# Specifies the behavior of apt in case of no more dependencies installed # https://manpages.debian.org/stable/apt/apt-mark.8.en.html # define apt::mark ( diff --git a/manifests/pin.pp b/manifests/pin.pp index bd8b470b17..d627fa992b 100644 --- a/manifests/pin.pp +++ b/manifests/pin.pp @@ -1,9 +1,9 @@ # @summary Manages Apt pins. Does not trigger an apt-get update run. # -# @see http://linux.die.net/man/5/apt_preferences for context on these parameters +# @see https://manpages.debian.org/stable/apt/apt_preferences.5.en.html for context on these parameters # # @param ensure -# Specifies whether the pin should exist. Valid options: 'file', 'present', and 'absent'. +# Specifies whether the pin should exist. # # @param explanation # Supplies a comment to explain the pin. Default: "${caller_module_name}: ${name}". @@ -15,8 +15,8 @@ # Specifies which package(s) to pin. # # @param priority -# Sets the priority of the package. If multiple versions of a given package are available, `apt-get` installs the one with the highest -# priority number (subject to dependency constraints). Valid options: an integer. +# Sets the priority of the package. If multiple versions of a given package are available, `apt-get` installs the one with the highest +# priority number (subject to dependency constraints). # # @param release # Tells APT to prefer packages that support the specified release. Typical values include 'stable', 'testing', and 'unstable'. @@ -34,28 +34,28 @@ # Names the label of the packages in the directory tree of the Release file. # # @param origin -# The package origin +# The package origin (the hostname part of the package's sources.list entry) # # @param version # The version of the package # # @param codename -# The codename of the package +# The codename of the release # define apt::pin ( Enum['file', 'present', 'absent'] $ensure = present, - Optional[String] $explanation = undef, - Variant[Integer] $order = 50, - Variant[String, Array] $packages = '*', - Variant[Numeric, String] $priority = 0, - Optional[String] $release = undef, # a= - Optional[String] $origin = undef, - Optional[String] $version = undef, - Optional[String] $codename = undef, # n= - Optional[String] $release_version = undef, # v= - Optional[String] $component = undef, # c= - Optional[String] $originator = undef, # o= - Optional[String] $label = undef, # l= + Optional[String[1]] $explanation = undef, + Variant[Integer[0]] $order = 50, + Variant[String[1], Array[String[1]]] $packages = '*', + Variant[Integer, String[1]] $priority = 0, + Optional[String[1]] $release = undef, # a= + Optional[String[1]] $origin = undef, + Optional[String[1]] $version = undef, + Optional[String[1]] $codename = undef, # n= + Optional[String[1]] $release_version = undef, # v= + Optional[String[1]] $component = undef, # c= + Optional[String[1]] $originator = undef, # o= + Optional[String[1]] $label = undef, # l= ) { if $explanation { $_explanation = $explanation diff --git a/manifests/ppa.pp b/manifests/ppa.pp index 52c5186d03..1bb4c81866 100644 --- a/manifests/ppa.pp +++ b/manifests/ppa.pp @@ -1,13 +1,13 @@ # @summary Manages PPA repositories using `add-apt-repository`. Not supported on Debian. # -# @example Example declaration of an Apt PPA -# apt::ppa{ 'ppa:openstack-ppa/bleeding-edge': } +# @example Declaration of an Apt PPA +# apt::ppa { 'ppa:openstack-ppa/bleeding-edge': } # # @param ensure -# Specifies whether the PPA should exist. Valid options: 'present' and 'absent'. +# Specifies whether the PPA should exist. # # @param options -# Supplies options to be passed to the `add-apt-repository` command. Default: '-y'. +# Supplies options to be passed to the `add-apt-repository` command. # # @param release # Specifies the operating system of your node. Valid options: a string containing a valid LSB distribution codename. @@ -18,17 +18,17 @@ # Optional if `puppet facts show os.name` returns your correct distribution name. # # @param package_name -# Names the package that provides the `apt-add-repository` command. Default: 'software-properties-common'. +# Names the package that provides the `apt-add-repository` command. # # @param package_manage # Specifies whether Puppet should manage the package that provides `apt-add-repository`. # define apt::ppa ( - String $ensure = 'present', - Optional[Array[String]] $options = $apt::ppa_options, - Optional[String] $release = fact('os.distro.codename'), - Optional[String] $dist = $facts['os']['name'], - Optional[String] $package_name = $apt::ppa_package, + Enum['present', 'absent'] $ensure = 'present', + Optional[Array[String[1]]] $options = $apt::ppa_options, + Optional[String[1]] $release = fact('os.distro.codename'), + Optional[String[1]] $dist = $facts['os']['name'], + Optional[String[1]] $package_name = $apt::ppa_package, Boolean $package_manage = false, ) { unless $release { diff --git a/manifests/setting.pp b/manifests/setting.pp index a3fc3630bd..3dd14cdff2 100644 --- a/manifests/setting.pp +++ b/manifests/setting.pp @@ -1,30 +1,30 @@ # @summary Manages Apt configuration files. # -# @see https://docs.puppetlabs.com/references/latest/type.html#file-attributes for more information on source and content parameters +# @see https://www.puppet.com/docs/puppet/latest/types/file.html#file-attributes for more information on source and content parameters # # @param priority # Determines the order in which Apt processes the configuration file. Files with higher priority numbers are loaded first. # # @param ensure -# Specifies whether the file should exist. Valid options: 'present', 'absent', and 'file'. +# Specifies whether the file should exist. # # @param source -# Required, unless `content` is set. Specifies a source file to supply the content of the configuration file. Cannot be used in combination +# Required, unless `content` is set. Specifies a source file to supply the content of the configuration file. Cannot be used in combination # with `content`. Valid options: see link above for Puppet's native file type source attribute. # # @param content -# Required, unless `source` is set. Directly supplies content for the configuration file. Cannot be used in combination with `source`. Valid +# Required, unless `source` is set. Directly supplies content for the configuration file. Cannot be used in combination with `source`. Valid # options: see link above for Puppet's native file type content attribute. # # @param notify_update # Specifies whether to trigger an `apt-get update` run. # define apt::setting ( - Variant[String, Integer, Array] $priority = 50, - Enum['file', 'present', 'absent'] $ensure = file, - Optional[String] $source = undef, - Optional[String] $content = undef, - Boolean $notify_update = true, + Variant[String[1], Integer[0]] $priority = 50, + Enum['file', 'present', 'absent'] $ensure = file, + Optional[String[1]] $source = undef, + Optional[String[1]] $content = undef, + Boolean $notify_update = true, ) { if $content and $source { fail('apt::setting cannot have both content and source') diff --git a/manifests/source.pp b/manifests/source.pp index 776c5f7a43..e7986697c3 100644 --- a/manifests/source.pp +++ b/manifests/source.pp @@ -22,7 +22,7 @@ # } # # @param location -# Required, unless ensure is set to 'absent'. Specifies an Apt repository. Valid options: a string containing a repository URL. +# Required, unless ensure is set to 'absent'. Specifies an Apt repository. # # @param comment # Supplies a comment for adding to the Apt source file. @@ -59,7 +59,7 @@ # See https://wiki.debian.org/DebianRepository/UseThirdParty for details. # # @param pin -# Creates a declaration of the apt::pin defined type. Valid options: a number or string to be passed to the `id` parameter of the +# Creates a declaration of the apt::pin defined type. Valid options: a number or string to be passed to the `priority` parameter of the # `apt::pin` defined type, or a hash of `parameter => value` pairs to be passed to `apt::pin`'s corresponding parameters. # # @param architecture @@ -80,20 +80,20 @@ # Specifies whether to check if the package release date is valid. # define apt::source ( - Optional[String] $location = undef, - String $comment = $name, - String $ensure = present, - Optional[String] $release = undef, - String $repos = 'main', - Variant[Hash] $include = {}, - Optional[Variant[String, Hash]] $key = undef, - Optional[Stdlib::AbsolutePath] $keyring = undef, - Optional[Variant[Hash, Numeric, String]] $pin = undef, - Optional[String] $architecture = undef, - Boolean $allow_unsigned = false, - Boolean $allow_insecure = false, - Boolean $notify_update = true, - Boolean $check_valid_until = true, + Optional[String[1]] $location = undef, + String[1] $comment = $name, + Enum['present', 'absent'] $ensure = present, + Optional[String[0]] $release = undef, + String[1] $repos = 'main', + Hash $include = {}, + Optional[Variant[String[1], Hash]] $key = undef, + Optional[Stdlib::AbsolutePath] $keyring = undef, + Optional[Variant[Hash, Integer, String[1]]] $pin = undef, + Optional[String[1]] $architecture = undef, + Boolean $allow_unsigned = false, + Boolean $allow_insecure = false, + Boolean $notify_update = true, + Boolean $check_valid_until = true, ) { include apt From cc4ae7824c190228af872ce63eb712d4e2455266 Mon Sep 17 00:00:00 2001 From: Kenyon Ralph Date: Tue, 14 May 2024 17:29:44 -0700 Subject: [PATCH 2/3] init: 15update-stamp is not a template, make it a plain file --- templates/15update-stamp.epp => files/15update-stamp | 0 manifests/init.pp | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename templates/15update-stamp.epp => files/15update-stamp (100%) diff --git a/templates/15update-stamp.epp b/files/15update-stamp similarity index 100% rename from templates/15update-stamp.epp rename to files/15update-stamp diff --git a/manifests/init.pp b/manifests/init.pp index e0027ff3ca..a1b06fbb81 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -288,7 +288,7 @@ $confheadertmp = epp('apt/_conf_header.epp') $proxytmp = epp('apt/proxy.epp', { 'proxies' => $_proxy }) - $updatestamptmp = epp('apt/15update-stamp.epp') + $updatestamptmp = file('apt/15update-stamp') if $_proxy['ensure'] == 'absent' or $_proxy['host'] { apt::setting { 'conf-proxy': From 3c7161e406eae43180d8835630ea9fc26a8125ed Mon Sep 17 00:00:00 2001 From: Kenyon Ralph Date: Sat, 18 May 2024 16:14:41 -0700 Subject: [PATCH 3/3] Debian: add non-free-firmware repo component Debian 12 "bookworm" added the non-free-firmware repository component. This commit adds that component to examples, tests, and backports for Debian 12. Reference: https://wiki.debian.org/Firmware --- README.md | 4 ++-- REFERENCE.md | 2 +- data/os/Debian/12.yaml | 3 +++ examples/source.pp | 4 ++-- manifests/backports.pp | 2 +- spec/classes/apt_backports_spec.rb | 14 +++++++------- 6 files changed, 16 insertions(+), 13 deletions(-) create mode 100644 data/os/Debian/12.yaml diff --git a/README.md b/README.md index d9983b50e8..44cd89d05c 100644 --- a/README.md +++ b/README.md @@ -181,7 +181,7 @@ apt::source { 'debian_unstable': comment => 'This is the iWeb Debian unstable mirror', location => 'http://debian.mirror.iweb.ca/debian/', release => 'unstable', - repos => 'main contrib non-free', + repos => 'main contrib non-free non-free-firmware', pin => '-10', key => { 'id' => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553', @@ -235,7 +235,7 @@ apt::sources: comment: 'This is the iWeb Debian unstable mirror' location: 'http://debian.mirror.iweb.ca/debian/' release: 'unstable' - repos: 'main contrib non-free' + repos: 'main contrib non-free non-free-firmware' pin: '-10' key: id: 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553' diff --git a/REFERENCE.md b/REFERENCE.md index 60c2435cc1..980848ac4e 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -507,7 +507,7 @@ Data type: `Optional[String[1]]` Specifies a component of the Apt repository containing the backports to manage. Used in populating the `sources.list` configuration file. Default value for Debian and Ubuntu varies: -- Debian: 'main contrib non-free' +- Debian: 'main contrib non-free non-free-firmware' - Ubuntu: 'main universe multiverse restricted' diff --git a/data/os/Debian/12.yaml b/data/os/Debian/12.yaml new file mode 100644 index 0000000000..c09df5e4f4 --- /dev/null +++ b/data/os/Debian/12.yaml @@ -0,0 +1,3 @@ +apt::backports: + location: http://deb.debian.org/debian + repos: main contrib non-free non-free-firmware diff --git a/examples/source.pp b/examples/source.pp index c4791af5e1..2227cce65c 100644 --- a/examples/source.pp +++ b/examples/source.pp @@ -16,7 +16,7 @@ apt::source { 'debian_testing': location => 'http://debian.mirror.iweb.ca/debian/', release => 'testing', - repos => 'main contrib non-free', + repos => 'main contrib non-free non-free-firmware', key => { id => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553', server => 'keyserver.ubuntu.com', @@ -26,7 +26,7 @@ apt::source { 'debian_unstable': location => 'http://debian.mirror.iweb.ca/debian/', release => 'unstable', - repos => 'main contrib non-free', + repos => 'main contrib non-free non-free-firmware', key => { id => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553', server => 'keyserver.ubuntu.com', diff --git a/manifests/backports.pp b/manifests/backports.pp index a47c23a8d9..83e3c49500 100644 --- a/manifests/backports.pp +++ b/manifests/backports.pp @@ -20,7 +20,7 @@ # Specifies a component of the Apt repository containing the backports to manage. Used in populating the `sources.list` configuration file. # Default value for Debian and Ubuntu varies: # -# - Debian: 'main contrib non-free' +# - Debian: 'main contrib non-free non-free-firmware' # # - Ubuntu: 'main universe multiverse restricted' # diff --git a/spec/classes/apt_backports_spec.rb b/spec/classes/apt_backports_spec.rb index 3945449f6c..23031ab73a 100644 --- a/spec/classes/apt_backports_spec.rb +++ b/spec/classes/apt_backports_spec.rb @@ -13,12 +13,12 @@ family: 'Debian', name: 'Debian', release: { - full: '11.8', - major: '11', - minor: '8' + full: '12.5', + major: '12', + minor: '5' }, distro: { - codename: 'bullseye', + codename: 'bookworm', id: 'Debian' } } @@ -28,11 +28,11 @@ it { expect(subject).to contain_apt__source('backports').with( location: 'http://deb.debian.org/debian', - repos: 'main contrib non-free', - release: 'bullseye-backports', + repos: 'main contrib non-free non-free-firmware', + release: 'bookworm-backports', pin: { 'priority' => 200, - 'release' => 'bullseye-backports' + 'release' => 'bookworm-backports' }, keyring: '/usr/share/keyrings/debian-archive-keyring.gpg', )