Skip to content

Commit 404df9d

Browse files
committed
(maint) puppet-strings validate check
This commit includes all the changes needed to pass the validate rake/check which checks if the module adheres to the Puppet Strings style.
1 parent d7abe53 commit 404df9d

26 files changed

+426
-425
lines changed

REFERENCE.md

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

lib/puppet/functions/any_resources_of_type.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1+
# @summary A function used to determine if there are any
2+
# Puppet::Parser::Resource instances of the passed in resource type
13
Puppet::Functions.create_function(:any_resources_of_type, Puppet::Functions::InternalFunction) do
4+
# @return [Boolean] Whether there are any instances of resource_type
5+
# @param resource_type Resource type that is being looked for
6+
# @param parameters Optional parameters
27
dispatch :any_resources_of_type do
38
scope_param
49

lib/puppet/parser/functions/uri_host_from_string.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module Puppet::Parser::Functions
44
newfunction(:uri_host_from_string, arity: 1, type: :rvalue, doc: <<-EOS
5-
Return a uri host from a string
5+
@return Return a uri host from a string
66
EOS
77
) do |args|
88
uri = URI(args[0])

lib/puppet/parser/functions/windows_msi_installargs.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module Puppet::Parser::Functions
22
newfunction(:windows_msi_installargs, arity: 1, type: :rvalue, doc: <<-EOS
3-
Return the $install_options parameter as a string usable in an msiexec command
3+
@return [String] Return the $install_options parameter as a string usable in an msiexec command
44
EOS
55
) do |args|
66
install_args = args[0]

lib/puppet/parser/functions/windows_native_path.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module Puppet::Parser::Functions
2+
# @return Windows native path
23
newfunction(:windows_native_path, arity: 1, type: :rvalue, doc: <<-EOS
3-
Return a windows native path
4+
@return Return a windows native path
45
EOS
56
) do |args|
67
path = args[0]

lib/puppet/provider/puppet_agent_end_run/puppet_agent_end_run.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
12
Puppet::Type.type(:puppet_agent_end_run).provide :puppet_agent_end_run do
3+
desc '@summary This provider will stop the puppet agent run after a Puppet upgrade is performed'
24
def end_run
35
false
46
end

lib/puppet/provider/puppet_agent_upgrade_error/puppet_agent_upgrade_error.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
Puppet::Type.type(:puppet_agent_upgrade_error).provide :puppet_agent_upgrade_error do
2+
desc <<-DESC
3+
@summary This provider checks an error log from a previous puppet agent
4+
installation and will fail if the error log exists. The provider will delete
5+
the existing error log before failing so that after the failed puppet run the
6+
user can attempt the upgrade again.
7+
DESC
28
def ensure_notexist
39
logfile = File.join(Puppet['statedir'].to_s, @resource[:name])
410
Puppet.debug "Checking for Error logfile #{logfile}"

