Skip to content

Commit a0e3944

Browse files
committed
Include review feedback
Use '@api private' for private classes, so they are excluded from REFERENCES.md Use 'String[1]' for username parameter. If it is specified, then it should not be empty. Use 'Sensitive[String[1]]' for password parameter. Use ruby-style way of conditionally setting a variable.
1 parent 999f622 commit a0e3944

File tree

4 files changed

+19
-49
lines changed

4 files changed

+19
-49
lines changed

Diff for: REFERENCE.md

+10-34
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
### Classes
88

9+
#### Public Classes
10+
911
* [`puppet_agent`](#puppet_agent): Upgrades Puppet 4 and newer to the requested version.
1012
* [`puppet_agent::configure`](#puppet_agent--configure): Uses $puppet_agent::config to manage settings in puppet.conf.
1113
* [`puppet_agent::install`](#puppet_agent--install): This class is called from puppet_agent for install.
@@ -22,10 +24,13 @@
2224
* [`puppet_agent::osfamily::windows`](#puppet_agent--osfamily--windows): Determines the puppet-agent package location for Windows OSes.
2325
* [`puppet_agent::params`](#puppet_agent--params): Sets variables according to platform.
2426
* [`puppet_agent::prepare`](#puppet_agent--prepare): This class is called from puppet_agent to prepare for the upgrade.
25-
* [`puppet_agent::prepare::package`](#puppet_agent--prepare--package): Ensures correct puppet-agent package is downloaded locally.
2627
* [`puppet_agent::prepare::puppet_config`](#puppet_agent--prepare--puppet_config): Private class called from puppet_agent::prepare class.
2728
* [`puppet_agent::service`](#puppet_agent--service): Ensures that managed services are running.
2829

30+
#### Private Classes
31+
32+
* `puppet_agent::prepare::package`: Ensures correct puppet-agent package is downloaded locally.
33+
2934
### Resource types
3035

3136
* [`puppet_agent_end_run`](#puppet_agent_end_run): Stops the current Puppet run if a puppet-agent upgrade was performed. Used on platforms that manage the Puppet Agent upgrade with a package r
@@ -614,35 +619,6 @@ The puppet-agent version to install.
614619

615620
Default value: `undef`
616621

617-
### <a name="puppet_agent--prepare--package"></a>`puppet_agent::prepare::package`
618-
619-
for installation. This is used on platforms without package managers capable of
620-
working with a remote https repository.
621-
622-
#### Parameters
623-
624-
The following parameters are available in the `puppet_agent::prepare::package` class:
625-
626-
* [`source`](#-puppet_agent--prepare--package--source)
627-
* [`package_file_name`](#-puppet_agent--prepare--package--package_file_name)
628-
629-
##### <a name="-puppet_agent--prepare--package--source"></a>`source`
630-
631-
Data type: `Variant[String, Array]`
632-
633-
The source file for the puppet-agent package. Can use any of the data types
634-
and protocols that the File resource's source attribute can.
635-
636-
##### <a name="-puppet_agent--prepare--package--package_file_name"></a>`package_file_name`
637-
638-
Data type: `Optional[String]`
639-
640-
The destination file name for the puppet-agent package. If no destination
641-
is given, then the basename component of the source will be used as the
642-
destination filename.
643-
644-
Default value: `undef`
645-
646622
### <a name="puppet_agent--prepare--puppet_config"></a>`puppet_agent::prepare::puppet_config`
647623

648624
Private class called from puppet_agent::prepare class.
@@ -1006,13 +982,13 @@ The number of retries in case of network connectivity failures
1006982

1007983
##### `username`
1008984

1009-
Data type: `Optional[String]`
985+
Data type: `Optional[String[1]]`
1010986

1011987
The username to use when downloading from a source location requiring authentication
1012988

1013989
##### `password`
1014990

1015-
Data type: `Optional[String]`
991+
Data type: `Optional[Sensitive[String[1]]]`
1016992

1017993
The password to use when downloading from a source location requiring authentication
1018994

@@ -1086,13 +1062,13 @@ The number of retries in case of network connectivity failures
10861062

10871063
##### `username`
10881064

1089-
Data type: `Optional[String]`
1065+
Data type: `Optional[String[1]]`
10901066

10911067
The username to use when downloading from a source location requiring authentication
10921068

10931069
##### `password`
10941070

1095-
Data type: `Optional[String]`
1071+
Data type: `Optional[String[1]]`
10961072

10971073
The password to use when downloading from a source location requiring authentication
10981074

Diff for: manifests/prepare/package.pp

+5-11
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,26 @@
22
# for installation. This is used on platforms without package managers capable of
33
# working with a remote https repository.
44
#
5-
# @param source
6-
# The source file for the puppet-agent package. Can use any of the data types
7-
# and protocols that the File resource's source attribute can.
8-
# @param destination_name
9-
# The destination file name for the puppet-agent package. If no destination
10-
# is given, then the basename component of the source will be used as the
11-
# destination name.
5+
# @api private
126
class puppet_agent::prepare::package (
137
Variant[String, Array] $source,
14-
Optional[String] $destination_name = undef
8+
Optional[String[1]] $destination_name = undef
159
) {
1610
assert_private()
1711

1812
file { $puppet_agent::params::local_packages_dir:
1913
ensure => directory,
2014
}
2115

22-
if $destination_name {
23-
$package_file_name = $destination_name
16+
$package_file_name = if $destination_name {
17+
$destination_name
2418
} else {
2519
# In order for the 'basename' function to work correctly we need to change
2620
# any \s to /s (even for windows UNC paths) so that it will correctly pull off
2721
# the filename. Since this operation is only grabbing the base filename and not
2822
# any part of the path this should be safe, since the source will simply remain
2923
# what it was before and we can still pull off the filename.
30-
$package_file_name = basename(regsubst($source, "\\\\", '/', 'G'))
24+
basename(regsubst($source, "\\\\", '/', 'G'))
3125
}
3226

3327
if $facts['os']['family'] =~ /windows/ {

Diff for: tasks/install_powershell.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@
4545
},
4646
"username": {
4747
"description": "The username to use when downloading from a source location requiring authentication",
48-
"type": "Optional[String]"
48+
"type": "Optional[String[1]]"
4949
},
5050
"password": {
5151
"description": "The password to use when downloading from a source location requiring authentication",
52-
"type": "Optional[String]"
52+
"type": "Optional[Sensitive[String[1]]]"
5353
}
5454
},
5555
"supports_noop": true

Diff for: tasks/install_shell.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@
4646
},
4747
"username": {
4848
"description": "The username to use when downloading from a source location requiring authentication",
49-
"type": "Optional[String]"
49+
"type": "Optional[String[1]]"
5050
},
5151
"password": {
5252
"description": "The password to use when downloading from a source location requiring authentication",
53-
"type": "Optional[String]"
53+
"type": "Optional[Sensitive[String[1]]]"
5454
}
5555
},
5656
"files": ["facts/tasks/bash.sh"],

0 commit comments

Comments
 (0)