From c7f5188944750ac9201d7ffd66b6b1240e90bf32 Mon Sep 17 00:00:00 2001 From: Lebedev Vadim Date: Tue, 19 May 2020 17:43:13 +0300 Subject: [PATCH] added parameters config_array_prepend config_hash_prepend for custom config simple fix depend dependencies and puppet-lint --- manifests/init.pp | 6 ++++-- metadata.json | 10 ++++++---- templates/squid.conf.short.erb | 12 ++++++++++++ 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index a76b62d..0f81b7d 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -25,7 +25,9 @@ $server_persistent_connections = 'on', $maximum_object_size = '4096 KB', $maximum_object_size_in_memory = '512 KB', + $config_array_prepend = false, $config_array = false, + $config_hash_prepend = false, $config_hash = false, $config_content = undef, $config_source = undef, @@ -78,8 +80,8 @@ } case $::osfamily { - 'FreeBSD': { $cmdpath = "/usr/local/sbin" } - default: { $cmdpath = "/usr/sbin" } + 'FreeBSD': { $cmdpath = '/usr/local/sbin' } + default: { $cmdpath = '/usr/sbin' } } file { $config_file: diff --git a/metadata.json b/metadata.json index eb5761d..6e3ae34 100644 --- a/metadata.json +++ b/metadata.json @@ -8,6 +8,12 @@ "project_page": "https://github.com/thias/puppet-squid3", "issues_url": "https://github.com/thias/puppet-squid3/issues", "tags": [ "squid", "proxy" ], + "dependencies": [ + { + "name": "puppetlabs/stdlib", + "version_requirement": ">= 5.0.0 < 7.0.0" + } + ], "operatingsystem_support": [ { "operatingsystem": "RedHat", @@ -30,10 +36,6 @@ { "name": "puppet", "version_requirement": ">=2.7.20 <7.0.0" - }, - { - "name": "puppetlabs/stdlib", - "version_requirement": ">= 2.4.0" } ] } diff --git a/templates/squid.conf.short.erb b/templates/squid.conf.short.erb index 58d35a4..eb661c5 100644 --- a/templates/squid.conf.short.erb +++ b/templates/squid.conf.short.erb @@ -1,6 +1,18 @@ ## THIS FILE IS MANAGED BY PUPPET. ## DO NOT EDIT. +# user-defined configuration settings from config_hash_prepend +<% if @config_hash_prepend -%> +<% @config_hash_prepend.sort_by {|k,v| k}.each do |k,v| -%> +<%= "%*s"%[-30,k] %> <%= v %> +<% end -%> +<% end -%> +<% if @config_array_prepend -%> +<% @config_array_prepend.each do |v| -%> +<%= v %> +<% end -%> +<% end -%> + # predefined ACLs <% if @use_deprecated_opts -%> acl manager proto cache_object