From 0b63a2de059c0e90e5134395c9a37ff10182ffdc Mon Sep 17 00:00:00 2001 From: Andreas Pf Date: Tue, 20 Nov 2018 07:09:36 +0100 Subject: [PATCH 01/28] Update README.md Fixed a small typo. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0aa1948..44592ff 100644 --- a/README.md +++ b/README.md @@ -374,7 +374,7 @@ squid::refresh_pattern { '^ftp:': } squid::refresh_pattern { '(/cgi-bin/|\?)': - case_sensitive => falke, + case_sensitive => false, min => 0, max => 0, percent => 0, From ce676cd18be65904b7556ec6bf0cf8be1642bf46 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Sun, 25 Nov 2018 23:02:46 +0000 Subject: [PATCH 02/28] Use strings not symbols with beaker-puppet `fact()` `beaker-puppet` never indended to support symbols passed to the `fact` function. See https://github.com/puppetlabs/beaker-puppet/pull/73 --- spec/acceptance/class_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index ae13741..edb6898 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -2,7 +2,7 @@ describe 'squid class' do context 'configure http_access' do - squid_name = fact(:operatingsystem) == 'Debian' && fact(:operatingsystemmajrelease) == '8' ? 'squid3' : 'squid' + squid_name = fact('operatingsystem') == 'Debian' && fact('operatingsystemmajrelease') == '8' ? 'squid3' : 'squid' it 'works idempotently with no errors' do pp = <<-EOS From 13c60288bcca55e283c50caf97b4cd6b05d5b508 Mon Sep 17 00:00:00 2001 From: sourcedoctor Date: Wed, 28 Nov 2018 22:01:13 +0100 Subject: [PATCH 03/28] fix url_rewrite_program --- README.md | 64 ++++++-------------- manifests/config.pp | 5 +- manifests/init.pp | 4 +- manifests/params.pp | 2 + manifests/url_rewrite_program.pp | 15 ----- spec/classes/init_spec.rb | 7 ++- spec/classes/url_rewrite_program.rb | 38 ------------ templates/squid.conf.header.erb | 11 +++- templates/squid.conf.url_rewrite_program.erb | 5 -- 9 files changed, 42 insertions(+), 109 deletions(-) delete mode 100644 manifests/url_rewrite_program.pp delete mode 100644 spec/classes/url_rewrite_program.rb delete mode 100644 templates/squid.conf.url_rewrite_program.erb diff --git a/README.md b/README.md index 0aa1948..f1a1fc0 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,10 @@ Parameters to the squid class almost map 1 to 1 to squid.conf parameters themsel * `memory_replacement_policy` defaults to undef. [memory_replacement_policy docs](http://www.squid-cache.org/Doc/config/memory_replacement_policy/). * `memory_cache_shared` defaults to undef. [memory_cache_shared docs](http://www.squid-cache.org/Doc/config/memory_cache_shared/). * `maximum_object_size_in_memory` defaults to `512 KB`. [maximum_object_size_in_memory docs](http://www.squid-cache.org/Doc/config/maximum_object_size_in_memory/) + +* `url_rewrite_program` defaults to undef [url_rewrite_program_docs](http://www.squid-cache.org/Doc/config/url_rewrite_program/) +* `url_rewrite_children` defaults to undef [url_rewrite_children_docs](http://www.squid-cache.org/Doc/config/url_rewrite_children/) +* `url_rewrite_child_options` defaults to undef [url_rewrite_child_options_docs](http://www.squid-cache.org/Doc/config/url_rewrite_children/) * `access_log` defaults to `daemon:/var/logs/squid/access.log squid`. [access_log docs](http://www.squid-cache.org/Doc/config/access_log/) * `coredump_dir` defaults to undef. [coredump_dir docs](http://www.squid-cache.org/Doc/config/coredump_dir/). * `error_directory` defaults to undef. [error_directory](http://www.squid-cache.org/Doc/config/error_directory/). @@ -86,19 +90,22 @@ class { '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 }}, + 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, } ``` @@ -174,37 +181,6 @@ Adds a squid.conf line cache deny our_network_hosts_acl ``` -### Defined Type squid::url\_rewrite\_program -Defines [url_rewrite_program entries](http://www.squid-cache.org/Doc/config/url_rewrite_program/) for a squid server. - -```puppet -squid::url_rewrite_program { '/usr/bin/squidguard -c /etc/squidguard/squidguard.conf': -} -``` - -Adds a squid.conf line - -``` - -# fragment for url_rewrite_program /usr/bin/squidguard -c /etc/squidguard/squidguard.conf -url_rewrite_program /usr/bin/squidguard -c /etc/squidguard/squidguard.conf -``` - -```puppet -squid::url_rewrite_program { '/usr/bin/squidguard -c /etc/squidguard/squidguard.conf': - children => 10 -} - -``` - -Adds a squid.conf line - -``` -# fragment for url_rewrite_program /usr/bin/squidguard -c /etc/squidguard/squidguard.conf -url_rewrite_program /usr/bin/squidguard -c /etc/squidguard/squidguard.conf -url_rewrite_children 10 -``` - ### Defined Type squid::http\_access Defines [http_access entries](http://www.squid-cache.org/Doc/config/http_access/) for a squid server. diff --git a/manifests/config.pp b/manifests/config.pp index a28bc4f..d25e54a 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -27,6 +27,8 @@ $http_ports = $::squid::http_ports, $https_ports = $::squid::https_ports, $url_rewrite_program = $::squid::url_rewrite_program, + $url_rewrite_children = $::squid::url_rewrite_children, + $url_rewrite_child_options = $::squid::url_rewrite_child_options, $refresh_patterns = $::squid::refresh_patterns, $snmp_incoming_address = $::squid::snmp_incoming_address, $snmp_ports = $::squid::snmp_ports, @@ -83,9 +85,6 @@ if $cache { create_resources('squid::cache', $cache) } - if $url_rewrite_program { - create_resources('squid::url_rewrite_program', $url_rewrite_program) - } if $refresh_patterns { create_resources('squid::refresh_pattern', $refresh_patterns) } diff --git a/manifests/init.pp b/manifests/init.pp index 2ce2dc1..998e0c4 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -24,7 +24,9 @@ Optional[Hash] $cache_dirs = $squid::params::cache_dirs, Optional[Hash] $cache = $squid::params::cache, Optional[String] $coredump_dir = $squid::params::coredump_dir, - Optional[Hash] $url_rewrite_program = $squid::params::url_rewrite_program, + Optional[String] $url_rewrite_program = $squid::params::url_rewrite_program, + Optional[Integer] $url_rewrite_children = $squid::params::url_rewrite_children, + Optional[String] $url_rewrite_child_options = $squid::params::url_rewrite_child_options, Optional[Hash] $extra_config_sections = {}, Optional[Hash] $http_access = $squid::params::http_access, Optional[Hash] $send_hit = $squid::params::send_hit, diff --git a/manifests/params.pp b/manifests/params.pp index 2a80c4f..81b2047 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -27,6 +27,8 @@ $http_ports = undef $https_ports = undef $url_rewrite_program = undef + $url_rewrite_children = undef + $url_rewrite_child_options = undef $refresh_patterns = undef $snmp_incoming_address = undef $snmp_ports = undef diff --git a/manifests/url_rewrite_program.pp b/manifests/url_rewrite_program.pp deleted file mode 100644 index db4b063..0000000 --- a/manifests/url_rewrite_program.pp +++ /dev/null @@ -1,15 +0,0 @@ -class squid::url_rewrite_program ( - String $program = $title, - String $order = '05', - Optional[Integer] $children = undef, - Optional[String] $child_options = undef, - -) { - - concat::fragment{'squid_url_rewrite_program': - target => $squid::config, - content => template('squid/squid.conf.url_rewrite_program.erb'), - order => "44-${order}", - } - -} diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 7b8c12e..f5a4c62 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -56,7 +56,10 @@ access_log: '/var/log/out.log', coredump_dir: '/tmp/core', max_filedescriptors: 1000, - workers: 8 + workers: 8, + url_rewrite_program: '/some/test/program', + url_rewrite_children: 16, + url_rewrite_child_options: 'testoption=a' } end @@ -72,6 +75,8 @@ it { is_expected.to contain_concat_fragment('squid_header').with_content(%r{^coredump_dir\s+/tmp/core$}) } it { is_expected.to contain_concat_fragment('squid_header').with_content(%r{^max_filedescriptors\s+1000$}) } it { is_expected.to contain_concat_fragment('squid_header').with_content(%r{^workers\s+8$}) } + it { is_expected.to contain_concat_fragment('squid_header').with_content(%r{^url_rewrite_program\s+/some/test/program$}) } + it { is_expected.to contain_concat_fragment('squid_header').with_content(%r{^url_rewrite_children\s+16\stestoption=a$}) } end context 'with buffered_logs parameter set to true' do diff --git a/spec/classes/url_rewrite_program.rb b/spec/classes/url_rewrite_program.rb deleted file mode 100644 index 92a333c..0000000 --- a/spec/classes/url_rewrite_program.rb +++ /dev/null @@ -1,38 +0,0 @@ -require 'spec_helper' - -describe 'squid::url_rewrite_program' do - on_supported_os.each do |os, facts| - context "on #{os}" do - let(:facts) do - facts - end - let :pre_condition do - ' class{"::squid": - config => "/tmp/squid.conf" - } - ' - end - let(:title) { 'someprogram' } - - context 'when parameters are unset' do - it { is_expected.to contain_concat_fragment('squid_url_rewrite_program_someprogram').with_target('/tmp/squid.conf') } - it { is_expected.to contain_concat_fragment('squid_url_rewrite_program_someprogram').with_order('44-05') } - it { is_expected.to contain_concat_fragment('squid_url_rewrite_program_someprogram').with_content(%r{^url_rewrite_program\s+someprogram\s*$}) } - end - context 'when parameters are set' do - let(:params) do - { - program: 'someotherprogram', - children: 10, - order: '08' - } - end - - it { is_expected.to contain_concat_fragment('squid_url_rewrite_program_someotherprogram').with_target('/tmp/squid.conf') } - it { is_expected.to contain_concat_fragment('squid_url_rewrite_program_someotherprogram').with_order('44-08') } - it { is_expected.to contain_concat_fragment('squid_url_rewrite_program_someotherprogram').with_content(%r{^url_rewrite_program\s+someotherprogram\s*$}) } - it { is_expected.to contain_concat_fragment('squid_url_rewrite_program_someotherprogram').with_content(%r{^url_rewrite_children\s+10\s*$}) } - end - end - end -end diff --git a/templates/squid.conf.header.erb b/templates/squid.conf.header.erb index ee70983..865081b 100644 --- a/templates/squid.conf.header.erb +++ b/templates/squid.conf.header.erb @@ -42,12 +42,12 @@ max_filedescriptors <%= @max_filedescriptors %> <% end -%> <% if @workers -%> -workers <%= @workers %> +workers <%= @workers %> <% end -%> <% if @snmp_incoming_address -%> -snmp_incoming_address <%= @snmp_incoming_address -%> +snmp_incoming_address <%= @snmp_incoming_address %> <% end -%> <% if @visible_hostname -%> visible_hostname <%= @visible_hostname %> @@ -61,3 +61,10 @@ httpd_suppress_version_string <%= @httpd_suppress_version_string?'on':'off' %> <% unless @forwarded_for.nil? -%> forwarded_for <%= @forwarded_for?'on':'off' %> <% end -%> + +<% if @url_rewrite_program -%> +url_rewrite_program <%= @url_rewrite_program %> +<% if @url_rewrite_children -%> +url_rewrite_children <%= @url_rewrite_children %> <%= @url_rewrite_child_options%> +<% end -%> +<% end -%> diff --git a/templates/squid.conf.url_rewrite_program.erb b/templates/squid.conf.url_rewrite_program.erb deleted file mode 100644 index 57a272e..0000000 --- a/templates/squid.conf.url_rewrite_program.erb +++ /dev/null @@ -1,5 +0,0 @@ -# fragment for url_rewrite_program <%= @program %> -url_rewrite_program <%= @program %> -<% if @children -%> -url_rewrite_children <%= @children %> <%= @child_options%> -<% end -%> From 2ddd80cb317077909909d937c7013783af9c6c8f Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Fri, 30 Nov 2018 21:13:45 +0100 Subject: [PATCH 04/28] Modulesync 2.2.1-pre --- .editorconfig | 14 ++++ .github/CONTRIBUTING.md | 75 +++++++++++++++---- .msync.yml | 2 +- .travis.yml | 32 +++++++- Gemfile | 10 +-- spec/acceptance/nodesets/centos-511-x64.yml | 15 ---- spec/acceptance/nodesets/centos-6-x64.yml | 15 ---- spec/acceptance/nodesets/centos-66-x64-pe.yml | 17 ----- spec/acceptance/nodesets/centos-66-x64.yml | 15 ---- spec/acceptance/nodesets/centos-7-x64.yml | 15 ---- spec/acceptance/nodesets/centos-72-x64.yml | 15 ---- spec/acceptance/nodesets/debian-78-x64.yml | 15 ---- spec/acceptance/nodesets/debian-82-x64.yml | 15 ---- spec/acceptance/nodesets/fedora-24-x64.yml | 15 ---- spec/acceptance/nodesets/fedora-25-x64.yml | 16 ---- spec/acceptance/nodesets/fedora-26-x64.yml | 16 ---- spec/acceptance/nodesets/fedora-27-x64.yml | 18 ----- .../nodesets/ubuntu-server-1204-x64.yml | 15 ---- .../nodesets/ubuntu-server-1404-x64.yml | 15 ---- .../nodesets/ubuntu-server-1604-x64.yml | 15 ---- spec/classes/coverage_spec.rb | 4 - spec/default_facts.yml | 1 - spec/spec_helper.rb | 19 +++-- 23 files changed, 117 insertions(+), 272 deletions(-) create mode 100644 .editorconfig delete mode 100644 spec/acceptance/nodesets/centos-511-x64.yml delete mode 100644 spec/acceptance/nodesets/centos-6-x64.yml delete mode 100644 spec/acceptance/nodesets/centos-66-x64-pe.yml delete mode 100644 spec/acceptance/nodesets/centos-66-x64.yml delete mode 100644 spec/acceptance/nodesets/centos-7-x64.yml delete mode 100644 spec/acceptance/nodesets/centos-72-x64.yml delete mode 100644 spec/acceptance/nodesets/debian-78-x64.yml delete mode 100644 spec/acceptance/nodesets/debian-82-x64.yml delete mode 100644 spec/acceptance/nodesets/fedora-24-x64.yml delete mode 100644 spec/acceptance/nodesets/fedora-25-x64.yml delete mode 100644 spec/acceptance/nodesets/fedora-26-x64.yml delete mode 100644 spec/acceptance/nodesets/fedora-27-x64.yml delete mode 100644 spec/acceptance/nodesets/ubuntu-server-1204-x64.yml delete mode 100644 spec/acceptance/nodesets/ubuntu-server-1404-x64.yml delete mode 100644 spec/acceptance/nodesets/ubuntu-server-1604-x64.yml delete mode 100644 spec/classes/coverage_spec.rb diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..d77700e --- /dev/null +++ b/.editorconfig @@ -0,0 +1,14 @@ +# editorconfig.org + +# MANAGED BY MODULESYNC + +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +tab_width = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 496a5c0..832578e 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -12,15 +12,20 @@ By participating in this project you agree to abide by its terms. 1. Create a separate branch for your change. -1. Run the tests. We only take pull requests with passing tests, and - documentation. +1. We only take pull requests with passing tests, and documentation. [travis-ci](http://travis-ci.org) + runs the tests for us. You can also execute them locally. This is explained + in a later section. + +1. Checkout [our docs](https://voxpupuli.org/docs/#reviewing-a-module-pr) we + use to review a module and the [official styleguide](https://puppet.com/docs/puppet/6.0/style_guide.html). + They provide some guidance for new code that might help you before you submit a pull request. 1. Add a test for your change. Only refactoring and documentation changes require no new tests. If you are adding functionality or fixing a bug, please add a test. 1. Squash your commits down into logical components. Make sure to rebase - against the current master. + against our current master. 1. Push the branch to your fork and submit a pull request. @@ -38,7 +43,9 @@ By default the tests use a baseline version of Puppet. If you have Ruby 2.x or want a specific version of Puppet, you must set an environment variable such as: - export PUPPET_VERSION="~> 4.2.0" +```sh +export PUPPET_VERSION="~> 5.5.6" +``` You can install all needed gems for spec tests into the modules directory by running: @@ -65,13 +72,17 @@ The test suite will run [Puppet Lint](http://puppet-lint.com/) and [Puppet Syntax](https://github.com/gds-operations/puppet-syntax) to check various syntax and style things. You can run these locally with: - bundle exec rake lint - bundle exec rake validate +```sh +bundle exec rake lint +bundle exec rake validate +``` It will also run some [Rubocop](http://batsov.com/rubocop/) tests against it. You can run those locally ahead of time with: - bundle exec rake rubocop +```sh +bundle exec rake rubocop +``` ## Running the unit tests @@ -82,15 +93,21 @@ about how best to test your new feature. To run the linter, the syntax checker and the unit tests: - bundle exec rake test +```sh +bundle exec rake test +``` To run your all the unit tests - bundle exec rake spec SPEC_OPTS='--format documentation' +```sh +bundle exec rake spec +``` To run a specific spec test set the `SPEC` variable: - bundle exec rake spec SPEC=spec/foo_spec.rb +```sh +bundle exec rake spec SPEC=spec/foo_spec.rb +``` ## Integration tests @@ -102,23 +119,51 @@ This fires up a new virtual machine (using vagrant) and runs a series of simple tests against it after applying the module. You can run this with: - bundle exec rake acceptance +```sh +bundle exec rake acceptance +``` This will run the tests on the module's default nodeset. You can override the nodeset used, e.g., - BEAKER_set=centos-7-x64 bundle exec rake acceptance +```sh +BEAKER_set=centos-7-x64 bundle exec rake acceptance +``` There are default rake tasks for the various acceptance test modules, e.g., - bundle exec rake beaker:centos-7-x64 - bundle exec rake beaker:ssh:centos-7-x64 +```sh +bundle exec rake beaker:centos-7-x64 +bundle exec rake beaker:ssh:centos-7-x64 +``` If you don't want to have to recreate the virtual machine every time you can use `BEAKER_destroy=no` and `BEAKER_provision=no`. On the first run you will at least need `BEAKER_provision` set to yes (the default). The Vagrantfile for the created virtual machines will be in `.vagrant/beaker_vagrant_files`. +Beaker also supports docker containers. We also use that in our automated CI +pipeline at [travis-ci](http://travis-ci.org). To use that instead of Vagrant: + +``` +PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} BEAKER_destroy=yes bundle exec rake beaker +``` + +You can replace the string `debian9` with any common operating system. +The following strings are known to work: + +* ubuntu1604 +* ubuntu1804 +* debian8 +* debian9 +* centos6 +* centos7 + The easiest way to debug in a docker container is to open a shell: - docker exec -it -u root ${container_id_or_name} bash +```sh +docker exec -it -u root ${container_id_or_name} bash +``` + +The source of this file is in our [modulesync_config](https://github.com/voxpupuli/modulesync_config/blob/master/moduleroot/.github/CONTRIBUTING.md.erb) +repository. diff --git a/.msync.yml b/.msync.yml index e1cef55..1d2221f 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '2.0.0' +modulesync_config_version: '2.2.0' diff --git a/.travis.yml b/.travis.yml index 229488b..87886f8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,11 +18,11 @@ matrix: env: PUPPET_VERSION="~> 5.0" CHECK=test - rvm: 2.5.1 bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 5.0" CHECK=test_with_coveralls - - rvm: 2.4.4 - bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 5.0" CHECK=rubocop + env: PUPPET_VERSION="~> 6.0" CHECK=test_with_coveralls - rvm: 2.5.1 + bundler_args: --without system_tests development release + env: PUPPET_VERSION="~> 6.0" CHECK=rubocop + - rvm: 2.4.4 bundler_args: --without system_tests development release env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes - rvm: 2.5.1 @@ -31,6 +31,12 @@ matrix: env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker} CHECK=beaker services: docker sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty @@ -43,6 +49,12 @@ matrix: env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian8-64{hypervisor=docker} CHECK=beaker services: docker sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian8-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty @@ -55,6 +67,12 @@ matrix: env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} CHECK=beaker services: docker sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty @@ -67,6 +85,12 @@ matrix: env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64{hypervisor=docker} CHECK=beaker services: docker sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty diff --git a/Gemfile b/Gemfile index 20f3df0..3c2b411 100644 --- a/Gemfile +++ b/Gemfile @@ -11,9 +11,8 @@ def location_for(place, fake_version = nil) end group :test do - gem 'puppetlabs_spec_helper', '~> 2.6', :require => false - gem 'rspec-puppet', '~> 2.5', :require => false - gem 'rspec-puppet-facts', :require => false + gem 'puppetlabs_spec_helper', '>= 2.11.0', :require => false + gem 'rspec-puppet-facts', '>= 1.8.0', :require => false gem 'rspec-puppet-utils', :require => false gem 'puppet-lint-leading_zero-check', :require => false gem 'puppet-lint-trailing_comma-check', :require => false @@ -29,7 +28,8 @@ group :test do gem 'coveralls', :require => false gem 'simplecov-console', :require => false gem 'rack', '~> 1.0', :require => false if RUBY_VERSION < '2.2.2' - gem 'parallel_tests', :require => false + gem 'parallel_tests', '2.24.0', :require => false if RUBY_VERSION < '2.2.0' + gem 'parallel_tests', :require => false if RUBY_VERSION >= '2.2.0' end group :development do @@ -52,7 +52,7 @@ group :system_tests do gem 'beaker-rspec', :require => false end gem 'serverspec', :require => false - gem 'beaker-hostgenerator', '>= 1.1.10', :require => false + gem 'beaker-hostgenerator', '>= 1.1.22', :require => false gem 'beaker-docker', :require => false gem 'beaker-puppet', :require => false gem 'beaker-puppet_install_helper', :require => false diff --git a/spec/acceptance/nodesets/centos-511-x64.yml b/spec/acceptance/nodesets/centos-511-x64.yml deleted file mode 100644 index 089d646..0000000 --- a/spec/acceptance/nodesets/centos-511-x64.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - centos-511-x64: - roles: - - master - platform: el-5-x86_64 - box: puppetlabs/centos-5.11-64-nocm - hypervisor: vagrant -CONFIG: - type: foss -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/centos-6-x64.yml b/spec/acceptance/nodesets/centos-6-x64.yml deleted file mode 100644 index 16abc8f..0000000 --- a/spec/acceptance/nodesets/centos-6-x64.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - centos-6-x64: - roles: - - master - platform: el-6-x86_64 - box: centos/6 - hypervisor: vagrant -CONFIG: - type: aio -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/centos-66-x64-pe.yml b/spec/acceptance/nodesets/centos-66-x64-pe.yml deleted file mode 100644 index 1e7aea6..0000000 --- a/spec/acceptance/nodesets/centos-66-x64-pe.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - centos-66-x64: - roles: - - master - - database - - dashboard - platform: el-6-x86_64 - box: puppetlabs/centos-6.6-64-puppet-enterprise - hypervisor: vagrant -CONFIG: - type: pe -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/centos-66-x64.yml b/spec/acceptance/nodesets/centos-66-x64.yml deleted file mode 100644 index 42455e7..0000000 --- a/spec/acceptance/nodesets/centos-66-x64.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - centos-66-x64: - roles: - - master - platform: el-6-x86_64 - box: puppetlabs/centos-6.6-64-nocm - hypervisor: vagrant -CONFIG: - type: foss -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/centos-7-x64.yml b/spec/acceptance/nodesets/centos-7-x64.yml deleted file mode 100644 index e05a3ae..0000000 --- a/spec/acceptance/nodesets/centos-7-x64.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - centos-7-x64: - roles: - - master - platform: el-7-x86_64 - box: centos/7 - hypervisor: vagrant -CONFIG: - type: aio -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/centos-72-x64.yml b/spec/acceptance/nodesets/centos-72-x64.yml deleted file mode 100644 index 85af89d..0000000 --- a/spec/acceptance/nodesets/centos-72-x64.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - centos-72-x64: - roles: - - master - platform: el-7-x86_64 - box: puppetlabs/centos-7.2-64-nocm - hypervisor: vagrant -CONFIG: - type: foss -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/debian-78-x64.yml b/spec/acceptance/nodesets/debian-78-x64.yml deleted file mode 100644 index 6ef6de8..0000000 --- a/spec/acceptance/nodesets/debian-78-x64.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - debian-78-x64: - roles: - - master - platform: debian-7-amd64 - box: puppetlabs/debian-7.8-64-nocm - hypervisor: vagrant -CONFIG: - type: foss -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/debian-82-x64.yml b/spec/acceptance/nodesets/debian-82-x64.yml deleted file mode 100644 index 9897a8f..0000000 --- a/spec/acceptance/nodesets/debian-82-x64.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - debian-82-x64: - roles: - - master - platform: debian-8-amd64 - box: puppetlabs/debian-8.2-64-nocm - hypervisor: vagrant -CONFIG: - type: foss -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/fedora-24-x64.yml b/spec/acceptance/nodesets/fedora-24-x64.yml deleted file mode 100644 index 820b62d..0000000 --- a/spec/acceptance/nodesets/fedora-24-x64.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - fedora-24-x64: - roles: - - master - platform: fedora-24-x86_64 - box: fedora/24-cloud-base - hypervisor: vagrant -CONFIG: - type: aio -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/fedora-25-x64.yml b/spec/acceptance/nodesets/fedora-25-x64.yml deleted file mode 100644 index 54dd330..0000000 --- a/spec/acceptance/nodesets/fedora-25-x64.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -# -HOSTS: - fedora-25-x64: - roles: - - master - platform: fedora-25-x86_64 - box: fedora/25-cloud-base - hypervisor: vagrant -CONFIG: - type: aio -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/fedora-26-x64.yml b/spec/acceptance/nodesets/fedora-26-x64.yml deleted file mode 100644 index 598822b..0000000 --- a/spec/acceptance/nodesets/fedora-26-x64.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -# -HOSTS: - fedora-26-x64: - roles: - - master - platform: fedora-26-x86_64 - box: fedora/26-cloud-base - hypervisor: vagrant -CONFIG: - type: aio -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/fedora-27-x64.yml b/spec/acceptance/nodesets/fedora-27-x64.yml deleted file mode 100644 index c2b61eb..0000000 --- a/spec/acceptance/nodesets/fedora-27-x64.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -# -# platform is fedora 26 because there is no puppet-agent -# for fedora 27 as of 2017-11-17 -HOSTS: - fedora-27-x64: - roles: - - master - platform: fedora-26-x86_64 - box: fedora/27-cloud-base - hypervisor: vagrant -CONFIG: - type: aio -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml deleted file mode 100644 index 29102c5..0000000 --- a/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - ubuntu-server-1204-x64: - roles: - - master - platform: ubuntu-12.04-amd64 - box: puppetlabs/ubuntu-12.04-64-nocm - hypervisor: vagrant -CONFIG: - type: foss -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml deleted file mode 100644 index 054e658..0000000 --- a/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - ubuntu-server-1404-x64: - roles: - - master - platform: ubuntu-14.04-amd64 - box: puppetlabs/ubuntu-14.04-64-nocm - hypervisor: vagrant -CONFIG: - type: foss -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml deleted file mode 100644 index bc85e0e..0000000 --- a/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - ubuntu-server-1604-x64: - roles: - - master - platform: ubuntu-16.04-amd64 - box: puppetlabs/ubuntu-16.04-64-nocm - hypervisor: vagrant -CONFIG: - type: foss -... -# vim: syntax=yaml diff --git a/spec/classes/coverage_spec.rb b/spec/classes/coverage_spec.rb deleted file mode 100644 index de44654..0000000 --- a/spec/classes/coverage_spec.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'rspec-puppet' - -at_exit { RSpec::Puppet::Coverage.report! } -# vim: syntax=ruby diff --git a/spec/default_facts.yml b/spec/default_facts.yml index 13c4165..2f6698d 100644 --- a/spec/default_facts.yml +++ b/spec/default_facts.yml @@ -8,7 +8,6 @@ # Hint if using with rspec-puppet-facts ("on_supported_os.each"): # if a same named fact exists in facterdb it will be overridden. --- -concat_basedir: "/tmp" ipaddress: "172.16.254.254" is_pe: false macaddress: "AA:AA:AA:AA:AA:AA" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ea74a52..88bca59 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,10 +1,9 @@ -require 'puppetlabs_spec_helper/module_spec_helper' -require 'rspec-puppet-facts' -include RspecPuppetFacts - # This file is managed via modulesync # https://github.com/voxpupuli/modulesync # https://github.com/voxpupuli/modulesync_config +require 'puppetlabs_spec_helper/module_spec_helper' +require 'rspec-puppet-facts' +include RspecPuppetFacts if Dir.exist?(File.expand_path('../../lib', __FILE__)) require 'coveralls' @@ -23,13 +22,13 @@ end RSpec.configure do |c| - default_facts = { - puppetversion: Puppet.version, - facterversion: Facter.version - } + default_facts = {} default_facts.merge!(YAML.load(File.read(File.expand_path('../default_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_facts.yml', __FILE__)) default_facts.merge!(YAML.load(File.read(File.expand_path('../default_module_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_module_facts.yml', __FILE__)) c.default_facts = default_facts -end -# vim: syntax=ruby + # Coverage generation + c.after(:suite) do + RSpec::Puppet::Coverage.report! + end +end From 4e501f8081afe5e33792e9578705ea60fe928f63 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 13 Oct 2018 20:25:56 +0200 Subject: [PATCH 05/28] purge obsolete symlink setting in fixtures --- .fixtures.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index 5b6f37f..41383ad 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -3,5 +3,3 @@ fixtures: concat: 'https://github.com/puppetlabs/puppetlabs-concat.git' stdlib: 'https://github.com/puppetlabs/puppetlabs-stdlib.git' selinux: 'https://github.com/voxpupuli/puppet-selinux.git' - symlinks: - "squid": "#{source_dir}" From dc34e3b4250658240da86194f3e553ee2be0ccf7 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 13 Oct 2018 20:26:46 +0200 Subject: [PATCH 06/28] allow puppet 6.x --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index a392e8e..a44e66c 100644 --- a/metadata.json +++ b/metadata.json @@ -16,7 +16,7 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 4.10.0 < 6.0.0" + "version_requirement": ">= 4.10.0 < 7.0.0" } ], "dependencies": [ From 19a5fb9d5b04dde6028ffae06e8500007806da69 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Fri, 30 Nov 2018 21:04:27 +0100 Subject: [PATCH 07/28] Add a Squid::Size type This type correctly checks the type for sizes. It now allows specifying the maximum_object_size_in_memory in MBs rather than KBs. For correctness we now also check for the full string which means we no longer allow -1 KB or 1 KBB. --- manifests/init.pp | 4 ++-- spec/type_aliases/squid_size_spec.rb | 15 +++++++++++++++ types/size.pp | 1 + 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 spec/type_aliases/squid_size_spec.rb create mode 100644 types/size.pp diff --git a/manifests/init.pp b/manifests/init.pp index 998e0c4..66caa91 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,6 +1,6 @@ class squid ( String $access_log = $squid::params::access_log, - Pattern[/\d+ MB/] $cache_mem = $squid::params::cache_mem, + Squid::Size $cache_mem = $squid::params::cache_mem, String $config = $squid::params::config, String $config_group = $squid::params::config_group, String $config_user = $squid::params::config_user, @@ -8,7 +8,7 @@ String $daemon_user = $squid::params::daemon_user, Boolean $enable_service = $squid::params::enable_service, String $ensure_service = $squid::params::ensure_service, - Pattern[/\d+ KB/] $maximum_object_size_in_memory = $squid::params::maximum_object_size_in_memory, + Squid::Size $maximum_object_size_in_memory = $squid::params::maximum_object_size_in_memory, String $package_name = $squid::params::package_name, String $service_name = $squid::params::service_name, Optional[Stdlib::Absolutepath] $error_directory = $squid::params::error_directory, diff --git a/spec/type_aliases/squid_size_spec.rb b/spec/type_aliases/squid_size_spec.rb new file mode 100644 index 0000000..e09c890 --- /dev/null +++ b/spec/type_aliases/squid_size_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe 'Squid::Size' do + it { is_expected.to allow_value('1 KB') } + it { is_expected.to allow_value('1 MB') } + it { is_expected.to allow_value('10 KB') } + it { is_expected.to allow_value('9876543210 KB') } + it { is_expected.not_to allow_value('-1 KB') } + it { is_expected.not_to allow_value('1 kB') } + it { is_expected.not_to allow_value('1 Kb') } + it { is_expected.not_to allow_value('1 Mb') } + it { is_expected.not_to allow_value('1 KBB') } + it { is_expected.not_to allow_value('a KBB') } + it { is_expected.not_to allow_value('1KB') } +end diff --git a/types/size.pp b/types/size.pp new file mode 100644 index 0000000..14f42ae --- /dev/null +++ b/types/size.pp @@ -0,0 +1 @@ +type Squid::Size = Pattern[/^\d+ [KM]B$/] From 4a176da3ce4e8a746ed9a01b90afca3006a25863 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 16 Dec 2018 00:58:18 +0100 Subject: [PATCH 08/28] modulesync 2.3.1 --- .github/CONTRIBUTING.md | 15 +++++++++++++++ .msync.yml | 2 +- .pmtignore | 1 + .travis.yml | 24 ++++++++++++------------ Dockerfile | 21 +++++++++++++++++++++ Gemfile | 2 +- 6 files changed, 51 insertions(+), 14 deletions(-) create mode 100644 Dockerfile diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 832578e..4a51969 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -109,6 +109,21 @@ To run a specific spec test set the `SPEC` variable: bundle exec rake spec SPEC=spec/foo_spec.rb ``` +### Unit tests in docker + +Some people don't want to run the dependencies locally or don't want to install +ruby. We ship a Dockerfile that enables you to run all unit tests and linting. +You only need to run: + +```sh +docker build . +``` + +Please ensure that a docker daemon is running and that your user has the +permission to talk to it. You can specify a remote docker host by setting the +`DOCKER_HOST` environment variable. it will copy the content of the module into +the docker image. So it will not work if a Gemfile.lock exists. + ## Integration tests The unit tests just check the code runs, not that it does exactly what diff --git a/.msync.yml b/.msync.yml index 1d2221f..648cf24 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '2.2.0' +modulesync_config_version: '2.3.1' diff --git a/.pmtignore b/.pmtignore index fb58957..4e6d54b 100644 --- a/.pmtignore +++ b/.pmtignore @@ -18,3 +18,4 @@ Puppetfile.lock *.iml .*.sw? .yardoc/ +Dockerfile diff --git a/.travis.yml b/.travis.yml index 87886f8..9b56b7a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,73 +28,73 @@ matrix: - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian8-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian8-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=debian8-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1604-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required branches: diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..27a33cf --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM ruby:2.5.1 + +WORKDIR /opt/puppet + +# https://github.com/puppetlabs/puppet/blob/06ad255754a38f22fb3a22c7c4f1e2ce453d01cb/lib/puppet/provider/service/runit.rb#L39 +RUN mkdir -p /etc/sv + +ARG PUPPET_VERSION="~> 6.0" +ARG PARALLEL_TEST_PROCESSORS=4 + +# Cache gems +COPY Gemfile . +RUN bundle install --without system_tests development release --path=${BUNDLE_PATH:-vendor/bundle} + +COPY . . + +RUN bundle install +RUN bundle exec release_checks + +# Container should not saved +RUN exit 1 diff --git a/Gemfile b/Gemfile index 3c2b411..9648d7d 100644 --- a/Gemfile +++ b/Gemfile @@ -44,7 +44,7 @@ group :system_tests do if beaker_version = ENV['BEAKER_VERSION'] gem 'beaker', *location_for(beaker_version) else - gem 'beaker', '>= 3.9.0', :require => false + gem 'beaker', '>= 4.2.0', :require => false end if beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION'] gem 'beaker-rspec', *location_for(beaker_rspec_version) From a89b06f285e294022dc02ed5cb5f546ac7430c50 Mon Sep 17 00:00:00 2001 From: Thomas Equeter Date: Wed, 1 Aug 2018 11:57:51 +0200 Subject: [PATCH 09/28] bump stdlib to 4.25.0 for port types --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index a44e66c..76b71b2 100644 --- a/metadata.json +++ b/metadata.json @@ -30,7 +30,7 @@ }, { "name": "puppetlabs-stdlib", - "version_requirement": ">= 4.6.0 < 6.0.0" + "version_requirement": ">= 4.25.0 < 6.0.0" } ], "operatingsystem_support": [ From 37360d15cff20ceda9d0fcc1dd4e1a850e913a7c Mon Sep 17 00:00:00 2001 From: Thomas Equeter Date: Thu, 19 Jul 2018 17:39:13 +0200 Subject: [PATCH 10/28] support listening on specific interfaces This allows "http_port host:port" configuration constructs, instead of just specifying the port and listening on all interfaces. Pre-1.0.0 versions used to allow "host:port" as port/title arg, because the input wasn't sufficiently checked. --- README.md | 9 ++++- manifests/http_port.pp | 37 ++++++++++++++---- spec/defines/http_port_spec.rb | 69 ++++++++++++++++++++++++++++++---- templates/squid.conf.port.erb | 11 +++++- 4 files changed, 108 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 434f761..b468a47 100644 --- a/README.md +++ b/README.md @@ -299,6 +299,8 @@ 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 @@ -306,10 +308,15 @@ 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 for Type squid::http\_port -* `port` defaults to the namevar and is the port number. +* The title/namevar may be in the form `port` or `host:port` to provide the below values. Otherwise, + specify `port` explicitely, and `host` if desired. +* `port` defaults to the port of the namevar and is the port number to listen on. +* `host` defaults to the host part of the namevar and is the interface to listen on. If not specified, + Squid listens on all interfaces. * `options` A string to specify any options for the default. By default and empty string. * `ssl` A boolean. When set to `true` creates [https_port entries](http://www.squid-cache.org/Doc/config/https_port/). Defaults to `false`. diff --git a/manifests/http_port.pp b/manifests/http_port.pp index 55c9b06..55a4a70 100644 --- a/manifests/http_port.pp +++ b/manifests/http_port.pp @@ -1,24 +1,46 @@ define squid::http_port ( - Variant[Pattern[/\d+/], Integer] - $port = $title, - Boolean $ssl = false, - String $options = '', - String $order = '05', + Optional[Stdlib::Port] $port = undef, + Optional[Stdlib::Host] $host = undef, + Boolean $ssl = false, + String $options = '', + String $order = '05', ) { + $_title = String($title) + + if $port == undef { + if $_title =~ /^(?:.+:)?(\d+)$/ { + $_port = Integer($1) + if $_port !~ Stdlib::Port { + fail("invalid port determined from title: ${_port}") + } + } else { + fail("port couldn't be determined from title nor args") + } + } else { + $_port = $port + } + + # Only grab the host from the title if no port arg given and the title is + # very likely to mean host:port. This should be backward-compatible with + # client code from before this feature was introduced. + if $port == undef and $host == undef and $_title =~ /^(.+):\d+$/ { + $_host = $1 + } else { + $_host = $host # May be undef + } $protocol = $ssl ? { true => 'https', default => 'http', } - concat::fragment{"squid_${protocol}_port_${port}": + concat::fragment{"squid_${protocol}_port_${_title}": target => $squid::config, content => template('squid/squid.conf.port.erb'), order => "30-${order}", } if $facts['selinux'] == true { - $_port = Integer($port) selinux::port{"selinux port squid_port_t ${_port}": ensure => 'present', seltype => 'squid_port_t', @@ -28,4 +50,3 @@ } } - diff --git a/spec/defines/http_port_spec.rb b/spec/defines/http_port_spec.rb index 1e0c710..f5681e7 100644 --- a/spec/defines/http_port_spec.rb +++ b/spec/defines/http_port_spec.rb @@ -12,25 +12,80 @@ } ' end - let(:title) { '1000' } context 'when parameters are unset' do + let(:title) { '1000' } + 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*$}) } 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\s*$}) } + 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 title and port arg' do + let(:title) { 'host:1650' } + let(:params) do + { + port: 1650 + } + 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*$}) } + end + context 'when host and port parameters are set' do + let(:title) { 'test' } + let(:params) do + { + port: 1700, + host: '127.0.0.1' + } + end + + it { is_expected.to contain_concat_fragment('squid_http_port_test').with_content(%r{^http_port\s+127\.0\.0\.1:1700\s*$}) } + end context 'when parameters are set' do + let(:title) { 'my:test' } # Arguments shoud override title + let(:params) do + { + port: 2000, + options: 'special for 2000', + order: '08' + } + end + + it { is_expected.to contain_concat_fragment('squid_http_port_my:test').with_target('/tmp/squid.conf') } + 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: 2000, - options: 'special for 2000', - order: '08' + port: 2100, + host: 'host' } end - it { is_expected.to contain_concat_fragment('squid_http_port_2000').with_target('/tmp/squid.conf') } - it { is_expected.to contain_concat_fragment('squid_http_port_2000').with_order('30-08') } - it { is_expected.to contain_concat_fragment('squid_http_port_2000').with_content(%r{^http_port\s+2000\s+special for 2000$}) } + it { is_expected.to contain_concat_fragment('squid_http_port_my:test').with_content(%r{^http_port\s+host:2100\s*$}) } end context 'when ssl => true' do let(:title) { '3000' } diff --git a/templates/squid.conf.port.erb b/templates/squid.conf.port.erb index cd467a4..fae7e6e 100644 --- a/templates/squid.conf.port.erb +++ b/templates/squid.conf.port.erb @@ -1,3 +1,10 @@ -# fragment for <%= @protocol %>_port <%= @port %> -<%= @protocol %>_port <%= @port %> <%= @options %> +<% + if @_host == nil then + host_port = @_port + else + host_port = "#{@_host}:#{@_port}" + end +-%> +# fragment for <%= @protocol %>_port <%= host_port %> +<%= @protocol %>_port <%= host_port %> <%= @options %> From 43f1245ac28f421cc4417120c7af88a6a1156bba Mon Sep 17 00:00:00 2001 From: Thomas Equeter Date: Wed, 1 Aug 2018 14:42:15 +0200 Subject: [PATCH 11/28] convert http_port template to EPP --- manifests/http_port.pp | 7 ++++++- templates/squid.conf.port.epp | 15 +++++++++++++++ templates/squid.conf.port.erb | 10 ---------- 3 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 templates/squid.conf.port.epp delete mode 100644 templates/squid.conf.port.erb diff --git a/manifests/http_port.pp b/manifests/http_port.pp index 55a4a70..e2b040b 100644 --- a/manifests/http_port.pp +++ b/manifests/http_port.pp @@ -36,7 +36,12 @@ concat::fragment{"squid_${protocol}_port_${_title}": target => $squid::config, - content => template('squid/squid.conf.port.erb'), + content => epp('squid/squid.conf.port.epp', { + protocol => $protocol, + host => $_host, + port => $_port, + options => $options, + }), order => "30-${order}", } diff --git a/templates/squid.conf.port.epp b/templates/squid.conf.port.epp new file mode 100644 index 0000000..f4acabd --- /dev/null +++ b/templates/squid.conf.port.epp @@ -0,0 +1,15 @@ +<%- | String $protocol, + Stdlib::Port $port, + Optional[String[1]] $host, + String $options, + | -%> +<% + if $host == undef { + $_host_port = $port + } else { + $_host_port = "${host}:${port}" + } +-%> +# fragment for <%= $protocol %>_port <%= $_host_port %> +<%= $protocol %>_port <%= $_host_port %> <%= $options %> + diff --git a/templates/squid.conf.port.erb b/templates/squid.conf.port.erb deleted file mode 100644 index fae7e6e..0000000 --- a/templates/squid.conf.port.erb +++ /dev/null @@ -1,10 +0,0 @@ -<% - if @_host == nil then - host_port = @_port - else - host_port = "#{@_host}:#{@_port}" - end --%> -# fragment for <%= @protocol %>_port <%= host_port %> -<%= @protocol %>_port <%= host_port %> <%= @options %> - From b086fd19a5f47f440e134844fc2b687f30f8ea3e Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 26 Dec 2018 01:05:19 +0100 Subject: [PATCH 12/28] modulesync 2.4.0 --- .msync.yml | 2 +- .travis.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.msync.yml b/.msync.yml index 648cf24..fa528f5 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '2.3.1' +modulesync_config_version: '2.4.0' diff --git a/.travis.yml b/.travis.yml index 9b56b7a..3af7c19 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ --- sudo: false -dist: trusty +dist: xenial language: ruby cache: bundler before_install: From 486e8693fef0f5f96160b2ff01392180ae59248a Mon Sep 17 00:00:00 2001 From: Thomas Equeter Date: Sat, 22 Dec 2018 14:03:41 +0000 Subject: [PATCH 13/28] refactor the last two commits - Simplify the logic. - Check the title-provided host against Stdlib::Host. - Move the canonical host:port construction out of the template. - Provide separate values for title and host:port to the template. - Add three new testcases. --- manifests/http_port.pp | 41 +++++++++++++++++++--------------- spec/defines/http_port_spec.rb | 20 +++++++++++++++++ templates/squid.conf.port.epp | 17 +++++--------- 3 files changed, 48 insertions(+), 30 deletions(-) diff --git a/manifests/http_port.pp b/manifests/http_port.pp index e2b040b..1a532ab 100644 --- a/manifests/http_port.pp +++ b/manifests/http_port.pp @@ -7,26 +7,31 @@ ) { $_title = String($title) - if $port == undef { - if $_title =~ /^(?:.+:)?(\d+)$/ { - $_port = Integer($1) - if $_port !~ Stdlib::Port { - fail("invalid port determined from title: ${_port}") - } - } else { - fail("port couldn't be determined from title nor args") + # Try to extract host/port from title if neither were specified as + # parameters. Allowed formats: host:port and port. + if $host == undef and $port == undef and $_title =~ /^(?:(.+):)?(\d+)$/ { + $_host = $1 + if $_host !~ Optional[Stdlib::Host] { + fail("invalid host \"${_host}\" determined from title") + } + + $_port = Integer($2) + if $_port !~ Stdlib::Port { + fail("invalid port \"${_port}\" determined from title") } } else { + $_host = $host $_port = $port } - # Only grab the host from the title if no port arg given and the title is - # very likely to mean host:port. This should be backward-compatible with - # client code from before this feature was introduced. - if $port == undef and $host == undef and $_title =~ /^(.+):\d+$/ { - $_host = $1 + if $_port == undef { + fail('port parameter was not specified and could not be determined from title') + } + + if $_host != undef { + $_host_port = "${_host}:${_port}" } else { - $_host = $host # May be undef + $_host_port = String($_port) } $protocol = $ssl ? { @@ -37,10 +42,10 @@ concat::fragment{"squid_${protocol}_port_${_title}": target => $squid::config, content => epp('squid/squid.conf.port.epp', { - protocol => $protocol, - host => $_host, - port => $_port, - options => $options, + title => $_title, + protocol => $protocol, + host_port => $_host_port, + options => $options, }), order => "30-${order}", } diff --git a/spec/defines/http_port_spec.rb b/spec/defines/http_port_spec.rb index f5681e7..7a7a6f2 100644 --- a/spec/defines/http_port_spec.rb +++ b/spec/defines/http_port_spec.rb @@ -20,6 +20,11 @@ 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*$}) } 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' } @@ -40,6 +45,11 @@ 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 @@ -51,6 +61,16 @@ # 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*$}) } end + context 'without a port specified' do + let(:title) { 'garbage' } + let(:params) do + { + host: 'host' + } + end + + it { is_expected.not_to compile } + end context 'when host and port parameters are set' do let(:title) { 'test' } let(:params) do diff --git a/templates/squid.conf.port.epp b/templates/squid.conf.port.epp index f4acabd..3b558be 100644 --- a/templates/squid.conf.port.epp +++ b/templates/squid.conf.port.epp @@ -1,15 +1,8 @@ -<%- | String $protocol, - Stdlib::Port $port, - Optional[String[1]] $host, +<%- | String $title, + String $protocol, + String $host_port, String $options, | -%> -<% - if $host == undef { - $_host_port = $port - } else { - $_host_port = "${host}:${port}" - } --%> -# fragment for <%= $protocol %>_port <%= $_host_port %> -<%= $protocol %>_port <%= $_host_port %> <%= $options %> +# fragment for <%= $protocol %>_port <%= $title %> +<%= $protocol %>_port <%= $host_port %> <%= $options %> From dfb17499084dc84509f599e1e58a25e8c99cc659 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Sun, 6 Jan 2019 17:00:14 +0000 Subject: [PATCH 14/28] Fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b468a47..487c38c 100644 --- a/README.md +++ b/README.md @@ -313,7 +313,7 @@ http_port 127.0.0.1:3128 #### Parameters for Type squid::http\_port * The title/namevar may be in the form `port` or `host:port` to provide the below values. Otherwise, - specify `port` explicitely, and `host` if desired. + specify `port` explicitly, and `host` if desired. * `port` defaults to the port of the namevar and is the port number to listen on. * `host` defaults to the host part of the namevar and is the interface to listen on. If not specified, Squid listens on all interfaces. From 52fd5be25d4ff5aa63255e5188e9745609a1d760 Mon Sep 17 00:00:00 2001 From: George Cox Date: Mon, 21 Jan 2019 11:07:35 +0000 Subject: [PATCH 15/28] Added 'manage_dir' parameter to cache_dir --- README.md | 3 +++ manifests/cache_dir.pp | 15 +++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 434f761..b35e35f 100644 --- a/README.md +++ b/README.md @@ -163,6 +163,9 @@ endif * `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. +* `manage_dir` Boolean value, 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. ### Defined Type squid::cache Defines [cache entries](http://www.squid-cache.org/Doc/config/cache/) for a squid server. diff --git a/manifests/cache_dir.pp b/manifests/cache_dir.pp index 467be5c..283ce3b 100644 --- a/manifests/cache_dir.pp +++ b/manifests/cache_dir.pp @@ -4,6 +4,7 @@ String $options = '', Optional[Integer] $process_number = undef, String $order = '05', + Boolean $manage_dir = true, ) { concat::fragment{"squid_cache_dir_${path}": @@ -12,12 +13,14 @@ order => "50-${order}", } - file{$path: - ensure => directory, - owner => $::squid::daemon_user, - group => $::squid::daemon_group, - mode => '0750', - require => Package[$::squid::package_name], + if $manage_dir { + file{$path: + ensure => directory, + owner => $::squid::daemon_user, + group => $::squid::daemon_group, + mode => '0750', + require => Package[$::squid::package_name], + } } if $facts['selinux'] == true { From e00b972e82bb7648d9bc1315596f4c5985794f82 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 24 Jan 2019 23:40:59 +0100 Subject: [PATCH 16/28] modulesync 2.5.1 --- .github/PULL_REQUEST_TEMPLATE.md | 10 +++---- .msync.yml | 2 +- .travis.yml | 46 +++++++++++--------------------- .travis/setup.sh | 12 +++++++++ Gemfile | 16 +++++------ Rakefile | 19 +++++++++++-- spec/default_facts.yml | 13 --------- spec/spec_helper.rb | 14 ++++++---- 8 files changed, 66 insertions(+), 66 deletions(-) create mode 100644 .travis/setup.sh delete mode 100644 spec/default_facts.yml diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index ef25cdb..342807b 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -8,13 +8,13 @@ Thank you for contributing to this project! --> #### Pull Request (PR) description #### This Pull Request (PR) fixes the following issues diff --git a/.msync.yml b/.msync.yml index fa528f5..4c6463a 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '2.4.0' +modulesync_config_version: '2.5.1' diff --git a/.travis.yml b/.travis.yml index 3af7c19..45ec34b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,99 +1,83 @@ --- -sudo: false dist: xenial language: ruby cache: bundler before_install: - - rm -f Gemfile.lock + - sh ./.travis/setup.sh script: - 'bundle exec rake $CHECK' matrix: fast_finish: true include: - - rvm: 2.1.9 - bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 4.0" CHECK=test PARALLEL_TEST_PROCESSORS=12 - rvm: 2.4.4 bundler_args: --without system_tests development release env: PUPPET_VERSION="~> 5.0" CHECK=test - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without system_tests development release env: PUPPET_VERSION="~> 6.0" CHECK=test_with_coveralls - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without system_tests development release env: PUPPET_VERSION="~> 6.0" CHECK=rubocop - rvm: 2.4.4 bundler_args: --without system_tests development release env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required diff --git a/.travis/setup.sh b/.travis/setup.sh new file mode 100644 index 0000000..ae1a043 --- /dev/null +++ b/.travis/setup.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# THIS FILE IS MANAGED BY MODULESYNC + +rm -f Gemfile.lock +if [ "${PUPPET_VERSION}" = '~> 4.0' ]; then + gem install bundler -v '< 2' --no-rdoc --no-ri; +else + gem update --system; + gem update bundler; + bundle --version; +fi diff --git a/Gemfile b/Gemfile index 9648d7d..9524f1a 100644 --- a/Gemfile +++ b/Gemfile @@ -22,14 +22,12 @@ group :test do gem 'puppet-lint-variable_contains_upcase', :require => false gem 'metadata-json-lint', :require => false gem 'redcarpet', :require => false - gem 'rubocop', '~> 0.49.1', :require => false if RUBY_VERSION >= '2.3.0' - gem 'rubocop-rspec', '~> 1.15.0', :require => false if RUBY_VERSION >= '2.3.0' + gem 'rubocop', '~> 0.49.1', :require => false + gem 'rubocop-rspec', '~> 1.15.0', :require => false gem 'mocha', '~> 1.4.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false - gem 'rack', '~> 1.0', :require => false if RUBY_VERSION < '2.2.2' - gem 'parallel_tests', '2.24.0', :require => false if RUBY_VERSION < '2.2.0' - gem 'parallel_tests', :require => false if RUBY_VERSION >= '2.2.0' + gem 'parallel_tests', :require => false end group :development do @@ -57,13 +55,13 @@ group :system_tests do gem 'beaker-puppet', :require => false gem 'beaker-puppet_install_helper', :require => false gem 'beaker-module_install_helper', :require => false - gem 'rbnacl', '>= 4', :require => false if RUBY_VERSION >= '2.2.6' - gem 'rbnacl-libsodium', :require => false if RUBY_VERSION >= '2.2.6' + gem 'rbnacl', '>= 4', :require => false + gem 'rbnacl-libsodium', :require => false gem 'bcrypt_pbkdf', :require => false end group :release do - gem 'github_changelog_generator', :require => false, :git => 'https://github.com/github-changelog-generator/github-changelog-generator' if RUBY_VERSION >= '2.2.2' + gem 'github_changelog_generator', :require => false, :git => 'https://github.com/github-changelog-generator/github-changelog-generator' gem 'puppet-blacksmith', :require => false gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem' gem 'puppet-strings', '>= 1.0', :require => false @@ -77,7 +75,7 @@ else gem 'facter', :require => false, :groups => [:test] end -ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 5.0' : puppetversion = ENV['PUPPET_VERSION'].to_s +ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 6.0' : puppetversion = ENV['PUPPET_VERSION'].to_s gem 'puppet', puppetversion, :require => false, :groups => [:test] # vim: syntax=ruby diff --git a/Rakefile b/Rakefile index 279580a..13ef17c 100644 --- a/Rakefile +++ b/Rakefile @@ -37,12 +37,27 @@ RSpec::Core::RakeTask.new(:acceptance) do |t| t.pattern = 'spec/acceptance' end -desc 'Run tests metadata_lint, release_checks' +desc 'Run tests release_checks' task test: [ - :metadata_lint, :release_checks, ] +namespace :check do + desc 'Check for trailing whitespace' + task :trailing_whitespace do + Dir.glob('**/*.md', File::FNM_DOTMATCH).sort.each do |filename| + next if filename =~ %r{^((modules|acceptance|\.?vendor|spec/fixtures|pkg)/|REFERENCE.md)} + File.foreach(filename).each_with_index do |line, index| + if line =~ %r{\s\n$} + puts "#{filename} has trailing whitespace on line #{index + 1}" + exit 1 + end + end + end + end +end +Rake::Task[:release_checks].enhance ['check:trailing_whitespace'] + desc "Run main 'test' task and report merged results to coveralls" task test_with_coveralls: [:test] do if Dir.exist?(File.expand_path('../lib', __FILE__)) diff --git a/spec/default_facts.yml b/spec/default_facts.yml deleted file mode 100644 index 2f6698d..0000000 --- a/spec/default_facts.yml +++ /dev/null @@ -1,13 +0,0 @@ -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -# -# use default_module_facts.yaml for module specific -# facts. -# -# Hint if using with rspec-puppet-facts ("on_supported_os.each"): -# if a same named fact exists in facterdb it will be overridden. ---- -ipaddress: "172.16.254.254" -is_pe: false -macaddress: "AA:AA:AA:AA:AA:AA" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 88bca59..2f2279d 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -5,6 +5,15 @@ require 'rspec-puppet-facts' include RspecPuppetFacts +if File.exist?(File.join(__dir__, 'default_module_facts.yml')) + facts = YAML.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 + end +end + if Dir.exist?(File.expand_path('../../lib', __FILE__)) require 'coveralls' require 'simplecov' @@ -22,11 +31,6 @@ end RSpec.configure do |c| - default_facts = {} - default_facts.merge!(YAML.load(File.read(File.expand_path('../default_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_facts.yml', __FILE__)) - default_facts.merge!(YAML.load(File.read(File.expand_path('../default_module_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_module_facts.yml', __FILE__)) - c.default_facts = default_facts - # Coverage generation c.after(:suite) do RSpec::Puppet::Coverage.report! From 00614ceb0851b3093798bb48981ed646e95d538e Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 24 Jan 2019 23:46:55 +0100 Subject: [PATCH 17/28] drop puppet 4 --- README.md | 12 ++++++------ metadata.json | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 16ec8d8..6f04151 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ squid::http_access{ '!Safe_ports': action => deny, } ``` -This module will set the SELINUX-context for the cache_dir and/or port, requires [puppet-selinux](https://github.com/voxpupuli/puppet-selinux) +This module will set the SELINUX-context for the cache_dir and/or port, requires [puppet-selinux](https://github.com/voxpupuli/puppet-selinux) ### Parameters for squid Class Parameters to the squid class almost map 1 to 1 to squid.conf parameters themselves. @@ -163,7 +163,7 @@ endif * `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. -* `manage_dir` Boolean value, if true puppet will attempt to create the +* `manage_dir` Boolean value, 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. @@ -244,7 +244,7 @@ squid::snmp_access { 'monitoring hosts': } ``` -Adds a squid.conf line +Adds a squid.conf line ``` # snmp_access fragment for monitoring hosts @@ -276,7 +276,7 @@ squid::icp_access { 'our_networks hosts': } ``` -Adds a squid.conf line +Adds a squid.conf line ``` icp_access allow our_networks hosts @@ -477,7 +477,7 @@ squid::ssl_bump { 'all': } ``` -Adds a squid.conf line +Adds a squid.conf line ``` ssl_bump bump all @@ -499,7 +499,7 @@ squid::sslproxy_cert_error { 'all': } ``` -Adds a squid.conf line +Adds a squid.conf line ``` sslproxy_cert_error allow all diff --git a/metadata.json b/metadata.json index 76b71b2..71ea305 100644 --- a/metadata.json +++ b/metadata.json @@ -16,7 +16,7 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 4.10.0 < 7.0.0" + "version_requirement": ">= 5.5.8 < 7.0.0" } ], "dependencies": [ From c124132dd490408462c9eaea455607b865dc2e55 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 24 Jan 2019 23:57:48 +0100 Subject: [PATCH 18/28] allow puppet6 to fail --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 45ec34b..28ef5df 100644 --- a/.travis.yml +++ b/.travis.yml @@ -81,6 +81,8 @@ matrix: env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required + allow_failures: + - env: BEAKER_PUPPET_COLLECTION=puppet6-nightly branches: only: - master From 880e5216afa02125e1dc7e2375e768e534306163 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 25 Jan 2019 00:06:27 +0100 Subject: [PATCH 19/28] drop sudo keyword --- .travis.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 28ef5df..545218b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,62 +25,50 @@ matrix: bundler_args: --without development release env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - rvm: 2.5.3 bundler_args: --without development release env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - rvm: 2.5.3 bundler_args: --without development release env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - rvm: 2.5.3 bundler_args: --without development release env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - rvm: 2.5.3 bundler_args: --without development release env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - rvm: 2.5.3 bundler_args: --without development release env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - rvm: 2.5.3 bundler_args: --without development release env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - rvm: 2.5.3 bundler_args: --without development release env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - rvm: 2.5.3 bundler_args: --without development release env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - rvm: 2.5.3 bundler_args: --without development release env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - rvm: 2.5.3 bundler_args: --without development release env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - rvm: 2.5.3 bundler_args: --without development release env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required allow_failures: - env: BEAKER_PUPPET_COLLECTION=puppet6-nightly branches: From e59a8c7a4bb60db823b751c5d4985b276a0ed33c Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Wed, 6 Feb 2019 13:27:01 +0100 Subject: [PATCH 20/28] Release 2.0.0 --- CHANGELOG.md | 33 +++++++++++++++++++++++++++++++-- metadata.json | 2 +- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23f0a9f..9e1a171 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,36 @@ All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module. -## [v1.1.0](https://github.com/voxpupuli/puppet-squid/tree/v1.1.0) (2018-05-15) +## [v2.0.0](https://github.com/voxpupuli/puppet-squid/tree/v2.0.0) (2019-02-06) + +[Full Changelog](https://github.com/voxpupuli/puppet-squid/compare/v1.1.0...v2.0.0) + +**Breaking changes:** + +- modulesync 2.5.1 and drop Puppet4 [\#118](https://github.com/voxpupuli/puppet-squid/pull/118) ([bastelfreak](https://github.com/bastelfreak)) +- support listening on specific interfaces; changed params in squid::http\_port{} [\#103](https://github.com/voxpupuli/puppet-squid/pull/103) ([tequeter](https://github.com/tequeter)) +- Fix `url\_rewrite\_program` [\#101](https://github.com/voxpupuli/puppet-squid/pull/101) ([SourceDoctor](https://github.com/SourceDoctor)) + +**Implemented enhancements:** + +- Added 'manage\_dir' parameter to cache\_dir [\#116](https://github.com/voxpupuli/puppet-squid/pull/116) ([GeorgeCox](https://github.com/GeorgeCox)) +- Add a Squid::Size type [\#112](https://github.com/voxpupuli/puppet-squid/pull/112) ([ekohl](https://github.com/ekohl)) +- modulesync 2.2.0 and allow puppet 6.x [\#109](https://github.com/voxpupuli/puppet-squid/pull/109) ([bastelfreak](https://github.com/bastelfreak)) +- Allow puppetlabs/stdlib 5.x and puppetlabs/concat 5.x [\#106](https://github.com/voxpupuli/puppet-squid/pull/106) ([bastelfreak](https://github.com/bastelfreak)) + +**Closed issues:** + +- ssl::server\_name syntax error [\#117](https://github.com/voxpupuli/puppet-squid/issues/117) +- cache\_dir on mounted filesystem [\#108](https://github.com/voxpupuli/puppet-squid/issues/108) + +**Merged pull requests:** + +- Use strings not symbols with beaker-puppet `fact\(\)` [\#111](https://github.com/voxpupuli/puppet-squid/pull/111) ([alexjfisher](https://github.com/alexjfisher)) +- Update README.md [\#110](https://github.com/voxpupuli/puppet-squid/pull/110) ([AndreasPfaffeneder](https://github.com/AndreasPfaffeneder)) +- drop EOL OSs; fix puppet version range [\#100](https://github.com/voxpupuli/puppet-squid/pull/100) ([bastelfreak](https://github.com/bastelfreak)) +- use gitrepos in .fixtures.yml [\#99](https://github.com/voxpupuli/puppet-squid/pull/99) ([bastelfreak](https://github.com/bastelfreak)) + +## [v1.1.0](https://github.com/voxpupuli/puppet-squid/tree/v1.1.0) (2018-05-16) [Full Changelog](https://github.com/voxpupuli/puppet-squid/compare/v1.0.0...v1.1.0) @@ -134,4 +163,4 @@ class{'squid: ## 2016-04-13 - Release 0.1.0 -\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* +\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)* diff --git a/metadata.json b/metadata.json index 71ea305..47de2f8 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-squid", - "version": "1.1.1-rc0", + "version": "2.0.0", "author": "Vox Pupuli", "summary": "configure squid caching proxy", "license": "Apache-2.0", From 1ce39e2ef92516c7aa3fd466a7ba6bac5172b609 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Wed, 6 Feb 2019 13:49:10 +0100 Subject: [PATCH 21/28] [blacksmith] Bump version to 2.0.1-rc0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 47de2f8..cd3fe91 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-squid", - "version": "2.0.0", + "version": "2.0.1-rc0", "author": "Vox Pupuli", "summary": "configure squid caching proxy", "license": "Apache-2.0", From 488aaf00a9f8d0aee74a9898f7c7320cb40ac71d Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 8 Apr 2019 18:40:42 +0200 Subject: [PATCH 22/28] modulesync 2.7.0 --- .github/CONTRIBUTING.md | 6 +++--- .msync.yml | 2 +- .travis.yml | 22 +++------------------- Dockerfile | 2 +- Gemfile | 5 +++-- Rakefile | 41 ++++++++--------------------------------- spec/spec_helper.rb | 4 ++++ 7 files changed, 23 insertions(+), 59 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 4a51969..5d04747 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -51,19 +51,19 @@ You can install all needed gems for spec tests into the modules directory by running: ```sh -bundle install --path .vendor/ --without development --without system_tests --without release +bundle install --path .vendor/ --without development system_tests release ``` If you also want to run acceptance tests: ```sh -bundle install --path .vendor/ --without development --with system_tests --without release +bundle install --path .vendor/ --with system_tests --without development release ``` Our all in one solution if you don't know if you need to install or update gems: ```sh -bundle install --path .vendor/ --without development --with system_tests --without release; bundle update; bundle clean +bundle install --path .vendor/ --with system_tests --without development release; bundle update; bundle clean ``` ## Syntax and style diff --git a/.msync.yml b/.msync.yml index 4c6463a..5519891 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '2.5.1' +modulesync_config_version: '2.7.0' diff --git a/.travis.yml b/.travis.yml index 545218b..ecc6086 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,9 @@ dist: xenial language: ruby cache: bundler before_install: - - sh ./.travis/setup.sh + - gem update --system + - gem update bundler + - bundle --version script: - 'bundle exec rake $CHECK' matrix: @@ -29,10 +31,6 @@ matrix: bundler_args: --without development release env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker - services: docker - rvm: 2.5.3 bundler_args: --without development release env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker @@ -41,10 +39,6 @@ matrix: bundler_args: --without development release env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker - services: docker - rvm: 2.5.3 bundler_args: --without development release env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker @@ -53,10 +47,6 @@ matrix: bundler_args: --without development release env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker - services: docker - rvm: 2.5.3 bundler_args: --without development release env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker @@ -65,12 +55,6 @@ matrix: bundler_args: --without development release env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker - services: docker - allow_failures: - - env: BEAKER_PUPPET_COLLECTION=puppet6-nightly branches: only: - master diff --git a/Dockerfile b/Dockerfile index 27a33cf..67048bb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:2.5.1 +FROM ruby:2.5.3 WORKDIR /opt/puppet diff --git a/Gemfile b/Gemfile index 9524f1a..24dbb7f 100644 --- a/Gemfile +++ b/Gemfile @@ -11,7 +11,7 @@ def location_for(place, fake_version = nil) end group :test do - gem 'puppetlabs_spec_helper', '>= 2.11.0', :require => false + gem 'puppetlabs_spec_helper', '>= 2.14.0', :require => false gem 'rspec-puppet-facts', '>= 1.8.0', :require => false gem 'rspec-puppet-utils', :require => false gem 'puppet-lint-leading_zero-check', :require => false @@ -20,6 +20,7 @@ group :test do gem 'puppet-lint-classes_and_types_beginning_with_digits-check', :require => false gem 'puppet-lint-unquoted_string-check', :require => false gem 'puppet-lint-variable_contains_upcase', :require => false + gem 'puppet-lint-absolute_classname-check', :require => false gem 'metadata-json-lint', :require => false gem 'redcarpet', :require => false gem 'rubocop', '~> 0.49.1', :require => false @@ -64,7 +65,7 @@ group :release do gem 'github_changelog_generator', :require => false, :git => 'https://github.com/github-changelog-generator/github-changelog-generator' gem 'puppet-blacksmith', :require => false gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem' - gem 'puppet-strings', '>= 1.0', :require => false + gem 'puppet-strings', '>= 2.2', :require => false end diff --git a/Rakefile b/Rakefile index 13ef17c..09701d0 100644 --- a/Rakefile +++ b/Rakefile @@ -3,19 +3,12 @@ require 'puppetlabs_spec_helper/rake_tasks' # load optional tasks for releases # only available if gem group releases is installed begin - require 'puppet_blacksmith/rake_tasks' require 'voxpupuli/release/rake_tasks' - require 'puppet-strings/tasks' rescue LoadError end PuppetLint.configuration.log_format = '%{path}:%{line}:%{check}:%{KIND}:%{message}' -PuppetLint.configuration.fail_on_warnings = true -PuppetLint.configuration.send('relative') -PuppetLint.configuration.send('disable_140chars') -PuppetLint.configuration.send('disable_class_inherits_from_params_class') -PuppetLint.configuration.send('disable_documentation') -PuppetLint.configuration.send('disable_single_quote_string_with_variables') +PuppetLint.configuration.absolute_classname_reverse = true exclude_paths = %w( pkg/**/* @@ -28,8 +21,7 @@ PuppetSyntax.exclude_paths = exclude_paths desc 'Auto-correct puppet-lint offenses' task 'lint:auto_correct' do - PuppetLint.configuration.fix = true - Rake::Task[:lint].invoke + Rake::Task[:lint_fix].invoke end desc 'Run acceptance tests' @@ -37,10 +29,8 @@ RSpec::Core::RakeTask.new(:acceptance) do |t| t.pattern = 'spec/acceptance' end -desc 'Run tests release_checks' -task test: [ - :release_checks, -] +desc 'Run tests' +task test: [:release_checks] namespace :check do desc 'Check for trailing whitespace' @@ -69,25 +59,10 @@ task test_with_coveralls: [:test] do end end -desc "Print supported beaker sets" -task 'beaker_sets', [:directory] do |t, args| - directory = args[:directory] - - metadata = JSON.load(File.read('metadata.json')) - - (metadata['operatingsystem_support'] || []).each do |os| - (os['operatingsystemrelease'] || []).each do |release| - if directory - beaker_set = "#{directory}/#{os['operatingsystem'].downcase}-#{release}" - else - beaker_set = "#{os['operatingsystem'].downcase}-#{release}-x64" - end - - filename = "spec/acceptance/nodesets/#{beaker_set}.yml" - - puts beaker_set if File.exists? filename - end - end +desc 'Generate REFERENCE.md' +task :reference, [:debug, :backtrace] do |t, args| + patterns = '' + Rake::Task['strings:generate:reference'].invoke(patterns, args[:debug], args[:backtrace]) end begin diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 2f2279d..c53e703 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,6 +1,10 @@ # This file is managed via modulesync # https://github.com/voxpupuli/modulesync # https://github.com/voxpupuli/modulesync_config +RSpec.configure do |c| + c.mock_with :rspec +end + require 'puppetlabs_spec_helper/module_spec_helper' require 'rspec-puppet-facts' include RspecPuppetFacts From 531f85e7b80443225023d6f2831cee5a18d7574c Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 8 Apr 2019 18:57:42 +0200 Subject: [PATCH 23/28] puppet-lint: fix relative_classname_inclusion --- manifests/init.pp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 66caa91..8fd335e 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -49,9 +49,9 @@ ) inherits ::squid::params { anchor{'squid::begin':} - -> class{'::squid::install':} - -> class{'::squid::config':} - ~> class{'::squid::service':} + -> class{'squid::install':} + -> class{'squid::config':} + ~> class{'squid::service':} -> anchor{'squid::end':} } From bd582a28f1158992aaef498a024d21f5898ec1c9 Mon Sep 17 00:00:00 2001 From: Thode Jocelyn Date: Thu, 11 Apr 2019 16:08:08 +0200 Subject: [PATCH 24/28] Validate squid config before applying changes --- README.md | 1 + manifests/config.pp | 12 +++++++----- manifests/init.pp | 1 + manifests/params.pp | 4 ++++ spec/classes/init_spec.rb | 5 +++++ 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6f04151..8536884 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,7 @@ Parameters to the squid class almost map 1 to 1 to squid.conf parameters themsel * `ssl_bump` defaults to undef. If you pass in a hash of ssl_bump entries, they will be defined automatically. [ssl_bump entries](http://www.squid-cache.org/Doc/config/ssl_bump/). * `sslproxy_cert_error` defaults to undef. If you pass in a hash of sslproxy_cert_error entries, they will be defined automatically. [sslproxy_cert_error entries](http://www.squid-cache.org/Doc/config/sslproxy_cert_error/). * `extra_config_sections` defaults to empty hash. If you pass in a hash of `extra_config_section` resources, they will be defined automatically. +* `squid_bin_path` path to the squid binary, default depends on `$operatingsystem` ```puppet class { 'squid': diff --git a/manifests/config.pp b/manifests/config.pp index d25e54a..1476207 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -37,13 +37,15 @@ $cache_dirs = $::squid::cache_dirs, $cache = $::squid::cache, $extra_config_sections = $::squid::extra_config_sections, + $squid_bin_path = $::squid::squid_bin_path, ) inherits squid { - concat{$config: - ensure => present, - owner => $config_user, - group => $config_group, - mode => '0640', + concat { $config: + ensure => present, + owner => $config_user, + group => $config_group, + mode => '0640', + validate_cmd => "${squid_bin_path} -k parse -f %", } concat::fragment{'squid_header': diff --git a/manifests/init.pp b/manifests/init.pp index 8fd335e..c048672 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -11,6 +11,7 @@ Squid::Size $maximum_object_size_in_memory = $squid::params::maximum_object_size_in_memory, String $package_name = $squid::params::package_name, String $service_name = $squid::params::service_name, + Stdlib::Absolutepath $squid_bin_path = $squid::params::squid_bin_path, Optional[Stdlib::Absolutepath] $error_directory = $squid::params::error_directory, Optional[Stdlib::Absolutepath] $err_page_stylesheet = $squid::params::err_page_stylesheet, Optional[String] $cache_replacement_policy = $squid::params::cache_replacement_policy, diff --git a/manifests/params.pp b/manifests/params.pp index 81b2047..5d0c384 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -49,12 +49,14 @@ $service_name = 'squid3' $config = '/etc/squid3/squid.conf' $access_log = 'daemon:/var/log/squid3/access.log squid' + $squid_bin_path = '/usr/sbin/squid3' } default: { $package_name = 'squid' $service_name = 'squid' $config = '/etc/squid/squid.conf' $access_log = 'daemon:/var/log/squid/access.log squid' + $squid_bin_path = '/usr/sbin/squid' } } @@ -72,6 +74,7 @@ $access_log = 'daemon:/var/log/squid/access.log squid' $daemon_user = 'squid' $daemon_group = 'squid' + $squid_bin_path = '/usr/sbin/squid' } default: { $package_name = 'squid' @@ -82,6 +85,7 @@ $access_log = 'daemon:/var/log/squid/access.log squid' $daemon_user = 'squid' $daemon_group = 'squid' + $squid_bin_path = '/usr/sbin/squid' } } } diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index f5a4c62..a298a7f 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -18,6 +18,10 @@ facts[:osfamily] == 'Debian' ? 'root' : 'squid' end + let(:squid_bin_path) do + %w[jessie trusty].include?(facts[:lsbdistcodename]) ? '/usr/sbin/squid3' : '/usr/sbin/squid' + end + context 'with defaults for all parameters' do it { is_expected.to contain_class('squid') } it { is_expected.to contain_class('squid::install') } @@ -28,6 +32,7 @@ it { is_expected.to contain_service(squid_name).with_ensure('running') } it { is_expected.to contain_concat("#{etc_dir}/#{squid_name}/squid.conf").with_group(config_group) } it { is_expected.to contain_concat("#{etc_dir}/#{squid_name}/squid.conf").with_owner('root') } + it { is_expected.to contain_concat("#{etc_dir}/#{squid_name}/squid.conf").with_validate_cmd("#{squid_bin_path} -k parse -f %") } it { is_expected.to contain_concat_fragment('squid_header').with_target("#{etc_dir}/#{squid_name}/squid.conf") } it { is_expected.to contain_concat_fragment('squid_header').with_content(%r{^access_log\s+daemon:/var/log/#{squid_name}/access.log\s+squid$}) } it { is_expected.to contain_concat_fragment('squid_header').with_content(%r{^cache_mem\s+256 MB$}) } From 590c79d9cb4667347e383f52b26a4d6237593de4 Mon Sep 17 00:00:00 2001 From: Fabien COMBERNOUS Date: Fri, 3 May 2019 14:43:57 +0200 Subject: [PATCH 25/28] release 2.1.0 --- CHANGELOG.md | 8 ++++++++ metadata.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e1a171..43a6316 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module. +## [v2.1.0](https://github.com/voxpupuli/puppet-squid/tree/v2.1.0) (2019-05-03) + +[Full Changelog](https://github.com/voxpupuli/puppet-squid/compare/v2.0.0...v2.1.0) + +**Implemented enhancements:** + +- Validate squid config before applying changes [\#123](https://github.com/voxpupuli/puppet-squid/pull/123) ([alexjfisher](https://github.com/alexjfisher)) + ## [v2.0.0](https://github.com/voxpupuli/puppet-squid/tree/v2.0.0) (2019-02-06) [Full Changelog](https://github.com/voxpupuli/puppet-squid/compare/v1.1.0...v2.0.0) diff --git a/metadata.json b/metadata.json index cd3fe91..a4a3e76 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-squid", - "version": "2.0.1-rc0", + "version": "2.1.0", "author": "Vox Pupuli", "summary": "configure squid caching proxy", "license": "Apache-2.0", From 1c00286fa81ac60583b18a8837321fe77cd7e13c Mon Sep 17 00:00:00 2001 From: Fabien COMBERNOUS Date: Fri, 3 May 2019 15:23:58 +0200 Subject: [PATCH 26/28] [blacksmith] Bump version to 2.1.1-rc0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index a4a3e76..b04ee97 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-squid", - "version": "2.1.0", + "version": "2.1.1-rc0", "author": "Vox Pupuli", "summary": "configure squid caching proxy", "license": "Apache-2.0", From a463ecab0f44085aeb4307de8837bf57efc3f973 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Wed, 8 May 2019 11:13:03 +0100 Subject: [PATCH 27/28] Allow `puppetlabs/stdlib` 6.x stdlib 6.0.0 is due to be released soon. This module has already dropped support for puppet 4 and/or doesn't use the updated stdlib `merge` function. See https://github.com/puppetlabs/puppetlabs-stdlib/blob/217068f97edd2396ce37ac8c1bd7e23da621d6be/CHANGELOG.md#supported-release-600 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index b04ee97..69ee54f 100644 --- a/metadata.json +++ b/metadata.json @@ -30,7 +30,7 @@ }, { "name": "puppetlabs-stdlib", - "version_requirement": ">= 4.25.0 < 6.0.0" + "version_requirement": ">= 4.25.0 < 7.0.0" } ], "operatingsystem_support": [ From 5e569732f0685ce3d43c7e883e305db6b8e730f7 Mon Sep 17 00:00:00 2001 From: Victor Cabezas Date: Fri, 10 May 2019 15:57:57 +0200 Subject: [PATCH 28/28] Create pkgensure type --- manifests/init.pp | 2 +- manifests/install.pp | 4 ++-- manifests/params.pp | 2 +- types/pkgensure.pp | 4 ++++ 4 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 types/pkgensure.pp diff --git a/manifests/init.pp b/manifests/init.pp index 2464a04..d4c5f97 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -10,7 +10,7 @@ String $ensure_service = $squid::params::ensure_service, Pattern[/\d+ KB/] $maximum_object_size_in_memory = $squid::params::maximum_object_size_in_memory, String $package_name = $squid::params::package_name, - String $package_ensure = $squid::params::package_ensure, + Squid::PkgEnsure $package_ensure = $squid::params::package_ensure, String $service_name = $squid::params::service_name, Optional[Stdlib::Absolutepath] $error_directory = $squid::params::error_directory, Optional[Stdlib::Absolutepath] $err_page_stylesheet = $squid::params::err_page_stylesheet, diff --git a/manifests/install.pp b/manifests/install.pp index 8125ab9..82e9655 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -2,8 +2,8 @@ class squid::install { - package{$::squid::package_name: - ensure => $::squid::package_ensure, + package{$squid::package_name: + ensure => $squid::package_ensure, } } diff --git a/manifests/params.pp b/manifests/params.pp index 0cdb659..f0a6c95 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -38,7 +38,7 @@ $logformat = undef $error_directory = undef $err_page_stylesheet = undef - $package_ensure = present + $package_ensure = 'present' case $::operatingsystem { /^(Debian|Ubuntu)$/: { diff --git a/types/pkgensure.pp b/types/pkgensure.pp new file mode 100644 index 0000000..0ac03b1 --- /dev/null +++ b/types/pkgensure.pp @@ -0,0 +1,4 @@ +type Squid::PkgEnsure = Variant[ + Pattern[/^\d.*/], + Enum['present', 'latest', 'absent', 'purged'], +]