From 16b662cea4f36c8940e9cef3470a30fa59f37ec7 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 15 Dec 2021 21:01:14 +0100 Subject: [PATCH 1/7] modulesync 5.1.0 --- .msync.yml | 2 +- .puppet-lint.rc | 3 +++ Gemfile | 4 ++-- Rakefile | 2 +- spec/spec_helper.rb | 10 +++++----- spec/spec_helper_acceptance.rb | 2 ++ 6 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 .puppet-lint.rc diff --git a/.msync.yml b/.msync.yml index 43966c2..a83abd9 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '4.2.0' +modulesync_config_version: '5.1.0' diff --git a/.puppet-lint.rc b/.puppet-lint.rc new file mode 100644 index 0000000..dd8272c --- /dev/null +++ b/.puppet-lint.rc @@ -0,0 +1,3 @@ +--fail-on-warnings +--no-parameter_documentation-check +--no-parameter_types-check diff --git a/Gemfile b/Gemfile index a39114c..b6dcf45 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" group :test do - gem 'voxpupuli-test', '~> 2.5', :require => false + gem 'voxpupuli-test', '~> 5.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false gem 'puppet_metadata', '~> 1.0', :require => false @@ -21,7 +21,7 @@ end group :release do gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5' - gem 'voxpupuli-release', '>= 1.0.2', :require => false + gem 'voxpupuli-release', '>= 1.2.0', :require => false gem 'puppet-strings', '>= 2.2', :require => false end diff --git a/Rakefile b/Rakefile index 80b799d..f92f051 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,7 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -# Attempt to load voxupuli-test (which pulls in puppetlabs_spec_helper), +# Attempt to load voxpupuli-test (which pulls in puppetlabs_spec_helper), # otherwise attempt to load it directly. begin require 'voxpupuli/test/rake' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index fb5f0cb..4d617f3 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,17 +1,17 @@ +# frozen_string_literal: true + # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ # puppetlabs_spec_helper will set up coverage if the env variable is set. # We want to do this if lib exists and it hasn't been explicitly set. -ENV['COVERAGE'] ||= 'yes' if Dir.exist?(File.expand_path('../../lib', __FILE__)) +ENV['COVERAGE'] ||= 'yes' if Dir.exist?(File.expand_path('../lib', __dir__)) require 'voxpupuli/test/spec_helper' if File.exist?(File.join(__dir__, 'default_module_facts.yml')) facts = YAML.safe_load(File.read(File.join(__dir__, 'default_module_facts.yml'))) - if facts - facts.each do |name, value| - add_custom_fact name.to_sym, value - end + facts&.each do |name, value| + add_custom_fact name.to_sym, value end end diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 78021a2..80d712c 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'voxpupuli/acceptance/spec_helper_acceptance' configure_beaker do |host| From 82eedc2c122e5c08e1157956ce71005e4d319d50 Mon Sep 17 00:00:00 2001 From: Steve Traylen Date: Tue, 22 Mar 2022 13:46:20 +0100 Subject: [PATCH 2/7] Remove default empty string parameters For the defined types and parameters * For `squid::cache_dir` and the parameter `options` the default is now `undef` rather than `''` * For `squid::snmp_port` and the parameter `options` the default is now `undef` rather than `''` * For `squid::refresh_pattern` and the parameter `options` the default is now `undef` rather than `''` * For `squid::http_port` and the parameter `options` the default is now `undef` rather than `''` * For `squid::http_ports` and the parameter `options` the default is now `undef` rather than `''` This is backwards compatible for all cases except when `options` has been explicitly set to `''` but I feel that is a non-case. e.g. ```puppet squid::http_port{80: options => '', ``` would fail. Resolves the linter problem params_empty_string_assignment. --- manifests/cache_dir.pp | 37 ++++++++++++++---------- manifests/http_port.pp | 4 +-- manifests/https_port.pp | 4 +-- manifests/refresh_pattern.pp | 36 ++++++++++++++--------- manifests/snmp_port.pp | 16 ++++++---- spec/defines/cache_dir_spec.rb | 15 ++++++++++ spec/defines/http_port_spec.rb | 12 ++++---- spec/defines/snmp_port_spec.rb | 2 +- templates/squid.conf.cache_dir.epp | 20 +++++++++++++ templates/squid.conf.cache_dir.erb | 10 ------- templates/squid.conf.port.epp | 4 +-- templates/squid.conf.refresh_pattern.epp | 11 +++++++ templates/squid.conf.refresh_pattern.erb | 2 -- templates/squid.conf.snmp_port.epp | 19 ++++++++++++ templates/squid.conf.snmp_port.erb | 10 ------- 15 files changed, 132 insertions(+), 70 deletions(-) create mode 100644 templates/squid.conf.cache_dir.epp delete mode 100644 templates/squid.conf.cache_dir.erb create mode 100644 templates/squid.conf.refresh_pattern.epp delete mode 100644 templates/squid.conf.refresh_pattern.erb create mode 100644 templates/squid.conf.snmp_port.epp delete mode 100644 templates/squid.conf.snmp_port.erb diff --git a/manifests/cache_dir.pp b/manifests/cache_dir.pp index 306bdfe..4de3eb7 100644 --- a/manifests/cache_dir.pp +++ b/manifests/cache_dir.pp @@ -1,7 +1,7 @@ -# @summary +# @summary # Defines cache_dir entries for a squid server. # @see -# http://www.squid-cache.org/Doc/config/cache_dir/ +# http://www.squid-cache.org/Doc/config/cache_dir/ # @example # squid::cache_dir { '/data': # type => 'ufs', @@ -14,33 +14,40 @@ # cache_dir ufs 15000 32 256 min-size=32769 # endif # -# @param type +# @param type # The type of cache, e.g ufs. defaults to `ufs`. -# @param path +# @param path # Defaults to the namevar, file path to cache. -# @param options -# String of options for the cache. Defaults to empty string. -# @param process_number +# @param options +# String of options for the cache. +# @param process_number # If specfied as an integer the cache will be wrapped # in a `if $proceess_number` statement so the cache will be used by only # one process. Default is undef. -# @param manage_dir +# @param manage_dir # If true puppet will attempt to create the # directory, if false you will have to create it yourself. Make sure the # directory has the correct owner, group and mode. Defaults to true. # @param order # Order can be used to configure where in `squid.conf`this configuration section should occur. define squid::cache_dir ( - String $type = ufs, - String $path = $title, - String $options = '', - Optional[Integer] $process_number = undef, - String $order = '05', - Boolean $manage_dir = true, + String $type = ufs, + String $path = $title, + Optional[String[1]] $options = undef, + Optional[Integer] $process_number = undef, + String $order = '05', + Boolean $manage_dir = true, ) { concat::fragment { "squid_cache_dir_${path}": target => $squid::config, - content => template('squid/squid.conf.cache_dir.erb'), + content => epp('squid/squid.conf.cache_dir.epp', + { + 'process_number' => $process_number, + 'path' => $path, + 'type' => $type, + 'options' => $options, + } + ), order => "50-${order}", } diff --git a/manifests/http_port.pp b/manifests/http_port.pp index 291688c..7042eb2 100644 --- a/manifests/http_port.pp +++ b/manifests/http_port.pp @@ -26,7 +26,7 @@ # @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 -# A string to specify any options for the default. By default and empty string. +# A string to specify any options for the default. # @param ssl # When set to `true` creates https_port entries. Defaults to `false`. # @param order @@ -35,7 +35,7 @@ Optional[Stdlib::Port] $port = undef, Optional[Stdlib::Host] $host = undef, Boolean $ssl = false, - String $options = '', + Optional[String[1]] $options = undef, String $order = '05', ) { $_title = String($title) diff --git a/manifests/https_port.pp b/manifests/https_port.pp index cfba1a6..86886a2 100644 --- a/manifests/https_port.pp +++ b/manifests/https_port.pp @@ -5,12 +5,12 @@ # @param port # defaults to the namevar and is the port number. # @param options -# A string to specify any options to add to the https_port line. Defaults to an empty string. +# A string to specify any options to add to the https_port line. # @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 = '', + Optional[String[1]] $options = undef, String $order = '05', ) { squid::http_port { "${port}": # lint:ignore:only_variable_string diff --git a/manifests/refresh_pattern.pp b/manifests/refresh_pattern.pp index ec59b91..44608af 100644 --- a/manifests/refresh_pattern.pp +++ b/manifests/refresh_pattern.pp @@ -23,7 +23,7 @@ # # refresh_pattern fragment for (/cgi-bin/|\?) # refresh_pattern (/cgi-bin/|\?) -i 0 0% 0 # -# +# # @example YAML example # squid::refresh_patterns: # '^ftp': @@ -48,33 +48,41 @@ # percent: 20 # order: '63' # -# @param case_sensitive +# @param case_sensitive # If true (default) the regex is case sensitive, when false the case insensitive flag '-i' is added to the pattern -# @param comment +# @param comment # Comment added before refresh rule, defaults to refresh_pattern fragment for `title` -# @param min +# @param min # Must be defined, the time (in minutes) an object without an explicit expiry time should be considered fresh. -# @param max +# @param max # Must be defined, the upper limit (in minutes) on how long objects without an explicit expiry time will be considered fresh. -# @param percent +# @param percent # Must be defined, is a percentage of the objects age (time since last modification age) -# @param options +# @param options # See squid documentation for available options. -# @param order +# @param order # Each refresh_pattern has an order `05` by default this can be specified if order of refresh_pattern definition matters. define squid::refresh_pattern ( Integer $max, Integer $min, Integer $percent, - Boolean $case_sensitive = true, - String $options = '', - String $order = '05', - String $pattern = $title, - String $comment = "refresh_pattern fragment for ${pattern}", + Boolean $case_sensitive = true, + Optional[String[1]] $options = undef, + String $order = '05', + String $pattern = $title, + String $comment = "refresh_pattern fragment for ${pattern}", ) { concat::fragment { "squid_refresh_pattern_${pattern}": target => $squid::config, - content => template('squid/squid.conf.refresh_pattern.erb'), + content => epp('squid/squid.conf.refresh_pattern.epp',{ + 'comment' => $comment, + 'case_sensitive' => $case_sensitive, + 'pattern' => $pattern, + 'max' => $max, + 'min' => $min, + 'options' => $options, + 'percent' => $percent, + }), order => "45-${order}", } } diff --git a/manifests/snmp_port.pp b/manifests/snmp_port.pp index b4b34dd..31a3d18 100644 --- a/manifests/snmp_port.pp +++ b/manifests/snmp_port.pp @@ -15,20 +15,24 @@ # @param port # Defaults to the namevar and is the port number. # @param options -# A string to specify any options for the default. By default and empty string. +# A string to specify any options for the default. # @param process_number # If set to and integer the snmp\_port is enabled only for a particular squid thread. Defaults to undef. # @param order # Order can be used to configure where in `squid.conf`this configuration section should occur. define squid::snmp_port ( - Variant[Pattern[/\d+/], Integer] $port = $title, - String $options = '', - String $order = '05', - Optional[Integer] $process_number = undef, + Variant[Pattern[/\d+/], Stdlib::Port] $port = $title, + Optional[String[1]] $options = undef, + String $order = '05', + Optional[Integer] $process_number = undef, ) { concat::fragment { "squid_snmp_port_${port}": target => $squid::config, - content => template('squid/squid.conf.snmp_port.erb'), + content => epp('squid/squid.conf.snmp_port.epp',{ + 'port' => $port, + 'options' => $options, + 'process_number' => $process_number, + }), order => "40-${order}", } } diff --git a/spec/defines/cache_dir_spec.rb b/spec/defines/cache_dir_spec.rb index 661187f..6086c37 100644 --- a/spec/defines/cache_dir_spec.rb +++ b/spec/defines/cache_dir_spec.rb @@ -72,6 +72,21 @@ it { is_expected.to contain_concat_fragment('squid_cache_dir_/data').without_content(%r{^endif$}) } it { is_expected.to contain_concat_fragment('squid_cache_dir_/data').without_content(%r{^if \${process_number}$}) } end + context 'when parameters are set excluding options' do + let(:params) do + { + type: 'special', + order: '07', + } + end + + it { is_expected.to contain_concat_fragment('squid_cache_dir_/data').with_target('/tmp/squid.conf') } + it { is_expected.to contain_concat_fragment('squid_cache_dir_/data').with_order('50-07') } + it { is_expected.to contain_concat_fragment('squid_cache_dir_/data').with_content(%r{^cache_dir special \/data$}) } + it { is_expected.to contain_concat_fragment('squid_cache_dir_/data').without_content(%r{^endif$}) } + it { is_expected.to contain_concat_fragment('squid_cache_dir_/data').without_content(%r{^if \${process_number}$}) } + end + end end end diff --git a/spec/defines/http_port_spec.rb b/spec/defines/http_port_spec.rb index 7a7a6f2..187046c 100644 --- a/spec/defines/http_port_spec.rb +++ b/spec/defines/http_port_spec.rb @@ -18,7 +18,7 @@ it { is_expected.to contain_concat_fragment('squid_http_port_1000').with_target('/tmp/squid.conf') } it { is_expected.to contain_concat_fragment('squid_http_port_1000').with_order('30-05') } - it { is_expected.to contain_concat_fragment('squid_http_port_1000').with_content(%r{^http_port\s+1000\s*$}) } + it { is_expected.to contain_concat_fragment('squid_http_port_1000').with_content(%r{^http_port\s+1000$}) } end context 'with garbage title and no parameters' do let(:title) { 'garbage' } @@ -28,7 +28,7 @@ context 'when host:port title is set' do let(:title) { '127.0.0.1:1500' } - it { is_expected.to contain_concat_fragment('squid_http_port_127.0.0.1:1500').with_content(%r{^http_port\s+127\.0\.0\.1:1500\s*$}) } + it { is_expected.to contain_concat_fragment('squid_http_port_127.0.0.1:1500').with_content(%r{^http_port\s+127\.0\.0\.1:1500$}) } end context 'with invalid port (non-numeric) in host:port title' do let(:title) { 'my:test' } @@ -59,7 +59,7 @@ end # Ignore the host part of the title if a port is specified - it { is_expected.to contain_concat_fragment('squid_http_port_host:1650').with_content(%r{^http_port\s+1650\s*$}) } + it { is_expected.to contain_concat_fragment('squid_http_port_host:1650').with_content(%r{^http_port\s+1650$}) } end context 'without a port specified' do let(:title) { 'garbage' } @@ -80,7 +80,7 @@ } end - it { is_expected.to contain_concat_fragment('squid_http_port_test').with_content(%r{^http_port\s+127\.0\.0\.1:1700\s*$}) } + it { is_expected.to contain_concat_fragment('squid_http_port_test').with_content(%r{^http_port\s+127\.0\.0\.1:1700$}) } end context 'when parameters are set' do let(:title) { 'my:test' } # Arguments shoud override title @@ -105,7 +105,7 @@ } end - it { is_expected.to contain_concat_fragment('squid_http_port_my:test').with_content(%r{^http_port\s+host:2100\s*$}) } + it { is_expected.to contain_concat_fragment('squid_http_port_my:test').with_content(%r{^http_port\s+host:2100$}) } end context 'when ssl => true' do let(:title) { '3000' } @@ -115,7 +115,7 @@ } end - it { is_expected.to contain_concat_fragment('squid_https_port_3000').with_content(%r{^https_port\s+3000\s*$}) } + it { is_expected.to contain_concat_fragment('squid_https_port_3000').with_content(%r{^https_port\s+3000$}) } end end end diff --git a/spec/defines/snmp_port_spec.rb b/spec/defines/snmp_port_spec.rb index 906d67e..7a2d771 100644 --- a/spec/defines/snmp_port_spec.rb +++ b/spec/defines/snmp_port_spec.rb @@ -17,7 +17,7 @@ context 'when parameters are unset' do it { is_expected.to contain_concat_fragment('squid_snmp_port_1000').with_target('/tmp/squid.conf') } it { is_expected.to contain_concat_fragment('squid_snmp_port_1000').with_order('40-05') } - it { is_expected.to contain_concat_fragment('squid_snmp_port_1000').with_content(%r{^snmp_port\s+1000\s*$}) } + it { is_expected.to contain_concat_fragment('squid_snmp_port_1000').with_content(%r{^snmp_port\s+1000$}) } it { is_expected.to contain_concat_fragment('squid_snmp_port_1000').without_content(%r{^endif$}) } it { is_expected.to contain_concat_fragment('squid_snmp_port_1000').without_content(%r{^if \${process_number}$}) } end diff --git a/templates/squid.conf.cache_dir.epp b/templates/squid.conf.cache_dir.epp new file mode 100644 index 0000000..01db05d --- /dev/null +++ b/templates/squid.conf.cache_dir.epp @@ -0,0 +1,20 @@ +<%- | + String[1] $path, + String[1] $type, + Optional[String[1]] $options = undef, + Optional[Integer] $process_number = undef, +| -%> +# fragment for cache_dir <%= $path %> +<% if $process_number { -%> +if ${process_number} = <%= $process_number %> +<% } -%> +<% if $options { -%> +cache_dir <%= $type %> <%= $path %> <%= $options %> +<% } else { -%> +cache_dir <%= $type %> <%= $path %> +<% } -%> +<% if $process_number { -%> +endif +<% } -%> + + diff --git a/templates/squid.conf.cache_dir.erb b/templates/squid.conf.cache_dir.erb deleted file mode 100644 index b4943b9..0000000 --- a/templates/squid.conf.cache_dir.erb +++ /dev/null @@ -1,10 +0,0 @@ -# fragment for cache_dir <%= @path %> -<% if @process_number -%> -if ${process_number} = <%= @process_number %> -<% end -%> -cache_dir <%= @type %> <%= @path %> <%= @options %> -<% if @process_number -%> -endif -<% end -%> - - diff --git a/templates/squid.conf.port.epp b/templates/squid.conf.port.epp index 3b558be..deb884e 100644 --- a/templates/squid.conf.port.epp +++ b/templates/squid.conf.port.epp @@ -1,8 +1,8 @@ <%- | String $title, String $protocol, String $host_port, - String $options, + Optional[String[1]] $options, | -%> # fragment for <%= $protocol %>_port <%= $title %> -<%= $protocol %>_port <%= $host_port %> <%= $options %> +<%= $protocol %>_port <%= $host_port %><% if $options { %> <%= $options %><% } %> diff --git a/templates/squid.conf.refresh_pattern.epp b/templates/squid.conf.refresh_pattern.epp new file mode 100644 index 0000000..7a76f37 --- /dev/null +++ b/templates/squid.conf.refresh_pattern.epp @@ -0,0 +1,11 @@ +<%- | + String $comment, + Boolean $case_sensitive, + String[1] $pattern, + Integer $max, + Integer $min, + Integer $percent, + Optional[String[1]] $options, +| -%> +# <%= $comment %> +refresh_pattern <% unless $case_sensitive { %> -i <% } %><%= $pattern %> <%= $min %> <%= $percent %>% <%= $max %><% if $options { %> <%= $options %><% } %> diff --git a/templates/squid.conf.refresh_pattern.erb b/templates/squid.conf.refresh_pattern.erb deleted file mode 100644 index 1b879fe..0000000 --- a/templates/squid.conf.refresh_pattern.erb +++ /dev/null @@ -1,2 +0,0 @@ -# <%= @comment %> -refresh_pattern <%= @case_sensitive?'':'-i ' %><%= @pattern %> <%= @min %> <%= @percent %>% <%= @max %><% if @options != '' %> <%= @options %><% end %> diff --git a/templates/squid.conf.snmp_port.epp b/templates/squid.conf.snmp_port.epp new file mode 100644 index 0000000..a26a293 --- /dev/null +++ b/templates/squid.conf.snmp_port.epp @@ -0,0 +1,19 @@ +<%- | + Variant[Stdlib::Port,Pattern[/\A\d+\z/]] $port, + Optional[String[1]] $options = undef, + Optional[Integer] $process_number = undef, +| -%> +# fragment for snmp_port <%= $port %> +<% if $process_number { -%> +if ${process_number} = <%= $process_number %> +<% } -%> +<% if $options { -%> +snmp_port <%= $port %> <%= $options %> +<% } else { -%> +snmp_port <%= $port %> +<% } -%> +<% if $process_number { -%> +endif +<% } -%> + + diff --git a/templates/squid.conf.snmp_port.erb b/templates/squid.conf.snmp_port.erb deleted file mode 100644 index 3d5c016..0000000 --- a/templates/squid.conf.snmp_port.erb +++ /dev/null @@ -1,10 +0,0 @@ -# fragment for snmp_port <%= @port %> -<% if @process_number -%> -if ${process_number} = <%= @process_number %> -<% end -%> -snmp_port <%= @port %> <%= @options %> -<% if @process_number -%> -endif -<% end -%> - - From cb25f49fcdb54d81ef521438792b8b58841c90a5 Mon Sep 17 00:00:00 2001 From: Steve Traylen Date: Tue, 22 Mar 2022 14:40:49 +0100 Subject: [PATCH 3/7] rubocop auto_correct results --- spec/acceptance/class_spec.rb | 2 ++ spec/classes/init_spec.rb | 38 ++++++++++++----------- spec/defines/acl_spec.rb | 3 ++ spec/defines/auth_param_spec.rb | 4 +++ spec/defines/cache_dir_spec.rb | 9 ++++-- spec/defines/cache_spec.rb | 4 +++ spec/defines/extra_config_section_spec.rb | 13 +++++--- spec/defines/http_access_spec.rb | 4 +++ spec/defines/http_port_spec.rb | 22 ++++++++++--- spec/defines/https_port_spec.rb | 4 +++ spec/defines/icp_access_spec.rb | 3 ++ spec/defines/refresh_pattern_spec.rb | 28 +++++++++-------- spec/defines/send_hit_spec.rb | 4 +++ spec/defines/snmp_access_spec.rb | 4 +++ spec/defines/snmp_port_spec.rb | 3 ++ spec/defines/ssl_bump_spec.rb | 4 +++ spec/defines/sslproxy_cert_error_spec.rb | 4 +++ spec/type_aliases/squid_size_spec.rb | 2 ++ 18 files changed, 113 insertions(+), 42 deletions(-) diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index 16dcdc0..a80cbf3 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper_acceptance' describe 'squid class' do diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 1a665f0..14f3fe1 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'squid' do on_supported_os.each do |os, facts| @@ -345,13 +347,13 @@ http_access: { 'myrule' => { 'action' => 'deny', - 'value' => 'this and that', - 'order' => '08' + 'value' => 'this and that', + 'order' => '08' }, 'secondrule' => { - 'action' => 'deny', - 'value' => 'this too', - 'order' => '09', + 'action' => 'deny', + 'value' => 'this too', + 'order' => '09', 'comment' => 'Deny this and too' } } @@ -377,13 +379,13 @@ snmp_access: { 'myrule' => { 'action' => 'deny', - 'value' => 'this and that', - 'order' => '08' + 'value' => 'this and that', + 'order' => '08' }, 'secondrule' => { - 'action' => 'deny', - 'value' => 'this too', - 'order' => '09', + 'action' => 'deny', + 'value' => 'this too', + 'order' => '09', 'comment' => 'Deny this and too' } } @@ -469,13 +471,13 @@ icp_access: { 'myrule' => { 'action' => 'deny', - 'value' => 'this and that', - 'order' => '08' + 'value' => 'this and that', + 'order' => '08' }, 'secondrule' => { 'action' => 'deny', - 'value' => 'this too', - 'order' => '09' + 'value' => 'this too', + 'order' => '09' } } @@ -559,7 +561,7 @@ context 'with cache_dir parameters set + SELINUX' do let :params do { config: '/tmp/squid.conf', - cache_dirs: { '/data' => { 'type' => 'special', + cache_dirs: { '/data' => { 'type' => 'special', 'options' => 'my options for special type' } } } end let(:facts) { override_facts(super(), os: { selinux: { enabled: true } }) } @@ -585,7 +587,7 @@ context 'with snmp_port parameters set' do let :params do { config: '/tmp/squid.conf', - snmp_ports: { 2000 => { 'options' => 'special for 2000', + snmp_ports: { 2000 => { 'options' => 'special for 2000', 'process_number' => 3 } } } end @@ -598,7 +600,7 @@ context 'with cache_dir parameters set' do let :params do { config: '/tmp/squid.conf', - cache_dirs: { '/data' => { 'type' => 'special', + cache_dirs: { '/data' => { 'type' => 'special', 'options' => 'my options for special type' } } } end @@ -614,7 +616,7 @@ 'mail settings' => { 'order' => '22', 'config_entries' => { - 'mail_from' => 'squid@example.com', + 'mail_from' => 'squid@example.com', 'mail_program' => 'mail' } }, diff --git a/spec/defines/acl_spec.rb b/spec/defines/acl_spec.rb index e2ae5bf..64609cc 100644 --- a/spec/defines/acl_spec.rb +++ b/spec/defines/acl_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'squid::acl' do @@ -30,6 +32,7 @@ it { is_expected.to contain_concat_fragment('squid_acl_myacl').with_content(%r{^acl\s+myacl\s+urlregex\shttp://example.com/$}) } it { is_expected.to contain_concat_fragment('squid_acl_myacl').with_content(%r{^# Example company website$}) } end + context 'when type contains special characters, a :' do let(:params) do { diff --git a/spec/defines/auth_param_spec.rb b/spec/defines/auth_param_spec.rb index f0ea559..52af09b 100644 --- a/spec/defines/auth_param_spec.rb +++ b/spec/defines/auth_param_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'squid::auth_param' do @@ -30,6 +32,7 @@ it { is_expected.to contain_concat__fragment('squid_auth_param_auth').with_target('/tmp/squid.conf') } it { is_expected.to contain_concat__fragment('squid_auth_param_auth').with_order('05-07-basic') } + entries.each do |entry| it { is_expected.to contain_concat__fragment('squid_auth_param_auth').with_content(%r{auth_param basic #{entry}}) } end @@ -51,6 +54,7 @@ it { is_expected.to contain_concat__fragment('squid_auth_param_auth').with_target('/tmp/squid.conf') } it { is_expected.to contain_concat__fragment('squid_auth_param_auth').with_order('05-08-digest') } + entries.each do |entry| it { is_expected.to contain_concat__fragment('squid_auth_param_auth').with_content(%r{auth_param digest #{entry}}) } end diff --git a/spec/defines/cache_dir_spec.rb b/spec/defines/cache_dir_spec.rb index 6086c37..23c50f5 100644 --- a/spec/defines/cache_dir_spec.rb +++ b/spec/defines/cache_dir_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'squid::cache_dir' do @@ -30,6 +32,7 @@ it { is_expected.to contain_concat_fragment('squid_cache_dir_/data').with_content(%r{^endif$}) } it { is_expected.to contain_concat_fragment('squid_cache_dir_/data').with_content(%r{^if \${process_number} = 2$}) } it { is_expected.to contain_file('/data').with_ensure('directory') } + case facts[:operatingsystem] when 'Debian' context 'when on Debian' do @@ -68,10 +71,11 @@ it { is_expected.to contain_concat_fragment('squid_cache_dir_/data').with_target('/tmp/squid.conf') } it { is_expected.to contain_concat_fragment('squid_cache_dir_/data').with_order('50-07') } - it { is_expected.to contain_concat_fragment('squid_cache_dir_/data').with_content(%r{^cache_dir special \/data my options for special type$}) } + it { is_expected.to contain_concat_fragment('squid_cache_dir_/data').with_content(%r{^cache_dir special /data my options for special type$}) } it { is_expected.to contain_concat_fragment('squid_cache_dir_/data').without_content(%r{^endif$}) } it { is_expected.to contain_concat_fragment('squid_cache_dir_/data').without_content(%r{^if \${process_number}$}) } end + context 'when parameters are set excluding options' do let(:params) do { @@ -82,11 +86,10 @@ it { is_expected.to contain_concat_fragment('squid_cache_dir_/data').with_target('/tmp/squid.conf') } it { is_expected.to contain_concat_fragment('squid_cache_dir_/data').with_order('50-07') } - it { is_expected.to contain_concat_fragment('squid_cache_dir_/data').with_content(%r{^cache_dir special \/data$}) } + it { is_expected.to contain_concat_fragment('squid_cache_dir_/data').with_content(%r{^cache_dir special /data$}) } it { is_expected.to contain_concat_fragment('squid_cache_dir_/data').without_content(%r{^endif$}) } it { is_expected.to contain_concat_fragment('squid_cache_dir_/data').without_content(%r{^if \${process_number}$}) } end - end end end diff --git a/spec/defines/cache_spec.rb b/spec/defines/cache_spec.rb index 5b55b94..7efdae9 100644 --- a/spec/defines/cache_spec.rb +++ b/spec/defines/cache_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'squid::cache' do @@ -20,6 +22,7 @@ it { is_expected.to contain_concat_fragment('squid_cache_myrule').with_content(%r{^cache\s+allow\s+myrule$}) } it { is_expected.to contain_concat_fragment('squid_cache_myrule').with_content(%r{^# cache fragment for myrule$}) } end + context 'when parameters are set' do let(:params) do { @@ -35,6 +38,7 @@ it { is_expected.to contain_concat_fragment('squid_cache_this and that').with_content(%r{^cache\s+deny\s+this and that$}) } it { is_expected.to contain_concat_fragment('squid_cache_this and that').with_content(%r{^# Deny this and that$}) } end + context 'with unknown action' do let(:params) do { diff --git a/spec/defines/extra_config_section_spec.rb b/spec/defines/extra_config_section_spec.rb index 9cd426d..883a174 100644 --- a/spec/defines/extra_config_section_spec.rb +++ b/spec/defines/extra_config_section_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'squid::extra_config_section' do @@ -18,8 +20,8 @@ let(:params) do { config_entries: { - 'ssl_bump' => 'server-first all', - 'sslcrtd_program' => '/usr/lib64/squid/ssl_crtd -s /var/lib/ssl_db -M 4MB', + 'ssl_bump' => 'server-first all', + 'sslcrtd_program' => '/usr/lib64/squid/ssl_crtd -s /var/lib/ssl_db -M 4MB', 'sslcrtd_children' => '8 startup=1 idle=1' } } @@ -33,17 +35,19 @@ it { is_expected.to contain_concat_fragment('squid_extra_config_section_my config section').with_target('/tmp/squid.conf') } it { is_expected.to contain_concat_fragment('squid_extra_config_section_my config section').with_order('60-my config section') } + it 'config section' do content = catalogue.resource('concat_fragment', 'squid_extra_config_section_my config section').send(:parameters)[:content] expect(content).to match(expected_config_section) end end + context 'when config entry parameters are arrays' do let(:params) do { config_entries: { - 'ssl_bump' => ['server-first', 'all'], - 'sslcrtd_program' => ['/usr/lib64/squid/ssl_crtd', '-s', '/var/lib/ssl_db', '-M', '4MB'], + 'ssl_bump' => %w[server-first all], + 'sslcrtd_program' => ['/usr/lib64/squid/ssl_crtd', '-s', '/var/lib/ssl_db', '-M', '4MB'], 'sslcrtd_children' => ['8', 'startup=1', 'idle=1'] } } @@ -60,6 +64,7 @@ expect(content).to match(expected_config_section) end end + context 'when config entry parameters are arrays of hashes' do let(:params) do { diff --git a/spec/defines/http_access_spec.rb b/spec/defines/http_access_spec.rb index d544158..d4dd90e 100644 --- a/spec/defines/http_access_spec.rb +++ b/spec/defines/http_access_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'squid::http_access' do @@ -20,6 +22,7 @@ it { is_expected.to contain_concat_fragment('squid_http_access_myrule').with_content(%r{^http_access\s+allow\s+myrule$}) } it { is_expected.to contain_concat_fragment('squid_http_access_myrule').with_content(%r{^# http_access fragment for myrule$}) } end + context 'when parameters are set' do let(:params) do { @@ -35,6 +38,7 @@ it { is_expected.to contain_concat_fragment('squid_http_access_this and that').with_content(%r{^http_access\s+deny\s+this and that$}) } it { is_expected.to contain_concat_fragment('squid_http_access_this and that').with_content(%r{^# Deny this and that$}) } end + context 'with unknown action' do let(:params) do { diff --git a/spec/defines/http_port_spec.rb b/spec/defines/http_port_spec.rb index 187046c..f07d994 100644 --- a/spec/defines/http_port_spec.rb +++ b/spec/defines/http_port_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'squid::http_port' do @@ -20,36 +22,43 @@ it { is_expected.to contain_concat_fragment('squid_http_port_1000').with_order('30-05') } it { is_expected.to contain_concat_fragment('squid_http_port_1000').with_content(%r{^http_port\s+1000$}) } end + context 'with garbage title and no parameters' do let(:title) { 'garbage' } it { is_expected.not_to compile } end + context 'when host:port title is set' do let(:title) { '127.0.0.1:1500' } it { is_expected.to contain_concat_fragment('squid_http_port_127.0.0.1:1500').with_content(%r{^http_port\s+127\.0\.0\.1:1500$}) } end + context 'with invalid port (non-numeric) in host:port title' do let(:title) { 'my:test' } it { is_expected.not_to compile } end + context 'with invalid port (out of range) in host:port title' do let(:title) { 'my:100000' } it { is_expected.not_to compile } end + context 'with "host: port" invalid title' do let(:title) { 'host: 1600' } it { is_expected.not_to compile } end + context 'with ".host:port" invalid title' do let(:title) { '.host:1600' } it { is_expected.not_to compile } end + context 'with host:port title and port arg' do let(:title) { 'host:1650' } let(:params) do @@ -61,6 +70,7 @@ # Ignore the host part of the title if a port is specified it { is_expected.to contain_concat_fragment('squid_http_port_host:1650').with_content(%r{^http_port\s+1650$}) } end + context 'without a port specified' do let(:title) { 'garbage' } let(:params) do @@ -71,6 +81,7 @@ it { is_expected.not_to compile } end + context 'when host and port parameters are set' do let(:title) { 'test' } let(:params) do @@ -82,13 +93,14 @@ it { is_expected.to contain_concat_fragment('squid_http_port_test').with_content(%r{^http_port\s+127\.0\.0\.1:1700$}) } end + context 'when parameters are set' do let(:title) { 'my:test' } # Arguments shoud override title let(:params) do { - port: 2000, + port: 2000, options: 'special for 2000', - order: '08' + order: '08' } end @@ -96,17 +108,19 @@ it { is_expected.to contain_concat_fragment('squid_http_port_my:test').with_order('30-08') } it { is_expected.to contain_concat_fragment('squid_http_port_my:test').with_content(%r{^http_port\s+2000\s+special for 2000$}) } end + context 'with host overriding invalid title' do let(:title) { 'my:test' } let(:params) do { - port: 2100, - host: 'host' + port: 2100, + host: 'host' } end it { is_expected.to contain_concat_fragment('squid_http_port_my:test').with_content(%r{^http_port\s+host:2100$}) } end + context 'when ssl => true' do let(:title) { '3000' } let(:params) do diff --git a/spec/defines/https_port_spec.rb b/spec/defines/https_port_spec.rb index 116c381..ea8dc46 100644 --- a/spec/defines/https_port_spec.rb +++ b/spec/defines/https_port_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'squid::https_port' do @@ -22,9 +24,11 @@ it 'uses `squid::http_port` with `ssl` set to true' do is_expected.to contain_squid__http_port('4000').with_ssl(true) end + it 'passes options to `squid::http_port`' do is_expected.to contain_squid__http_port('4000').with_options('some options') end + it 'results in the correct concat fragment being created' do is_expected.to contain_concat_fragment('squid_https_port_4000').with_content(%r{^https_port\s+4000\ssome options\s*$}) end diff --git a/spec/defines/icp_access_spec.rb b/spec/defines/icp_access_spec.rb index b8cc41c..7bea84a 100644 --- a/spec/defines/icp_access_spec.rb +++ b/spec/defines/icp_access_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'squid::icp_access' do @@ -19,6 +21,7 @@ it { is_expected.to contain_concat_fragment('squid_icp_access_myrule').with_order('30-05-allow') } it { is_expected.to contain_concat_fragment('squid_icp_access_myrule').with_content(%r{^icp_access\s+allow\s+myrule$}) } end + context 'when parameters are set' do let(:params) do { diff --git a/spec/defines/refresh_pattern_spec.rb b/spec/defines/refresh_pattern_spec.rb index 79130c6..877be60 100644 --- a/spec/defines/refresh_pattern_spec.rb +++ b/spec/defines/refresh_pattern_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'squid::refresh_pattern' do @@ -17,9 +19,9 @@ let(:title) { 'my_pattern' } let(:params) do { - order: '06', - max: 10_080, - min: 1440, + order: '06', + max: 10_080, + min: 1440, percent: 20, comment: 'Refresh Patterns' } @@ -29,15 +31,15 @@ it { is_expected.to contain_concat_fragment(fname).with_target('/tmp/squid.conf') } it { is_expected.to contain_concat_fragment(fname).with_order('45-06') } it { is_expected.to contain_concat_fragment(fname).with_content(%r{^refresh_pattern\s+my_pattern\s+1440\s+20%\s+10080$}) } - end # context 'when parameters are set' + end context 'when parameters are set and options' do let(:title) { 'my_pattern' } let(:params) do { - order: '06', - max: 10_080, - min: 1440, + order: '06', + max: 10_080, + min: 1440, percent: 20, options: 'override-expire ignore-no-cache', comment: 'Refresh Patterns' @@ -55,11 +57,11 @@ let(:params) do { case_sensitive: false, - comment: 'Refresh Patterns', - max: 0, - min: 0, - order: '07', - percent: 0 + comment: 'Refresh Patterns', + max: 0, + min: 0, + order: '07', + percent: 0 } end @@ -67,7 +69,7 @@ it { is_expected.to contain_concat_fragment(fname).with_target('/tmp/squid.conf') } it { is_expected.to contain_concat_fragment(fname).with_order('45-07') } it { is_expected.to contain_concat_fragment(fname).with_content(%r{^refresh_pattern\s+-i\s+case_insensitive\s+0\s+0%\s+0$}) } - end # context 'when parameters are set and case insensitive' + end end end end diff --git a/spec/defines/send_hit_spec.rb b/spec/defines/send_hit_spec.rb index ceae579..66ee0e5 100644 --- a/spec/defines/send_hit_spec.rb +++ b/spec/defines/send_hit_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'squid::send_hit' do @@ -20,6 +22,7 @@ it { is_expected.to contain_concat_fragment('squid_send_hit_myrule').with_content(%r{^send_hit\s+allow\s+myrule$}) } it { is_expected.to contain_concat_fragment('squid_send_hit_myrule').with_content(%r{^# send_hit fragment for myrule$}) } end + context 'when parameters are set' do let(:params) do { @@ -35,6 +38,7 @@ it { is_expected.to contain_concat_fragment('squid_send_hit_this and that').with_content(%r{^send_hit\s+deny\s+this and that$}) } it { is_expected.to contain_concat_fragment('squid_send_hit_this and that').with_content(%r{^# send_hit this and that$}) } end + context 'with unknown action' do let(:params) do { diff --git a/spec/defines/snmp_access_spec.rb b/spec/defines/snmp_access_spec.rb index 5e5caaf..05435f0 100644 --- a/spec/defines/snmp_access_spec.rb +++ b/spec/defines/snmp_access_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'squid::snmp_access' do @@ -20,6 +22,7 @@ it { is_expected.to contain_concat_fragment('squid_snmp_access_myrule').with_content(%r{^snmp_access\s+allow\s+myrule$}) } it { is_expected.to contain_concat_fragment('squid_snmp_access_myrule').with_content(%r{^# snmp_access fragment for myrule$}) } end + context 'when parameters are set' do let(:params) do { @@ -35,6 +38,7 @@ it { is_expected.to contain_concat_fragment('squid_snmp_access_this and that').with_content(%r{^snmp_access\s+deny\s+this and that$}) } it { is_expected.to contain_concat_fragment('squid_snmp_access_this and that').with_content(%r{^# Deny this and that$}) } end + context 'with unknown action' do let(:params) do { diff --git a/spec/defines/snmp_port_spec.rb b/spec/defines/snmp_port_spec.rb index 7a2d771..618416b 100644 --- a/spec/defines/snmp_port_spec.rb +++ b/spec/defines/snmp_port_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'squid::snmp_port' do @@ -21,6 +23,7 @@ it { is_expected.to contain_concat_fragment('squid_snmp_port_1000').without_content(%r{^endif$}) } it { is_expected.to contain_concat_fragment('squid_snmp_port_1000').without_content(%r{^if \${process_number}$}) } end + context 'when parameters are set' do let(:params) do { diff --git a/spec/defines/ssl_bump_spec.rb b/spec/defines/ssl_bump_spec.rb index 98a7eee..72d552e 100644 --- a/spec/defines/ssl_bump_spec.rb +++ b/spec/defines/ssl_bump_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'squid::ssl_bump' do @@ -19,6 +21,7 @@ it { is_expected.to contain_concat_fragment('squid_ssl_bump_bump_myrule').with_order('25-05-bump') } it { is_expected.to contain_concat_fragment('squid_ssl_bump_bump_myrule').with_content(%r{^ssl_bump\s+bump\s+myrule$}) } end + context 'when parameters are set' do let(:params) do { @@ -32,6 +35,7 @@ it { is_expected.to contain_concat_fragment('squid_ssl_bump_peek_step1').with_order('25-08-peek') } it { is_expected.to contain_concat_fragment('squid_ssl_bump_peek_step1').with_content(%r{^ssl_bump\s+peek\s+step1$}) } end + context 'with unknown action' do let(:params) do { diff --git a/spec/defines/sslproxy_cert_error_spec.rb b/spec/defines/sslproxy_cert_error_spec.rb index de10b9d..5edf0a9 100644 --- a/spec/defines/sslproxy_cert_error_spec.rb +++ b/spec/defines/sslproxy_cert_error_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'squid::sslproxy_cert_error' do @@ -19,6 +21,7 @@ it { is_expected.to contain_concat_fragment('squid_sslproxy_cert_error_allow_myrule').with_order('35-05-allow') } it { is_expected.to contain_concat_fragment('squid_sslproxy_cert_error_allow_myrule').with_content(%r{^sslproxy_cert_error\s+allow\s+myrule$}) } end + context 'when parameters are set' do let(:params) do { @@ -32,6 +35,7 @@ it { is_expected.to contain_concat_fragment('squid_sslproxy_cert_error_deny_this and that').with_order('35-08-deny') } it { is_expected.to contain_concat_fragment('squid_sslproxy_cert_error_deny_this and that').with_content(%r{^sslproxy_cert_error\s+deny\s+this and that$}) } end + context 'with unknown action' do let(:params) do { diff --git a/spec/type_aliases/squid_size_spec.rb b/spec/type_aliases/squid_size_spec.rb index e09c890..e572146 100644 --- a/spec/type_aliases/squid_size_spec.rb +++ b/spec/type_aliases/squid_size_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Squid::Size' do From c2ab9a3bd10c2beae36e5a36b07c13f7ff646b2f Mon Sep 17 00:00:00 2001 From: Steve Traylen Date: Tue, 22 Mar 2022 14:53:29 +0100 Subject: [PATCH 4/7] Disable rubocop RSpec/MultipleMemoizedHelpers Disable RSpec/MultipleMemoizedHelpers with rubocop:todo as I am unsure what to do. --- spec/classes/init_spec.rb | 72 +++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 14f3fe1..a97cd5c 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -49,7 +49,7 @@ it { is_expected.to contain_concat_fragment('squid_header').without_content(%r{^err_page_stylesheet}) } end - context 'with all parameters set' do + context 'with all parameters set' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', @@ -86,7 +86,7 @@ it { is_expected.to contain_concat_fragment('squid_header').with_content(%r{^url_rewrite_children\s+16\stestoption=a$}) } end - context 'with access_log parameter set to an array' do + context 'with access_log parameter set to an array' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', @@ -98,7 +98,7 @@ it { is_expected.to contain_concat_fragment('squid_header').with_content(%r{^access_log\s+syslog:daemon.info\s+squid$}) } end - context 'with buffered_logs parameter set to true' do + context 'with buffered_logs parameter set to true' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', @@ -109,7 +109,7 @@ it { is_expected.to contain_concat_fragment('squid_header').with_content(%r{^buffered_logs\s+on$}) } end - context 'with buffered_logs parameter set to false' do + context 'with buffered_logs parameter set to false' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', @@ -120,7 +120,7 @@ it { is_expected.to contain_concat_fragment('squid_header').with_content(%r{^buffered_logs\s+off$}) } end - context 'with memory_cache_shared parameter set to true' do + context 'with memory_cache_shared parameter set to true' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', @@ -131,7 +131,7 @@ it { is_expected.to contain_concat_fragment('squid_header').with_content(%r{^memory_cache_shared\s+on$}) } end - context 'with error_directory parameter set to /some/path/file' do + context 'with error_directory parameter set to /some/path/file' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', @@ -142,7 +142,7 @@ it { is_expected.to contain_concat_fragment('squid_header').with_content(%r{^error_directory\s+/some/path/file$}) } end - context 'with err_page_stylesheet parameter set to /some/path/file' do + context 'with err_page_stylesheet parameter set to /some/path/file' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', @@ -153,7 +153,7 @@ it { is_expected.to contain_concat_fragment('squid_header').with_content(%r{^err_page_stylesheet\s+/some/path/file$}) } end - context 'with memory_cache_shared parameter set to on' do + context 'with memory_cache_shared parameter set to on' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', @@ -164,7 +164,7 @@ it { is_expected.to contain_concat_fragment('squid_header').with_content(%r{^memory_cache_shared\s+on$}) } end - context 'with memory_cache_shared parameter set to false' do + context 'with memory_cache_shared parameter set to false' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', @@ -175,7 +175,7 @@ it { is_expected.to contain_concat_fragment('squid_header').with_content(%r{^memory_cache_shared\s+off$}) } end - context 'with memory_cache_shared parameter set to off' do + context 'with memory_cache_shared parameter set to off' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', @@ -186,7 +186,7 @@ it { is_expected.to contain_concat_fragment('squid_header').with_content(%r{^memory_cache_shared\s+off$}) } end - context 'with forwarded_for parameter set to off' do + context 'with forwarded_for parameter set to off' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', @@ -197,7 +197,7 @@ it { is_expected.to contain_concat_fragment('squid_header').with_content(%r{^forwarded_for\s+off$}) } end - context 'with forwarded_for parameter set to on' do + context 'with forwarded_for parameter set to on' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', @@ -208,7 +208,7 @@ it { is_expected.to contain_concat_fragment('squid_header').with_content(%r{^forwarded_for\s+on$}) } end - context 'with forwarded_for parameter set to delete' do + context 'with forwarded_for parameter set to delete' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', @@ -219,7 +219,7 @@ it { is_expected.to contain_concat_fragment('squid_header').with_content(%r{^forwarded_for\s+delete$}) } end - context 'with forwarded_for parameter set to transparent' do + context 'with forwarded_for parameter set to transparent' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', @@ -230,7 +230,7 @@ it { is_expected.to contain_concat_fragment('squid_header').with_content(%r{^forwarded_for\s+transparent$}) } end - context 'with cache_replacement_policy parameter set to LRU' do + context 'with cache_replacement_policy parameter set to LRU' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', @@ -241,7 +241,7 @@ it { is_expected.to contain_concat_fragment('squid_header').with_content(%r{^cache_replacement_policy\s+LRU$}) } end - context 'with memory_replacement_policy parameter set to LRU' do + context 'with memory_replacement_policy parameter set to LRU' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', @@ -252,7 +252,7 @@ it { is_expected.to contain_concat_fragment('squid_header').with_content(%r{^memory_replacement_policy\s+LRU$}) } end - context 'with one acl parameter set' do + context 'with one acl parameter set' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', @@ -272,7 +272,7 @@ it { is_expected.to contain_concat_fragment('squid_acl_myacl').with_content(%r{^# acl fragment for myacl$}) } end - context 'with two acl parameters set' do + context 'with two acl parameters set' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', @@ -300,7 +300,7 @@ it { is_expected.to contain_concat_fragment('squid_acl_mysecondacl').with_content(%r{^acl\s+mysecondacl\s+urlregex\shttp://example2.com/$}) } end - context 'with one http_access parameter set' do + context 'with one http_access parameter set' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', @@ -320,7 +320,7 @@ it { is_expected.to contain_concat_fragment('squid_http_access_this and that').with_content(%r{^http_access\s+deny\s+this and that$}) } end - context 'with one send_hit parameter set' do + context 'with one send_hit parameter set' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', @@ -340,7 +340,7 @@ it { is_expected.to contain_concat_fragment('squid_send_hit_this and that').with_content(%r{^send_hit\s+deny\s+this and that$}) } end - context 'with two http_access parameters set' do + context 'with two http_access parameters set' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', @@ -372,7 +372,7 @@ it { is_expected.to contain_concat_fragment('squid_http_access_this too').with_content(%r{^# Deny this and too$}) } end - context 'with two snmp_access parameters set' do + context 'with two snmp_access parameters set' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', @@ -404,7 +404,7 @@ it { is_expected.to contain_concat_fragment('squid_snmp_access_this too').with_content(%r{^# Deny this and too$}) } end - context 'with one ssl_bump parameter set' do + context 'with one ssl_bump parameter set' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', @@ -424,7 +424,7 @@ it { is_expected.to contain_concat_fragment('squid_ssl_bump_bump_step1').with_content(%r{^ssl_bump\s+bump\s+step1$}) } end - context 'with one sslproxy_cert_error parameter set' do + context 'with one sslproxy_cert_error parameter set' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', @@ -444,7 +444,7 @@ it { is_expected.to contain_concat_fragment('squid_sslproxy_cert_error_allow_all').with_content(%r{^sslproxy_cert_error\s+allow\s+all$}) } end - context 'with one icp_access parameter set' do + context 'with one icp_access parameter set' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', @@ -464,7 +464,7 @@ it { is_expected.to contain_concat_fragment('squid_icp_access_this and that').with_content(%r{^icp_access\s+deny\s+this and that$}) } end - context 'with two icp_access parameters set' do + context 'with two icp_access parameters set' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', @@ -493,7 +493,7 @@ it { is_expected.to contain_concat_fragment('squid_icp_access_this too').with_content(%r{^icp_access\s+deny\s+this too$}) } end - context 'with http_port parameters set' do + context 'with http_port parameters set' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', http_ports: { 2000 => { 'options' => 'special for 2000' } } } @@ -504,7 +504,7 @@ it { is_expected.to contain_concat_fragment('squid_http_port_2000').with_content(%r{^http_port\s+2000\s+special for 2000$}) } end - context 'with https_port parameters set' do + context 'with https_port parameters set' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', https_ports: { 2001 => { 'options' => 'special for 2001' } } } @@ -516,7 +516,7 @@ end if facts[:osfamily] == 'RedHat' - context 'with http_port parameters set + SELINUX' do + context 'with http_port parameters set + SELINUX' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', http_ports: { 2000 => { 'options' => 'special for 2000' } } } @@ -529,7 +529,7 @@ it { is_expected.to contain_selinux__port('selinux port squid_port_t 2000').with('ensure' => 'present', 'seltype' => 'squid_port_t', 'protocol' => 'tcp', 'port' => '2000') } end - context 'with https_port parameters set' do + context 'with https_port parameters set' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', https_ports: { 2001 => { 'options' => 'special for 2001' } } } @@ -542,7 +542,7 @@ it { is_expected.to contain_selinux__port('selinux port squid_port_t 2001').with('ensure' => 'present', 'seltype' => 'squid_port_t', 'protocol' => 'tcp', 'port' => '2001') } end - context 'with duplicate ports on different ip' do + context 'with duplicate ports on different ip' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', http_ports: { 'ipA' => { 'port' => 3128, 'host' => '192.168.1.10' }, 'ipB' => { 'port' => 3128, 'host' => '192.168.1.11' } } } @@ -558,7 +558,7 @@ it { is_expected.to contain_selinux__port('selinux port squid_port_t 3128').with('ensure' => 'present', 'seltype' => 'squid_port_t', 'protocol' => 'tcp', 'port' => '3128') } end - context 'with cache_dir parameters set + SELINUX' do + context 'with cache_dir parameters set + SELINUX' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', cache_dirs: { '/data' => { 'type' => 'special', @@ -573,7 +573,7 @@ end end - context 'with snmp_incoming_address parameter set' do + context 'with snmp_incoming_address parameter set' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', @@ -584,7 +584,7 @@ it { is_expected.to contain_concat_fragment('squid_header').with_content(%r{^snmp_incoming_address\s+4\.2\.2\.2$}) } end - context 'with snmp_port parameters set' do + context 'with snmp_port parameters set' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', snmp_ports: { 2000 => { 'options' => 'special for 2000', @@ -597,7 +597,7 @@ it { is_expected.to contain_concat_fragment('squid_snmp_port_2000').with_content(%r{^endif$}) } end - context 'with cache_dir parameters set' do + context 'with cache_dir parameters set' do # rubocop:todo RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', cache_dirs: { '/data' => { 'type' => 'special', @@ -608,7 +608,7 @@ it { is_expected.to contain_file('/data').with_ensure('directory') } end - context 'with extra_config_sections parameter set' do + context 'with extra_config_sections parameter set' do # rubocop:disable RSpec/MultipleMemoizedHelpers let :params do { config: '/tmp/squid.conf', From ca89e115b46d7a3f015e0adaa1c86b980bf4160b Mon Sep 17 00:00:00 2001 From: Steve Traylen Date: Tue, 22 Mar 2022 15:10:23 +0100 Subject: [PATCH 5/7] Add doc strings to sslbump type --- types/action/sslbump.pp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/action/sslbump.pp b/types/action/sslbump.pp index f199dc2..816321c 100644 --- a/types/action/sslbump.pp +++ b/types/action/sslbump.pp @@ -1,3 +1,5 @@ +# @summary Possible SSLBump options +# type Squid::Action::SslBump = Enum[ 'bump', 'client-first', From 8dcf10d01fc0354a0bbd8732fbdc19709debf15d Mon Sep 17 00:00:00 2001 From: Steve Traylen Date: Tue, 22 Mar 2022 15:11:12 +0100 Subject: [PATCH 6/7] Create first REFERENCE file --- REFERENCE.md | 1650 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1650 insertions(+) create mode 100644 REFERENCE.md diff --git a/REFERENCE.md b/REFERENCE.md new file mode 100644 index 0000000..ab82124 --- /dev/null +++ b/REFERENCE.md @@ -0,0 +1,1650 @@ +# Reference + + + +## Table of Contents + +### Classes + +#### Public Classes + +* [`squid`](#squid): Module for configuring the squid caching service. +The module will set the SELINUX-context for the cache_dir and port, needs puppet-selinux + +#### Private Classes + +* `squid::config`: Configure the system to use squid +config is included in the main class `squid` +for parameters see `squid` class +* `squid::install`: Installs the squid package +* `squid::params`: This class manages Squid parameters +* `squid::service`: Manages the Squid daemon + +### Defined types + +* [`squid::acl`](#squidacl): Defines acl entries for a squid server. +* [`squid::auth_param`](#squidauth_param): Defines auth_param entries for a squid server. +* [`squid::cache`](#squidcache): Defines cache entries for a squid server. +* [`squid::cache_dir`](#squidcache_dir): Defines cache_dir entries for a squid server. +* [`squid::extra_config_section`](#squidextra_config_section): The `extra_config_section` defiend type can be used for configuration directives that have not been exposed individually in this module. +* [`squid::http_access`](#squidhttp_access): Defines http_access entries for a squid server. +* [`squid::http_port`](#squidhttp_port): Defines http_port entries for a squid server. +By setting optional `ssl` parameter to `true` will create https_port entries instead. +* [`squid::https_port`](#squidhttps_port): Defines https_port entries for a squid server. Results are the same with http_port and ssl set to `true`. +* [`squid::icp_access`](#squidicp_access): Defines icp_access entries for a squid server. +* [`squid::refresh_pattern`](#squidrefresh_pattern): Defines refresh_pattern entries for a squid server. +* [`squid::send_hit`](#squidsend_hit): Defines send_hit for a squid server. +* [`squid::snmp_access`](#squidsnmp_access): Defines snmp_access entries for a squid server. +* [`squid::snmp_port`](#squidsnmp_port): Defines snmp_port entries for a squid server. +* [`squid::ssl_bump`](#squidssl_bump): Defines ssl_bump entries for a squid server. +* [`squid::sslproxy_cert_error`](#squidsslproxy_cert_error): Defines sslproxy_cert_error entries for a squid server. + +### Data types + +* [`Squid::Action::SslBump`](#squidactionsslbump): Possible SSLBump options +* [`Squid::PkgEnsure`](#squidpkgensure): Custom type representing package status and/or version +* [`Squid::Size`](#squidsize): Custom type containing the numeral value and the unit of messurement (Kilo- or Megabyte) + +## Classes + +### `squid` + +Module for configuring the squid caching service. +The module will set the SELINUX-context for the cache_dir and port, needs puppet-selinux + +#### Examples + +##### The set up a simple squid server with a cache to forward http port 80 requests. + +```puppet +class { 'squid': } +squid::acl { 'Safe_ports': + type => port, + entries => ['80'], +} +squid::http_access { 'Safe_ports': + action => allow, +} +squid::http_access{ '!Safe_ports': + action => deny, +} +``` + +##### + +```puppet +class { 'squid': + cache_mem => '512 MB', + workers => 3, + coredump_dir => '/var/spool/squid', +} +``` + +##### + +```puppet +class { 'squid': + cache_mem => '512 MB', + workers => 3, + coredump_dir => '/var/spool/squid', + acls => { 'remote_urls' => { + type => 'url_regex', + entries => ['http://example.org/path', + 'http://example.com/anotherpath'], + }, + }, + http_access => { 'our_networks hosts' => { action => 'allow', }}, + http_ports => { '10000' => { options => 'accel vhost', }}, + snmp_ports => { '1000' => { process_number => 3, }}, + cache_dirs => { '/data/' => { type => 'ufs', options => '15000 32 256 min-size=32769', process_number => 2 }}, + url_rewrite_program => '/usr/bin/squidguard -c /etc/squidguard/squidguard.conf', + url_rewrite_children => 12, + url_rewrite_child_options => startup=1, +} +``` + +#### Parameters + +The following parameters are available in the `squid` class: + +* [`ensure_service`](#ensure_service) +* [`enable_service`](#enable_service) +* [`config`](#config) +* [`config_user`](#config_user) +* [`config_group`](#config_group) +* [`daemon_user`](#daemon_user) +* [`daemon_group`](#daemon_group) +* [`cache_mem`](#cache_mem) +* [`cache_replacement_policy`](#cache_replacement_policy) +* [`memory_replacement_policy`](#memory_replacement_policy) +* [`memory_cache_shared`](#memory_cache_shared) +* [`maximum_object_size_in_memory`](#maximum_object_size_in_memory) +* [`url_rewrite_program`](#url_rewrite_program) +* [`url_rewrite_children`](#url_rewrite_children) +* [`url_rewrite_child_options`](#url_rewrite_child_options) +* [`access_log`](#access_log) +* [`coredump_dir`](#coredump_dir) +* [`error_directory`](#error_directory) +* [`err_page_stylesheet`](#err_page_stylesheet) +* [`package_name`](#package_name) +* [`package_ensure`](#package_ensure) +* [`service_name`](#service_name) +* [`max_filedescriptors`](#max_filedescriptors) +* [`workers`](#workers) +* [`snmp_incoming_address`](#snmp_incoming_address) +* [`buffered_logs`](#buffered_logs) +* [`acls`](#acls) +* [`visible_hostname`](#visible_hostname) +* [`via`](#via) +* [`httpd_suppress_version_string`](#httpd_suppress_version_string) +* [`forwarded_for`](#forwarded_for) +* [`http_access`](#http_access) +* [`http_ports`](#http_ports) +* [`https_ports`](#https_ports) +* [`icp_access`](#icp_access) +* [`refresh_patterns`](#refresh_patterns) +* [`snmp_ports`](#snmp_ports) +* [`send_hit`](#send_hit) +* [`cache_dirs`](#cache_dirs) +* [`ssl_bump`](#ssl_bump) +* [`sslproxy_cert_error`](#sslproxy_cert_error) +* [`extra_config_sections`](#extra_config_sections) +* [`service_restart`](#service_restart) +* [`squid_bin_path`](#squid_bin_path) +* [`auth_params`](#auth_params) +* [`cache`](#cache) +* [`snmp_access`](#snmp_access) +* [`logformat`](#logformat) + +##### `ensure_service` + +Data type: `String` + +The ensure value of the squid service, defaults to `running`. + +Default value: `$squid::params::ensure_service` + +##### `enable_service` + +Data type: `Boolean` + +The enable value of the squid service, defaults to `true`. + +Default value: `$squid::params::enable_service` + +##### `config` + +Data type: `String` + +Location of squid.conf file, defaults to `/etc/squid/squid.conf`. + +Default value: `$squid::params::config` + +##### `config_user` + +Data type: `String` + +User which owns the config file, default depends on `$operatingsystem` + +Default value: `$squid::params::config_user` + +##### `config_group` + +Data type: `String` + +Group which owns the config file, default depends on `$operatingsystem` + +Default value: `$squid::params::config_group` + +##### `daemon_user` + +Data type: `String` + +User which runs the squid daemon, this is used for ownership of the cache directory, default depends on `$operatingsystem` + +Default value: `$squid::params::daemon_user` + +##### `daemon_group` + +Data type: `String` + +Group which runs the squid daemon, this is used for ownership of the cache directory, default depends on `$operatingsystem` + +Default value: `$squid::params::daemon_group` + +##### `cache_mem` + +Data type: `Squid::Size` + +Defaults to `256 MB`. http://www.squid-cache.org/Doc/config/cache_mem/ + +Default value: `$squid::params::cache_mem` + +##### `cache_replacement_policy` + +Data type: `Optional[String]` + +Defaults to undef. http://www.squid-cache.org/Doc/config/cache_replacement_policy/ + +Default value: `$squid::params::cache_replacement_policy` + +##### `memory_replacement_policy` + +Data type: `Optional[String]` + +Defaults to undef. http://www.squid-cache.org/Doc/config/memory_replacement_policy/ + +Default value: `$squid::params::memory_replacement_policy` + +##### `memory_cache_shared` + +Data type: `Optional[Variant[Enum['on', 'off'], Boolean]]` + +Defaults to undef. http://www.squid-cache.org/Doc/config/memory_cache_shared/. + +Default value: `$squid::params::memory_cache_shared` + +##### `maximum_object_size_in_memory` + +Data type: `Squid::Size` + +Defaults to `512 KB`. http://www.squid-cache.org/Doc/config/maximum_object_size_in_memory/ + +Default value: `$squid::params::maximum_object_size_in_memory` + +##### `url_rewrite_program` + +Data type: `Optional[String]` + +Defaults to undef http://www.squid-cache.org/Doc/config/url_rewrite_program/ + +Default value: `$squid::params::url_rewrite_program` + +##### `url_rewrite_children` + +Data type: `Optional[Integer]` + +Defaults to undef http://www.squid-cache.org/Doc/config/url_rewrite_children/ + +Default value: `$squid::params::url_rewrite_children` + +##### `url_rewrite_child_options` + +Data type: `Optional[String]` + +Defaults to undef http://www.squid-cache.org/Doc/config/url_rewrite_children/ + +Default value: `$squid::params::url_rewrite_child_options` + +##### `access_log` + +Data type: `Variant[String, Array[String]]` + +Defaults to `daemon:/var/logs/squid/access.log squid`. May be passed an Array. http://www.squid-cache.org/Doc/config/access_log/ + +Default value: `$squid::params::access_log` + +##### `coredump_dir` + +Data type: `Optional[String]` + +Defaults to undef. http://www.squid-cache.org/Doc/config/coredump_dir/ + +Default value: `$squid::params::coredump_dir` + +##### `error_directory` + +Data type: `Optional[Stdlib::Absolutepath]` + +Defaults to undef. http://www.squid-cache.org/Doc/config/error_directory/ + +Default value: `$squid::params::error_directory` + +##### `err_page_stylesheet` + +Data type: `Optional[Stdlib::Absolutepath]` + +Defaults to undef. http://www.squid-cache.org/Doc/config/err_page_stylesheet/ + +Default value: `$squid::params::err_page_stylesheet` + +##### `package_name` + +Data type: `String` + +Name of the squid package to manage, default depends on `$operatingsystem` + +Default value: `$squid::params::package_name` + +##### `package_ensure` + +Data type: `Squid::PkgEnsure` + +Package status and/or version, default to present + +Default value: `$squid::params::package_ensure` + +##### `service_name` + +Data type: `String` + +Name of the squid service to manage, default depends on `$operatingsystem` + +Default value: `$squid::params::service_name` + +##### `max_filedescriptors` + +Data type: `Optional[Integer]` + +Defaults to undef. http://www.squid-cache.org/Doc/config/max_filedescriptors/ + +Default value: `$squid::params::max_filedescriptors` + +##### `workers` + +Data type: `Optional[Integer]` + +Defaults to undef. http://www.squid-cache.org/Doc/config/workers/ + +Default value: `$squid::params::workers` + +##### `snmp_incoming_address` + +Data type: `Optional[Stdlib::Compat::Ip_address]` + +Defaults to undef. Can be set to an IP address to only listen for snmp requests on an individual interface. http://www.squid-cache.org/Doc/config/snmp_incoming_address/ + +Default value: `$squid::params::snmp_incoming_address` + +##### `buffered_logs` + +Data type: `Optional[Boolean]` + +Defaults to undef. http://www.squid-cache.org/Doc/config/buffered_logs/ + +Default value: `$squid::params::buffered_logs` + +##### `acls` + +Data type: `Optional[Hash]` + +Defaults to undef. If you pass in a hash of acl entries, they will be defined automatically. http://www.squid-cache.org/Doc/config/acl/ + +Default value: `$squid::params::acls` + +##### `visible_hostname` + +Data type: `Optional[String]` + +Defaults to undef. http://www.squid-cache.org/Doc/config/visible_hostname/ + +Default value: `$squid::params::visible_hostname` + +##### `via` + +Data type: `Optional[Boolean]` + +Defaults to undef. http://www.squid-cache.org/Doc/config/via/ + +Default value: `$squid::params::via` + +##### `httpd_suppress_version_string` + +Data type: `Optional[Boolean]` + +Defaults to undef. http://www.squid-cache.org/Doc/config/httpd_suppress_version_string/ + +Default value: `$squid::params::httpd_suppress_version_string` + +##### `forwarded_for` + +Data type: `Optional[Variant[Enum['on', 'off', 'transparent', 'delete', 'truncate'], Boolean]]` + +Defaults to undef. supported values are "on", "off", "transparent", "delete", "truncate". http://www.squid-cache.org/Doc/config/forwarded_for/ + +Default value: `$squid::params::forwarded_for` + +##### `http_access` + +Data type: `Optional[Hash]` + +Defaults to undef. If you pass in a hash of http_access entries, they will be defined automatically. http://www.squid-cache.org/Doc/config/http_access/ + +Default value: `$squid::params::http_access` + +##### `http_ports` + +Data type: `Optional[Hash]` + +Defaults to undef. If you pass in a hash of http_port entries, they will be defined automatically. http://www.squid-cache.org/Doc/config/http_port/ + +Default value: `$squid::params::http_ports` + +##### `https_ports` + +Data type: `Optional[Hash]` + +Defaults to undef. If you pass in a hash of https_port entries, they will be defined automatically. http://www.squid-cache.org/Doc/config/https_port/ + +Default value: `$squid::params::https_ports` + +##### `icp_access` + +Data type: `Optional[Hash]` + +Defaults to undef. If you pass in a hash of icp_access entries, they will be defined automatically. http://www.squid-cache.org/Doc/config/icp_access/ + +Default value: `$squid::params::icp_access` + +##### `refresh_patterns` + +Data type: `Optional[Hash]` + +Defaults to undef. If you pass a hash of refresh_pattern entires, they will be defined automatically. http://www.squid-cache.org/Doc/config/refresh_pattern/ + +Default value: `$squid::params::refresh_patterns` + +##### `snmp_ports` + +Data type: `Optional[Hash]` + +Defaults to undef. If you pass in a hash of snmp_port entries, they will be defined automatically. http://www.squid-cache.org/Doc/config/snmp_port/ + +Default value: `$squid::params::snmp_ports` + +##### `send_hit` + +Data type: `Optional[Hash]` + +Defaults to undef. If you pass in a hash of send_hit entries, they will be defined automatically. http://www.squid-cache.org/Doc/config/send_hit/ + +Default value: `$squid::params::send_hit` + +##### `cache_dirs` + +Data type: `Optional[Hash]` + +Defaults to undef. If you pass in a hash of cache_dir entries, they will be defined automatically. http://www.squid-cache.org/Doc/config/cache_dir/ + +Default value: `$squid::params::cache_dirs` + +##### `ssl_bump` + +Data type: `Optional[Hash]` + +Defaults to undef. If you pass in a hash of ssl_bump entries, they will be defined automatically. http://www.squid-cache.org/Doc/config/ssl_bump/ + +Default value: `$squid::params::ssl_bump` + +##### `sslproxy_cert_error` + +Data type: `Optional[Hash]` + +Defaults to undef. If you pass in a hash of sslproxy_cert_error entries, they will be defined automatically. http://www.squid-cache.org/Doc/config/sslproxy_cert_error/ + +Default value: `$squid::params::sslproxy_cert_error` + +##### `extra_config_sections` + +Data type: `Hash` + +Defaults to empty hash. If you pass in a hash of `extra_config_section` resources, they will be defined automatically. + +Default value: `{}` + +##### `service_restart` + +Data type: `Optional[String]` + +Defaults to undef. Overrides service resource restart command to be executed. +It can be used to perform a soft reload of the squid service. + +Default value: `$squid::params::service_restart` + +##### `squid_bin_path` + +Data type: `Stdlib::Absolutepath` + +Path to the squid binary, default depends on `$operatingsystem` + +Default value: `$squid::params::squid_bin_path` + +##### `auth_params` + +Data type: `Optional[Hash]` + + + +Default value: `$squid::params::auth_params` + +##### `cache` + +Data type: `Optional[Hash]` + + + +Default value: `$squid::params::cache` + +##### `snmp_access` + +Data type: `Optional[Hash]` + + + +Default value: `$squid::params::snmp_access` + +##### `logformat` + +Data type: `Optional[String]` + + + +Default value: `$squid::params::logformat` + +## Defined types + +### `squid::acl` + +Defines acl entries for a squid server. + +* **See also** + * http://www.squid-cache.org/Doc/config/acl/ + +#### Examples + +##### create an ACL 'remote_urls' containing two entries + +```puppet +squid::acl { 'remote_urls': + type => 'url_regex', + entries => ['http://example.org/path', + 'http://example.com/anotherpath'], +} +``` + +#### Parameters + +The following parameters are available in the `squid::acl` defined type: + +* [`type`](#type) +* [`aclname`](#aclname) +* [`entries`](#entries) +* [`order`](#order) +* [`comment`](#comment) + +##### `type` + +Data type: `String` + +The acltype of the acl, must be defined, e.g url_regex, urlpath_regex, port, .. + +##### `aclname` + +Data type: `String` + +The name of acl, defaults to the `title`. + +Default value: `$title` + +##### `entries` + +Data type: `Array` + +An array of acl entries, multiple members results in multiple lines in squid.conf. + +Default value: `[]` + +##### `order` + +Data type: `String` + +Each ACL has an order `05` by default this can be specified if order of ACL definition matters. + +Default value: `'05'` + +##### `comment` + +Data type: `String` + + + +Default value: `"acl fragment for ${aclname}"` + +### `squid::auth_param` + +Defines auth_param entries for a squid server. + +* **See also** + * http://www.squid-cache.org/Doc/config/auth_param/ + +#### Examples + +##### + +```puppet +squid::auth_param { 'basic auth_param': + scheme => 'basic', + entries => [ + 'program /usr/lib64/squid/basic_ncsa_auth /etc/squid/.htpasswd', + 'children 5', + 'realm Squid Basic Authentication', + 'credentialsttl 5 hours', + ], +} +would result in multi entry squid auth_param: +auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/.htpasswd +auth_param basic children 5 +auth_param basic realm Squid Basic Authentication +auth_param basic credentialsttl 5 hours +``` + +#### Parameters + +The following parameters are available in the `squid::auth_param` defined type: + +* [`scheme`](#scheme) +* [`entries`](#entries) +* [`order`](#order) +* [`auth_param_name`](#auth_param_name) + +##### `scheme` + +Data type: `Enum['basic', 'digest', 'negotiate', 'ntlm']` + +The scheme used for authentication must be defined. Valid values are 'basic', 'digest', 'negotiate' and 'ntlm'. + +##### `entries` + +Data type: `Array` + +An array of entries, multiple members results in multiple lines in squid.conf + +##### `order` + +Data type: `String` + +Order can be used to configure where in `squid.conf`this configuration section should occur. + +Default value: `'40'` + +##### `auth_param_name` + +Data type: `String` + + + +Default value: `$title` + +### `squid::cache` + +Defines cache entries for a squid server. + +* **See also** + * http://www.squid-cache.org/Doc/config/cache/ + +#### Examples + +##### + +```puppet +squid::cache { 'our_network_hosts_acl': + action => 'deny', + comment => 'Our networks hosts are denied for caching', +} + +Adds a squid.conf line: +#Our networks hosts denied for caching +cache deny our_network_hosts_acl +``` + +#### Parameters + +The following parameters are available in the `squid::cache` defined type: + +* [`action`](#action) +* [`comment`](#comment) +* [`order`](#order) +* [`value`](#value) + +##### `action` + +Data type: `Enum['allow', 'deny']` + +Allow/deny caching for $title + +Default value: `'allow'` + +##### `comment` + +Data type: `String` + +Cache entry's preceding comment + +Default value: `"cache fragment for ${value}"` + +##### `order` + +Data type: `String` + +Order can be used to configure where in `squid.conf`this configuration section should occur. + +Default value: `'05'` + +##### `value` + +Data type: `String` + + + +Default value: `$title` + +### `squid::cache_dir` + +Defines cache_dir entries for a squid server. + +* **See also** + * http://www.squid-cache.org/Doc/config/cache_dir/ + +#### Examples + +##### + +```puppet +squid::cache_dir { '/data': + type => 'ufs', + options => '15000 32 256 min-size=32769', + process_number => 2, +} +Results in the squid configuration of + +if ${processor} = 2 +cache_dir ufs 15000 32 256 min-size=32769 +endif +``` + +#### Parameters + +The following parameters are available in the `squid::cache_dir` defined type: + +* [`type`](#type) +* [`path`](#path) +* [`options`](#options) +* [`process_number`](#process_number) +* [`manage_dir`](#manage_dir) +* [`order`](#order) + +##### `type` + +Data type: `String` + +The type of cache, e.g ufs. defaults to `ufs`. + +Default value: `ufs` + +##### `path` + +Data type: `String` + +Defaults to the namevar, file path to cache. + +Default value: `$title` + +##### `options` + +Data type: `Optional[String[1]]` + +String of options for the cache. + +Default value: ``undef`` + +##### `process_number` + +Data type: `Optional[Integer]` + +If specfied as an integer the cache will be wrapped +in a `if $proceess_number` statement so the cache will be used by only +one process. Default is undef. + +Default value: ``undef`` + +##### `manage_dir` + +Data type: `Boolean` + +If true puppet will attempt to create the +directory, if false you will have to create it yourself. Make sure the +directory has the correct owner, group and mode. Defaults to true. + +Default value: ``true`` + +##### `order` + +Data type: `String` + +Order can be used to configure where in `squid.conf`this configuration section should occur. + +Default value: `'05'` + +### `squid::extra_config_section` + +The `extra_config_section` defiend type can be used for configuration directives that have not been exposed individually in this module. + +#### Examples + +##### Using a hash of config_entries: + +```puppet +squid::extra_config_section { 'mail settings': + order => '60', + config_entries => { + 'mail_from' => 'squid@example.com', + 'mail_program' => 'mail', + }, +} + +Results in a squid configuration of +# mail settings +mail_from squid@example.com +mail_program mail +``` + +##### Using an array of config_entries: + +```puppet +squid::extra_config_section { 'ssl_bump settings': + order => '60', + config_entries => { + 'ssl_bump' => ['server-first', 'all'], + 'sslcrtd_program' => ['/usr/lib64/squid/ssl_crtd', '-s', '/var/lib/ssl_db', '-M', '4MB'], + 'sslcrtd_children' => ['8', 'startup=1', 'idle=1'], + } +} + +Results in a squid configuration of: +# ssl_bump settings +ssl_bump server-first all +sslcrtd_program /usr/lib64/squid/ssl_crtd -s /var/lib/ssl_db -M 4MB +sslcrtd_children 8 startup=1 idle=1 +``` + +##### Using an array of hashes of config_entries: + +```puppet +squid::extra_config_section { 'always_directs': + order => '60', + config_entries => [{ + 'always_direct' => ['deny www.reallyreallybadplace.com', + 'allow my-good-dst', + 'allow my-other-good-dst'], + }], +} + +Results in a squid configuration of +# always_directs +always_direct deny www.reallyreallybadplace.com +always_direct allow my-good-dst +always_direct allow my-other-good-dst +``` + +#### Parameters + +The following parameters are available in the `squid::extra_config_section` defined type: + +* [`comment`](#comment) +* [`config_entries`](#config_entries) +* [`order`](#order) + +##### `comment` + +Data type: `String` + +Defaults to the namevar and is used as a section comment in `squid.conf`. + +Default value: `$title` + +##### `config_entries` + +Data type: `Variant[Array,Hash]` + +A hash of configuration entries to create in this section. The hash key is the name of the configuration directive. +The value is either a string, or an array of strings to use as the configuration directive options. + +Default value: `{}` + +##### `order` + +Data type: `String` + +Order can be used to configure where in `squid.conf` this configuration section should occur. + +Default value: `'60'` + +### `squid::http_access` + +Defines http_access entries for a squid server. + +* **See also** + * https://github.com/puppetlabs/puppetlabs-docker/blob/master/REFERENCE.md + +#### Examples + +##### + +```puppet +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 +``` + +##### + +```puppet +squid::http_access { 'our_networks hosts': + action => 'allow', + comment => 'Our networks hosts are allowed', +} + +Adds a squid.conf line +# Our networks hosts are allowed +http_access allow our_networks hosts +``` + +#### Parameters + +The following parameters are available in the `squid::http_access` defined type: + +* [`title`](#title) +* [`action`](#action) +* [`order`](#order) +* [`comment`](#comment) +* [`value`](#value) + +##### `title` + +The name of the ACL the rule is applied to + +##### `action` + +Data type: `Enum['allow', 'deny']` + +allow or deny access for $title + +Default value: `'allow'` + +##### `order` + +Data type: `String` + +Order can be used to configure where in `squid.conf`this configuration section should occur. + +Default value: `'05'` + +##### `comment` + +Data type: `String` + +http_access entry's preceding comment + +Default value: `"http_access fragment for ${value}"` + +##### `value` + +Data type: `String` + + + +Default value: `$title` + +### `squid::http_port` + +Defines http_port entries for a squid server. +By setting optional `ssl` parameter to `true` will create https_port entries instead. + +* **See also** + * http://www.squid-cache.org/Doc/config/http_port/ + +#### Examples + +##### + +```puppet +squid::http_port { '10000': + options => 'accel vhost' +} +squid::http_port { '10001': + ssl => true, + options => 'cert=/etc/squid/ssl_cert/server.cert key=/etc/squid/ssl_cert/server.key' +} +squid::http_port { '127.0.0.1:3128': +} + +Results in a squid configuration of: +http_port 10000 accel vhost +https_port 10001 cert=/etc/squid/ssl_cert/server.cert key=/etc/squid/ssl_cert/server.key +http_port 127.0.0.1:3128 +``` + +#### Parameters + +The following parameters are available in the `squid::http_port` defined type: + +* [`title`](#title) +* [`port`](#port) +* [`host`](#host) +* [`options`](#options) +* [`ssl`](#ssl) +* [`order`](#order) + +##### `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. + +##### `port` + +Data type: `Optional[Stdlib::Port]` + +Defaults to the port of the namevar and is the port number to listen on. + +Default value: ``undef`` + +##### `host` + +Data type: `Optional[Stdlib::Host]` + +Defaults to the host part of the namevar and is the interface to listen on. If not specified, Squid listens on all interfaces. + +Default value: ``undef`` + +##### `options` + +Data type: `Optional[String[1]]` + +A string to specify any options for the default. + +Default value: ``undef`` + +##### `ssl` + +Data type: `Boolean` + +When set to `true` creates https_port entries. Defaults to `false`. + +Default value: ``false`` + +##### `order` + +Data type: `String` + +Order can be used to configure where in `squid.conf`this configuration section should occur. + +Default value: `'05'` + +### `squid::https_port` + +Defines https_port entries for a squid server. Results are the same with http_port and ssl set to `true`. + +* **See also** + * http://www.squid-cache.org/Doc/config/https_port/ + +#### Parameters + +The following parameters are available in the `squid::https_port` defined type: + +* [`port`](#port) +* [`options`](#options) +* [`order`](#order) + +##### `port` + +Data type: `Variant[Pattern[/\d+/], Integer]` + +defaults to the namevar and is the port number. + +Default value: `$title` + +##### `options` + +Data type: `Optional[String[1]]` + +A string to specify any options to add to the https_port line. + +Default value: ``undef`` + +##### `order` + +Data type: `String` + +Order can be used to configure where in `squid.conf`this configuration section should occur. + +Default value: `'05'` + +### `squid::icp_access` + +Defines icp_access entries for a squid server. + +* **See also** + * http://www.squid-cache.org/Doc/config/icp_access/ + +#### Examples + +##### + +```puppet +squid::icp_access { 'our_networks hosts': + action => 'allow', +} + +Adds a squid.conf line +icp_access allow our_networks hosts +``` + +#### Parameters + +The following parameters are available in the `squid::icp_access` defined type: + +* [`action`](#action) +* [`order`](#order) +* [`value`](#value) + +##### `action` + +Data type: `Enum['allow', 'deny']` + +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. + +Default value: `'allow'` + +##### `order` + +Data type: `String` + +Order can be used to configure where in `squid.conf`this configuration section should occur. + +Default value: `'05'` + +##### `value` + +Data type: `String` + + + +Default value: `$title` + +### `squid::refresh_pattern` + +Defines refresh_pattern entries for a squid server. + +* **See also** + * http://www.squid-cache.org/Doc/config/refresh_pattern/ + +#### Examples + +##### + +```puppet +squid::refresh_pattern { '^ftp:': + min => 1440, + max => 10080, + percent => 20, + order => 60, +} + +squid::refresh_pattern { '(/cgi-bin/|\?)': + case_sensitive => false, + min => 0, + max => 0, + percent => 0, + order => 61, +} + +would result in the following squid refresh patterns: +# refresh_pattern fragment for ^ftp +refresh_pattern ^ftp: 1440 20% 10080 +# refresh_pattern fragment for (/cgi-bin/|\?) +refresh_pattern (/cgi-bin/|\?) -i 0 0% 0 +``` + +##### YAML example + +```puppet +squid::refresh_patterns: + '^ftp': + max: 10080 + min: 1440 + percent: 20 + order: '60' + '^gopher': + max: 1440 + min: 1440 + percent: 0 + order: '61' + '(/cgi-bin/|\?)': + case_sensitive: false + max: 0 + min: 0 + percent: 0 + order: '62' + '.': + max: 4320 + min: 0 + percent: 20 + order: '63' +``` + +#### Parameters + +The following parameters are available in the `squid::refresh_pattern` defined type: + +* [`case_sensitive`](#case_sensitive) +* [`comment`](#comment) +* [`min`](#min) +* [`max`](#max) +* [`percent`](#percent) +* [`options`](#options) +* [`order`](#order) +* [`pattern`](#pattern) + +##### `case_sensitive` + +Data type: `Boolean` + +If true (default) the regex is case sensitive, when false the case insensitive flag '-i' is added to the pattern + +Default value: ``true`` + +##### `comment` + +Data type: `String` + +Comment added before refresh rule, defaults to refresh_pattern fragment for `title` + +Default value: `"refresh_pattern fragment for ${pattern}"` + +##### `min` + +Data type: `Integer` + +Must be defined, the time (in minutes) an object without an explicit expiry time should be considered fresh. + +##### `max` + +Data type: `Integer` + +Must be defined, the upper limit (in minutes) on how long objects without an explicit expiry time will be considered fresh. + +##### `percent` + +Data type: `Integer` + +Must be defined, is a percentage of the objects age (time since last modification age) + +##### `options` + +Data type: `Optional[String[1]]` + +See squid documentation for available options. + +Default value: ``undef`` + +##### `order` + +Data type: `String` + +Each refresh_pattern has an order `05` by default this can be specified if order of refresh_pattern definition matters. + +Default value: `'05'` + +##### `pattern` + +Data type: `String` + + + +Default value: `$title` + +### `squid::send_hit` + +Defines send_hit for a squid server. + +* **See also** + * http://www.squid-cache.org/Doc/config/send_hit/ + +#### Examples + +##### + +```puppet +squid:::send_hit{'PragmaNoCache': + action => 'deny', +} + +Adds the following squid.conf line: +send_hit deny PragmaNoCache +``` + +#### Parameters + +The following parameters are available in the `squid::send_hit` defined type: + +* [`value`](#value) +* [`action`](#action) +* [`order`](#order) +* [`comment`](#comment) + +##### `value` + +Data type: `String` + +Defaults to the `namevar`. The rule to allow or deny. + +Default value: `$title` + +##### `action` + +Data type: `Enum['allow', 'deny']` + +Must one of `deny` or `allow` + +Default value: `'allow'` + +##### `order` + +Data type: `String` + +Order can be used to configure where in `squid.conf`this configuration section should occur. + +Default value: `'05'` + +##### `comment` + +Data type: `String` + +A preceeding comment to add to the configuration file. + +Default value: `"send_hit fragment for ${value}"` + +### `squid::snmp_access` + +Defines snmp_access entries for a squid server. + +* **See also** + * http://www.squid-cache.org/Doc/config/snmp_access/ + +#### Examples + +##### + +```puppet +squid::snmp_access { 'monitoring hosts': + action => 'allow', +} + +Adds a squid.conf line +# snmp_access fragment for monitoring hosts +snmp_access allow monitoring hosts +``` + +##### + +```puppet +squid::snmp_access { 'monitoring hosts': + action => 'allow', + comment => 'Our monitoring hosts are allowed', +} +Adds a squid.conf line: +# Our monitoring hosts are allowed +snmp_access allow monitoring hosts +``` + +#### Parameters + +The following parameters are available in the `squid::snmp_access` defined type: + +* [`action`](#action) +* [`order`](#order) +* [`comment`](#comment) +* [`value`](#value) + +##### `action` + +Data type: `Enum['allow', 'deny']` + +Allow or deny access for $title + +Default value: `'allow'` + +##### `order` + +Data type: `String` + +Order can be used to configure where in `squid.conf`this configuration section should occur. + +Default value: `'05'` + +##### `comment` + +Data type: `String` + +snmp_access entry's preceding comment + +Default value: `"snmp_access fragment for ${value}"` + +##### `value` + +Data type: `String` + + + +Default value: `$title` + +### `squid::snmp_port` + +Defines snmp_port entries for a squid server. + +* **See also** + * http://www.squid-cache.org/Doc/config/snmp_port/ + +#### Examples + +##### + +```puppet +squid::snmp_port { '1000': + process_number => 3 +} + +Results in a squid configuration of +if ${process_number} = 3 +snmp_port 1000 +endif +``` + +#### Parameters + +The following parameters are available in the `squid::snmp_port` defined type: + +* [`port`](#port) +* [`options`](#options) +* [`process_number`](#process_number) +* [`order`](#order) + +##### `port` + +Data type: `Variant[Pattern[/\d+/], Stdlib::Port]` + +Defaults to the namevar and is the port number. + +Default value: `$title` + +##### `options` + +Data type: `Optional[String[1]]` + +A string to specify any options for the default. + +Default value: ``undef`` + +##### `process_number` + +Data type: `Optional[Integer]` + +If set to and integer the snmp\_port is enabled only for a particular squid thread. Defaults to undef. + +Default value: ``undef`` + +##### `order` + +Data type: `String` + +Order can be used to configure where in `squid.conf`this configuration section should occur. + +Default value: `'05'` + +### `squid::ssl_bump` + +Defines ssl_bump entries for a squid server. + +* **See also** + * http://www.squid-cache.org/Doc/config/ssl_bump/ + +#### Examples + +##### + +```puppet +squid::ssl_bump { 'all': + action => 'bump', +} + +Adds a squid.conf line +ssl_bump bump all +``` + +#### Parameters + +The following parameters are available in the `squid::ssl_bump` defined type: + +* [`title`](#title) +* [`action`](#action) +* [`order`](#order) +* [`value`](#value) + +##### `title` + +The name of acl the ssl_bump rule is applied to + +##### `action` + +Data type: `Squid::Action::SslBump` + +The type of the ssl_bump, must be defined, e.g bump, peek, .. + +Default value: `'bump'` + +##### `order` + +Data type: `String` + +Order can be used to configure where in `squid.conf`this configuration section should occur. + +Default value: `'05'` + +##### `value` + +Data type: `String` + + + +Default value: `$title` + +### `squid::sslproxy_cert_error` + +Defines sslproxy_cert_error entries for a squid server. + +* **See also** + * http://www.squid-cache.org/Doc/config/sslproxy_cert_error/ + +#### Examples + +##### + +```puppet +squid::sslproxy_cert_error { 'all': + action => 'allow', +} + +Adds a squid.conf line +sslproxy_cert_error allow all +``` + +#### Parameters + +The following parameters are available in the `squid::sslproxy_cert_error` defined type: + +* [`value`](#value) +* [`action`](#action) +* [`order`](#order) + +##### `value` + +Data type: `String` + +Defaults to the `namevar` the rule to allow or deny. + +Default value: `$title` + +##### `action` + +Data type: `Enum['allow', 'deny']` + +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. + +Default value: `'allow'` + +##### `order` + +Data type: `String` + +Order can be used to configure where in `squid.conf`this configuration section should occur. + +Default value: `'05'` + +## Data types + +### `Squid::Action::SslBump` + +Possible SSLBump options + +Alias of + +```puppet +Enum['bump', 'client-first', 'none', 'peek', 'peek-and-splice', 'server-first', 'splice', 'stare', 'terminate'] +``` + +### `Squid::PkgEnsure` + +Custom type representing package status and/or version + +Alias of + +```puppet +Variant[Pattern[/^\d.*/], Enum['present', 'latest', 'absent', 'purged', 'held', 'installed']] +``` + +### `Squid::Size` + +Custom type containing the numeral value and the unit of messurement (Kilo- or Megabyte) + +Alias of + +```puppet +Pattern[/^\d+ [KM]B$/] +``` + From dd1042a407b6555f0c992ba7f7eff897cc5724e1 Mon Sep 17 00:00:00 2001 From: Steve Traylen Date: Thu, 24 Mar 2022 09:03:58 +0100 Subject: [PATCH 7/7] ruocop - Style/IfUnlessModifier - correction --- spec/spec_helper_acceptance.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 80d712c..18f9038 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -3,9 +3,7 @@ require 'voxpupuli/acceptance/spec_helper_acceptance' configure_beaker do |host| - if fact('os.family') == 'RedHat' && fact('os.release.major') != '7' - on host, puppet('module', 'install', 'puppet-systemd'), acceptable_exit_codes: [0, 1] - end + on host, puppet('module', 'install', 'puppet-systemd'), acceptable_exit_codes: [0, 1] if fact('os.family') == 'RedHat' && fact('os.release.major') != '7' end Dir['./spec/support/acceptance/**/*.rb'].sort.each { |f| require f }