From 7893bb6ac722a99ad99a27359292c84849a73595 Mon Sep 17 00:00:00 2001 From: Michael Hashizume Date: Thu, 28 Sep 2023 12:55:03 -0700 Subject: [PATCH] (PA-5820) Correct parameter types Previously, 74e022d erroneously typed the $package_version and $install_options parameters as Optional. This commit updates those parameters to be required, and gives a more specific type to $install_options. --- REFERENCE.md | 22 +++++++++++----------- manifests/install.pp | 6 +++--- manifests/install/darwin.pp | 4 ++-- manifests/install/solaris.pp | 4 ++-- manifests/install/suse.pp | 4 ++-- manifests/install/windows.pp | 2 +- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index faf0fb3c..337690b2 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -389,11 +389,11 @@ The following parameters are available in the `puppet_agent::install` class: ##### `package_version` -Data type: `Optional[String]` +Data type: `String` The puppet-agent version to install. -Default value: `undef` +Default value: `'present'` ##### `install_dir` @@ -406,7 +406,7 @@ Default value: `undef` ##### `install_options` -Data type: `Optional[Array]` +Data type: `Array[Variant[String, Hash]]` An array of additional options to pass when installing puppet-agent. Each option in the array can either be a string or a hash. Each option will automatically be quoted @@ -416,7 +416,7 @@ the installation command, forward slashes won't be automatically converted like are in `file` resources.) Note also that backslashes in double-quoted strings _must_ be escaped and backslashes in single-quoted strings _can_ be escaped. -Default value: `undef` +Default value: `[]` ### `puppet_agent::install::darwin` @@ -437,7 +437,7 @@ The puppet-agent version to install. ##### `install_options` -Data type: `Optional[Array]` +Data type: `Array[Variant[String, Hash]]` An array of additional options to pass when installing puppet-agent. Each option in the array can either be a string or a hash. Each option will automatically be quoted @@ -447,7 +447,7 @@ the installation command, forward slashes won't be automatically converted like are in `file` resources.) Note also that backslashes in double-quoted strings _must_ be escaped and backslashes in single-quoted strings _can_ be escaped. -Default value: `undef` +Default value: `[]` ### `puppet_agent::install::solaris` @@ -468,7 +468,7 @@ The puppet-agent version to install. ##### `install_options` -Data type: `Optional[Array]` +Data type: `Array[Variant[String, Hash]]` An array of additional options to pass when installing puppet-agent. Each option in the array can either be a string or a hash. Each option will automatically be quoted @@ -478,7 +478,7 @@ the installation command, forward slashes won't be automatically converted like are in `file` resources.) Note also that backslashes in double-quoted strings _must_ be escaped and backslashes in single-quoted strings _can_ be escaped. -Default value: `undef` +Default value: `[]` ### `puppet_agent::install::suse` @@ -499,7 +499,7 @@ The puppet-agent version to install. ##### `install_options` -Data type: `Optional[Array]` +Data type: `Array[Variant[String, Hash]]` An array of additional options to pass when installing puppet-agent. Each option in the array can either be a string or a hash. @@ -510,7 +510,7 @@ command, forward slashes won't be automatically converted like they are in `file` resources.) Note also that backslashes in double-quoted strings _must_ be escaped and backslashes in single-quoted strings _can_ be escaped. -Default value: `undef` +Default value: `[]` ### `puppet_agent::install::windows` @@ -525,7 +525,7 @@ The following parameters are available in the `puppet_agent::install::windows` c ##### `install_options` -Data type: `Array` +Data type: `Array[Variant[String, Hash]]` An array of additional options to pass when installing puppet-agent. Each option in the array can either be a string or a hash. Each option will automatically be quoted diff --git a/manifests/install.pp b/manifests/install.pp index ba7af90d..eed05ca6 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -14,9 +14,9 @@ # are in `file` resources.) Note also that backslashes in double-quoted strings _must_ # be escaped and backslashes in single-quoted strings _can_ be escaped. class puppet_agent::install ( - Optional[String] $package_version = undef, - Optional[[Stdlib::Absolutepath]] $install_dir = undef, - Optional[Array] $install_options = undef, + String $package_version = 'present', + Optional[Stdlib::Absolutepath] $install_dir = undef, + Array[Variant[String, Hash]] $install_options = [], ) { assert_private() diff --git a/manifests/install/darwin.pp b/manifests/install/darwin.pp index 912ab4ae..940ba9dc 100644 --- a/manifests/install/darwin.pp +++ b/manifests/install/darwin.pp @@ -12,8 +12,8 @@ # are in `file` resources.) Note also that backslashes in double-quoted strings _must_ # be escaped and backslashes in single-quoted strings _can_ be escaped. class puppet_agent::install::darwin ( - String $package_version, - Optional[Array] $install_options = undef, + String $package_version, + Array[Variant[String, Hash]] $install_options = [], ) { assert_private() $install_script = 'osx_install.sh.erb' diff --git a/manifests/install/solaris.pp b/manifests/install/solaris.pp index e8bc513f..880468b7 100644 --- a/manifests/install/solaris.pp +++ b/manifests/install/solaris.pp @@ -12,8 +12,8 @@ # are in `file` resources.) Note also that backslashes in double-quoted strings _must_ # be escaped and backslashes in single-quoted strings _can_ be escaped. class puppet_agent::install::solaris ( - String $package_version, - Optional[Array] $install_options = undef, + String $package_version, + Array[Variant[String, Hash]] $install_options = [], ) { assert_private() if $facts['os']['release']['major'] == '10' { diff --git a/manifests/install/suse.pp b/manifests/install/suse.pp index 9769ed6b..2096574c 100644 --- a/manifests/install/suse.pp +++ b/manifests/install/suse.pp @@ -13,8 +13,8 @@ # `file` resources.) Note also that backslashes in double-quoted strings # _must_ be escaped and backslashes in single-quoted strings _can_ be escaped. class puppet_agent::install::suse ( - String $package_version, - Optional[Array] $install_options = undef, + String $package_version, + Array[Variant[String, Hash]] $install_options = [], ) { assert_private() diff --git a/manifests/install/windows.pp b/manifests/install/windows.pp index c03f97c5..5da7328e 100644 --- a/manifests/install/windows.pp +++ b/manifests/install/windows.pp @@ -14,7 +14,7 @@ # windows operating systems. class puppet_agent::install::windows ( Optional $install_dir = undef, - Array $install_options = [], + Array[Variant[String, Hash]] $install_options = [], ) { assert_private()