manifests/configure.pp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# @summary Uses $puppet_agent::config to manage settings in puppet.conf.
2+
# It does not require management of the agent package.
13
class puppet_agent::configure {
24
assert_private()
35

manifests/init.pp

Lines changed: 62 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,133 +1,137 @@
1-
# == Class: puppet_agent
1+
# @summary Upgrades Puppet 4 and newer to the requested version.
22
#
3-
# Upgrades Puppet 4 and newer to the requested version.
4-
#
5-
# === Parameters
6-
#
7-
# [arch]
3+
# @param arch
84
# The package architecture. Defaults to the architecture fact.
9-
# [collection]
5+
# @param collection
106
# The Puppet Collection to track. Defaults to 'PC1'.
11-
# [is_pe]
7+
# @param is_pe
128
# Install from Puppet Enterprise repos. Enabled if communicating with a PE master.
13-
# [manage_pki_dir]
9+
# @param manage_pki_dir
1410
# Whether or not to manage the /etc/pki directory. Defaults to true.
1511
# Managing the /etc/pki directory inside the puppet_agent module can be problematic for
1612
# organizations that manage gpg keys and settings in other modules.
17-
# [manage_repo]
13+
# @param manage_repo
1814
# Boolean to determine whether to configure repositories
1915
# This is intended to provide the ability to disable configuring a local repo
2016
# in support of systems that manage external repositories (i.e. spacewalk/satellite)
2117
# to enable users to add the proper packages to their internal repos
2218
# and to utilize default package providers for the install
23-
# [package_name]
19+
# @param package_name
2420
# The package to upgrade to, i.e. `puppet-agent`.
25-
# [package_version]
21+
# @param package_version
2622
# The package version to upgrade to. Explicitly specify the version to upgrade to,
2723
# or set to 'auto' to specify the version of the compiling master.
28-
# [service_names]
24+
# @param service_names
2925
# An array of services to start, normally `puppet`.
3026
# None will be started if the array is empty.
31-
# [source]
27+
# @param source
3228
# **INCLUDED FOR COMPATIBILITY WITH MODULE VERSIONS 1.0/2.0. PREFER USE OF "absolute_source",
3329
# "apt_source", "deb_source" etc. OVER USE OF "source".**
3430
#
3531
# The location to find packages. Replaces base URL for unix/MacOS agents, used as fully
3632
# qualified path in windows
37-
# [absolute_source]
33+
# @param absolute_source
3834
# The exact location of the package to install. The entire path to the package must be
3935
# provided with this parameter.
40-
# [yum_source]
36+
# @param yum_source
4137
# Base URL of the location of mirrors of yum.puppet.com downloads sites. Directories under
4238
# the URL "yum_source" should match the structure of the yum.puppet.com
43-
# [apt_source]
39+
# @param apt_source
4440
# Base URL of the location of mirrors of apt.puppet.com downloads sites. Directories under
4541
# the URL "apt_source" should match the structure of the apt.puppet.com
46-
# [mac_source]
42+
# @param mac_source
4743
# Base URL of the location of mirrors of downloads.puppet.com downloads site that serves
4844
# MacOS packages. Directories under the URL "mac_source" should match the structure of the
4945
# downloads.puppet.com site
50-
# [windows_source]
46+
# @param windows_source
5147
# Base URL of the location of mirrors of downloads.puppet.com downloads site that serves
5248
# Windows packages. Directories under the URL "windows_source" should match the structure of
5349
# the downloads.puppet.com site
54-
# [solaris_source]
50+
# @param solaris_source
5551
# Base URL of the location of a mirror for Solaris packages. Currently, solaris packages can
5652
# only be made available by using puppetlabs-pe_repo. This means the mirror must be of a
5753
# PE master package serve.
58-
# [aix_source]
54+
# @param aix_source
5955
# Base URL of the location of a mirror for AIX packages. Currently, AIX packages can
6056
# only be made available by using puppetlabs-pe_repo. This means the mirror must be of a
6157
# PE master package serve.
62-
# [use_alternate_sources]
58+
# @param use_alternate_sources
6359
# **ONLY APPLICABLE WHEN WORKING WITH PE INSTALLTIONS**
6460
# When set to true will force downloads to come from the values of $apt_source, $deb_source
6561
# $mac_source etc. rather than from the default PE master package serve. Note that this will
6662
# also force downloads to ignore alternate_pe_source
67-
# [alternate_pe_source]
63+
# @param alternate_pe_source
6864
# Base URL of the location where packages are located in the same structure that's served
6965
# by a PE master (the directory structure in PE for serving packages is created by the
7066
# puppetlabs-pe_repo module). The general structure served by PE is:
7167
# /packages/${pe_server_version}/${platform_tag}/${package_name}
72-
# [install_dir]
68+
# @param install_dir
7369
# The directory the puppet agent should be installed to. This is only applicable for
7470
# windows operating systems. This only applies when upgrading the agent to a new
7571
# version; it will not cause re-installation of the same version to a new location.
76-
# [install_options]
72+
# @param install_options
7773
# An array of additional options to pass when installing puppet-agent. Each option in
7874
# the array can either be a string or a hash. Each option will automatically be quoted
7975
# when passed to the install command. With Windows packages, note that file paths in an
8076
# install option must use backslashes. (Since install options are passed directly to
8177
# the installation command, forward slashes won't be automatically converted like they
8278
# are in `file` resources.) Note also that backslashes in double-quoted strings _must_
8379
# be escaped and backslashes in single-quoted strings _can_ be escaped.
84-
# [msi_move_locked_files]
80+
# @param msi_move_locked_files
8581
# This is only applicable for Windows operating systems. There may be instances where
8682
# file locks cause unncessary service restarts. By setting to true, the module
8783
# will move files prior to installation that are known to cause file locks.
88-
# [wait_for_pxp_agent_exit]
84+
# @param wait_for_pxp_agent_exit
8985
# This parameter is only applicable for Windows operating systems and pertains to the
9086
# /files/install_agent.ps1 script. This parameterizes the module to define the wait time
9187
# for the PXP agent to end successfully. The default value is set 2 minutes.
92-
# [wait_for_puppet_run]
88+
# @param wait_for_puppet_run
9389
# This parameter is only applicable for Windows operating systems and pertains to the
9490
# /files/install_agent.ps1 script. This parameterizes the module to define the wait time
9591
# for the current puppet agent run to end successfully. The default value is set 2 minutes.
96-
# [config]
92+
# @param config
9793
# An array of configuration data to enforce. Each configuration data item must be a
9894
# Puppet_agent::Config hash, which has keys for puppet.conf section, setting, and value.
9995
# This parameter is constrained to managing only a predetermined set of configuration
10096
# settings, e.g. runinterval.
97+
# @param proxy
98+
# This is to be able to configure yum-repo with proxy, needed for
99+
# example for clients in dmz:s that need to use proxy to reach the repo
100+
# provided by puppetserver.
101+
# @param version_file_path
102+
# The default install path for the VERSION file
103+
# @param skip_if_unavailable
104+
# @param disable_proxy
101105
class puppet_agent (
102-
$arch = $facts['os']['architecture'],
103-
$collection = $::puppet_agent::params::collection,
104-
$is_pe = $::puppet_agent::params::_is_pe,
105-
$manage_pki_dir = true,
106-
$manage_repo = true,
107-
$package_name = 'puppet-agent',
108-
$package_version = undef,
109-
$service_names = $::puppet_agent::params::service_names,
110-
$source = undef,
111-
$absolute_source = undef,
112-
$yum_source = 'http://yum.puppet.com',
113-
$apt_source = 'https://apt.puppet.com',
114-
$mac_source = 'https://downloads.puppet.com',
115-
$windows_source = 'https://downloads.puppet.com',
116-
$solaris_source = 'puppet:///pe_packages',
117-
$aix_source = 'puppet:///pe_packages',
118-
$use_alternate_sources = false,
119-
$alternate_pe_source = undef,
120-
Optional[Stdlib::Absolutepath] $install_dir = undef,
121-
$disable_proxy = false,
122-
$proxy = undef,
123-
$install_options = [],
124-
$skip_if_unavailable = 'absent',
125-
$msi_move_locked_files = false,
126-
$wait_for_pxp_agent_exit = undef,
127-
$wait_for_puppet_run = undef,
128-
Array[Puppet_agent::Config] $config = [],
129-
$version_file_path = $facts['os']['family'] ? { 'windows' => "${facts['env_windows_installdir']}\\VERSION", default => '/opt/puppetlabs/puppet/VERSION' }
130-
) inherits ::puppet_agent::params {
106+
String $arch = $facts['os']['architecture'],
107+
String $collection = $puppet_agent::params::collection,
108+
Boolean $is_pe = $puppet_agent::params::_is_pe,
109+
Boolean $manage_pki_dir = true,
110+
Boolean $manage_repo = true,
111+
String $package_name = 'puppet-agent',
112+
Optional $package_version = undef,
113+
Array $service_names = $puppet_agent::params::service_names,
114+
Optional $source = undef,
115+
Optional $absolute_source = undef,
116+
String $yum_source = 'http://yum.puppet.com',
117+
String $apt_source = 'https://apt.puppet.com',
118+
String $mac_source = 'https://downloads.puppet.com',
119+
String $windows_source = 'https://downloads.puppet.com',
120+
String $solaris_source = 'puppet:///modules/pe_packages',
121+
String $aix_source = 'puppet:///modules/pe_packages',
122+
Boolean $use_alternate_sources = false,
123+
Optional $alternate_pe_source = undef,
124+
Optional[Stdlib::Absolutepath] $install_dir = undef,
125+
Boolean $disable_proxy = false,
126+
Optional $proxy = undef,
127+
Array $install_options = [],
128+
String $skip_if_unavailable = 'absent',
129+
Boolean $msi_move_locked_files = false,
130+
Optional $wait_for_pxp_agent_exit = undef,
131+
Optional $wait_for_puppet_run = undef,
132+
Array[Puppet_agent::Config] $config = [],
133+
String $version_file_path = $facts['os']['family'] ? { 'windows' => "${facts['env_windows_installdir']}\\VERSION", default => '/opt/puppetlabs/puppet/VERSION' }
134+
) inherits puppet_agent::params {
131135
# The configure class uses $puppet_agent::config to manage settings in
132136
# puppet.conf, and will always be present. It does not require management of
133137
# the agent package. Dependencies for configure will be declared later if the

manifests/install.pp

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
1-
# == Class puppet_agent::install
2-
#
31
# This class is called from puppet_agent for install.
42
#
5-
# === Parameters
6-
#
7-
# [version]
3+
# @param package_version
84
# The puppet-agent version to install.
9-
#
5+
# @param install_dir
6+
# The directory the puppet agent should be installed to. This is only applicable for
7+
# windows operating systems.
8+
# @param install_options
9+
# An array of additional options to pass when installing puppet-agent. Each option in
10+
# the array can either be a string or a hash. Each option will automatically be quoted
11+
# when passed to the install command. With Windows packages, note that file paths in an
12+
# install option must use backslashes. (Since install options are passed directly to
13+
# the installation command, forward slashes won't be automatically converted like they
14+
# are in `file` resources.) Note also that backslashes in double-quoted strings _must_
15+
# be escaped and backslashes in single-quoted strings _can_ be escaped.
1016
class puppet_agent::install (
11-
$package_version = 'present',
12-
$install_dir = undef,
13-
$install_options = [],
17+
String $package_version = 'present',
18+
Optional $install_dir = undef,
19+
Array $install_options = [],
1420
) {
1521
assert_private()
1622

0 commit comments

Comments
 (0)