From f90dbd840d68335181ccd591e3748d3bf8a185a7 Mon Sep 17 00:00:00 2001 From: Ramesh Sencha Date: Wed, 27 Sep 2023 20:12:37 +0530 Subject: [PATCH] (CAT-1483) - Enhancement of validation for apt::source parameters --- REFERENCE.md | 18 +++++++++--------- manifests/source.pp | 30 +++++++++++++++--------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index 842ca67463..e20b0d0d3e 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -946,7 +946,7 @@ 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. @@ -954,7 +954,7 @@ Default value: `undef` ##### `comment` -Data type: `String` +Data type: `String[1]` Supplies a comment for adding to the Apt source file. @@ -962,7 +962,7 @@ Default value: `$name` ##### `ensure` -Data type: `String` +Data type: `String[1]` Specifies whether the Apt source file should exist. Valid options: 'present' and 'absent'. @@ -970,7 +970,7 @@ Default value: `present` ##### `release` -Data type: `Optional[String]` +Data type: `Optional[String[1]]` Specifies a distribution of the Apt repository. @@ -978,9 +978,9 @@ Default value: `undef` ##### `repos` -Data type: `String` +Data type: `String[1]` -Specifies a component of the Apt repository. +Specifies a component of the Apt repository. Default 'main'. Default value: `'main'` @@ -999,7 +999,7 @@ Default value: `{}` ##### `key` -Data type: `Optional[Variant[String, Hash]]` +Data type: `Optional[Variant[String[1], Hash]]` Creates a declaration of the apt::key defined type. 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`, `weak_ssl`, @@ -1018,7 +1018,7 @@ Default value: `undef` ##### `pin` -Data type: `Optional[Variant[Hash, Numeric, String]]` +Data type: `Optional[Variant[Hash, Numeric, 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 `apt::pin` defined type, or a hash of `parameter => value` pairs to be passed to `apt::pin`'s corresponding parameters. @@ -1027,7 +1027,7 @@ 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'). Default: undef (if unspecified, Apt downloads information for all architectures diff --git a/manifests/source.pp b/manifests/source.pp index 2386c0a5f3..ca3947812b 100644 --- a/manifests/source.pp +++ b/manifests/source.pp @@ -23,7 +23,7 @@ # Specifies a distribution of the Apt repository. # # @param repos -# Specifies a component of the Apt repository. +# Specifies a component of the Apt repository. Default 'main'. # # @param include # Configures include options. Valid options: a hash of available keys. @@ -65,20 +65,20 @@ # Specifies whether to check if the package release date is valid. Defaults to `True`. # 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, + String[1] $ensure = present, + Optional[String[1]] $release = undef, + String[1] $repos = 'main', + Variant[Hash] $include = {}, + Optional[Variant[String[1], Hash]] $key = undef, + Optional[Stdlib::AbsolutePath] $keyring = undef, + Optional[Variant[Hash, Numeric, 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