Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Puppet-lint fixes #153

Merged
merged 5 commits into from
Sep 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def location_for(place, fake_version = nil)
end

group :test do
gem 'voxpupuli-test', '>= 1.0.0', :require => false
gem 'voxpupuli-test', '>= 2.0.0', :require => false
gem 'coveralls', :require => false
gem 'simplecov-console', :require => false
end
Expand Down
4 changes: 1 addition & 3 deletions manifests/acl.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,11 @@
String $order = '05',
String $comment = "acl fragment for ${aclname}",
) {

$type_cleaned = regsubst($type,':','','G')

concat::fragment{"squid_acl_${aclname}":
concat::fragment { "squid_acl_${aclname}":
target => $squid::config,
content => template('squid/squid.conf.acl.erb'),
order => "10-${order}-${type_cleaned}",
}

}
29 changes: 13 additions & 16 deletions manifests/auth_param.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# @summary
# Defines auth_param entries for a squid server.
# @see
# http://www.squid-cache.org/Doc/config/auth_param/
# @summary
# Defines auth_param entries for a squid server.
# @see
# http://www.squid-cache.org/Doc/config/auth_param/
# @example
# squid::auth_param { 'basic auth_param':
# scheme => 'basic',
Expand All @@ -17,25 +17,22 @@
# auth_param basic children 5
# auth_param basic realm Squid Basic Authentication
# auth_param basic credentialsttl 5 hours
#
# @param scheme
#
# @param scheme
# The scheme used for authentication must be defined. Valid values are 'basic', 'digest', 'negotiate' and 'ntlm'.
# @param entries
# @param entries
# An array of entries, multiple members results in multiple lines in squid.conf
# @param order
# @param order
# Order can be used to configure where in `squid.conf`this configuration section should occur.
define squid::auth_param (
Enum['basic', 'digest', 'negotiate', 'ntlm']
$scheme,
Array $entries,
String $auth_param_name = $title,
String $order = '40',
Enum['basic', 'digest', 'negotiate', 'ntlm'] $scheme,
Array $entries,
String $auth_param_name = $title,
String $order = '40',
) {

concat::fragment{"squid_auth_param_${auth_param_name}":
concat::fragment { "squid_auth_param_${auth_param_name}":
target => $squid::config,
content => template('squid/squid.conf.auth_param.erb'),
order => "05-${order}-${scheme}",
}

}
19 changes: 8 additions & 11 deletions manifests/cache.pp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# @summary
# Defines cache entries for a squid server.
# @see
# @summary
# Defines cache entries for a squid server.
# @see
# http://www.squid-cache.org/Doc/config/cache/
# @example
# squid::cache { 'our_network_hosts_acl':
Expand All @@ -18,17 +18,14 @@
# @param order
# Order can be used to configure where in `squid.conf`this configuration section should occur.
define squid::cache (
Enum['allow', 'deny']
$action = 'allow',
String $value = $title,
String $order = '05',
String $comment = "cache fragment for ${value}"
Enum['allow', 'deny'] $action = 'allow',
String $value = $title,
String $order = '05',
String $comment = "cache fragment for ${value}"
) {

concat::fragment{"squid_cache_${value}":
concat::fragment { "squid_cache_${value}":
target => $squid::config,
content => template('squid/squid.conf.cache.erb'),
order => "21-${order}-${action}",
}

}
10 changes: 4 additions & 6 deletions manifests/cache_dir.pp
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,14 @@
String $order = '05',
Boolean $manage_dir = true,
) {

concat::fragment{"squid_cache_dir_${path}":
concat::fragment { "squid_cache_dir_${path}":
target => $squid::config,
content => template('squid/squid.conf.cache_dir.erb'),
order => "50-${order}",
}

if $manage_dir {
file{$path:
file { $path:
ensure => directory,
owner => $squid::daemon_user,
group => $squid::daemon_group,
Expand All @@ -56,16 +55,15 @@
}

if $facts['os']['selinux'] == true {
selinux::fcontext{"selinux fcontext squid_cache_t ${path}":
selinux::fcontext { "selinux fcontext squid_cache_t ${path}":
seltype => 'squid_cache_t',
pathspec => "${path}(/.*)?",
require => File[$path],
notify => Selinux::Exec_restorecon["selinux restorecon ${path}"],
}
selinux::exec_restorecon{"selinux restorecon ${path}":
selinux::exec_restorecon { "selinux restorecon ${path}":
path => $path,
refreshonly => true,
}
}

}
3 changes: 1 addition & 2 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
$extra_config_sections = $squid::extra_config_sections,
$squid_bin_path = $squid::squid_bin_path,
) inherits squid {

concat { $config:
ensure => present,
owner => $config_user,
Expand All @@ -53,7 +52,7 @@
validate_cmd => "${squid_bin_path} -k parse -f %",
}

concat::fragment{'squid_header':
concat::fragment { 'squid_header':
target => $config,
content => template('squid/squid.conf.header.erb'),
order => '01',
Expand Down
3 changes: 1 addition & 2 deletions manifests/extra_config_section.pp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@
Variant[Array,Hash] $config_entries = {},
String $order = '60',
) {

concat::fragment{"squid_extra_config_section_${comment}":
concat::fragment { "squid_extra_config_section_${comment}":
target => $squid::config,
content => template('squid/squid.conf.extra_config_section.erb'),
order => "${order}-${comment}",
Expand Down
21 changes: 9 additions & 12 deletions manifests/http_access.pp
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# @summary
# @summary
# Defines http_access entries for a squid server.
# @see
# @see
# https://github.com/puppetlabs/puppetlabs-docker/blob/master/REFERENCE.md
# @example
# squid::http_access { 'our_networks hosts':
# action => 'allow',
# }
#
#
# Adds a squid.conf line
# # http_access fragment for out_networks hosts
# http_access allow our_networks hosts
#
#
# @example
# squid::http_access { 'our_networks hosts':
# action => 'allow',
Expand All @@ -29,17 +29,14 @@
# @param comment
# http_access entry's preceding comment
define squid::http_access (
Enum['allow', 'deny']
$action = 'allow',
String $value = $title,
String $order = '05',
String $comment = "http_access fragment for ${value}"
Enum['allow', 'deny'] $action = 'allow',
String $value = $title,
String $order = '05',
String $comment = "http_access fragment for ${value}"
) {

concat::fragment{"squid_http_access_${value}":
concat::fragment { "squid_http_access_${value}":
target => $squid::config,
content => template('squid/squid.conf.http_access.erb'),
order => "20-${order}-${action}",
}

}
27 changes: 14 additions & 13 deletions manifests/http_port.pp
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
# @param title
# The title/namevar may be in the form `port` or `host:port` to provide the below values. Otherwise,
# specify `port` explicitly, and `host` if desired.
# @param port
# @param port
# Defaults to the port of the namevar and is the port number to listen on.
# @param host
# @param host
# Defaults to the host part of the namevar and is the interface to listen on. If not specified, Squid listens on all interfaces.
# @param options
# @param options
# A string to specify any options for the default. By default and empty string.
# @param ssl
# @param ssl
# When set to `true` creates https_port entries. Defaults to `false`.
# @param order
# Order can be used to configure where in `squid.conf`this configuration section should occur.
Expand Down Expand Up @@ -72,24 +72,25 @@
default => 'http',
}

concat::fragment{"squid_${protocol}_port_${_title}":
concat::fragment { "squid_${protocol}_port_${_title}":
target => $squid::config,
content => epp('squid/squid.conf.port.epp', {
title => $_title,
protocol => $protocol,
host_port => $_host_port,
options => $options,
}),
content => epp('squid/squid.conf.port.epp',
{
title => $_title,
protocol => $protocol,
host_port => $_host_port,
options => $options,
}
),
order => "30-${order}",
}

if $facts['os']['selinux'] == true {
selinux::port{"selinux port squid_port_t ${_port}":
selinux::port { "selinux port squid_port_t ${_port}":
ensure => 'present',
seltype => 'squid_port_t',
protocol => 'tcp',
port => $_port,
}
}

}
17 changes: 7 additions & 10 deletions manifests/https_port.pp
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
# @summary
# @summary
# Defines https_port entries for a squid server. Results are the same with http_port and ssl set to `true`.
# @see
# @see
# http://www.squid-cache.org/Doc/config/https_port/
# @param port
# @param port
# defaults to the namevar and is the port number.
# @param options
# @param options
# A string to specify any options to add to the https_port line. Defaults to an empty string.
# @param order
# Order can be used to configure where in `squid.conf`this configuration section should occur.
define squid::https_port (
Variant[Pattern[/\d+/], Integer]
$port = $title,
String $options = '',
String $order = '05',
Variant[Pattern[/\d+/], Integer] $port = $title,
String $options = '',
String $order = '05',
) {

squid::http_port { "${port}": # lint:ignore:only_variable_string
ssl => true,
options => $options,
order => $order,
}

}
17 changes: 7 additions & 10 deletions manifests/icp_access.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @summary
# @summary
# Defines icp_access entries for a squid server.
# @see http://www.squid-cache.org/Doc/config/icp_access/
# @example
Expand All @@ -9,22 +9,19 @@
# Adds a squid.conf line
# icp_access allow our_networks hosts
#
# @param action
# @param action
# Must be `deny` or `allow`. By default it is allow. The squid.conf file is ordered so by default
# all allows appear before all denys. This can be overidden with the `order` parameter.
# @param order
# @param order
# Order can be used to configure where in `squid.conf`this configuration section should occur.
define squid::icp_access (
Enum['allow', 'deny']
$action = 'allow',
String $value = $title,
String $order = '05',
Enum['allow', 'deny'] $action = 'allow',
String $value = $title,
String $order = '05',
) {

concat::fragment{"squid_icp_access_${value}":
concat::fragment { "squid_icp_access_${value}":
target => $squid::config,
content => template('squid/squid.conf.icp_access.erb'),
order => "30-${order}-${action}",
}

}
Loading