From 3215104ed2b456ad44b719af3886cd9b607db357 Mon Sep 17 00:00:00 2001 From: Pavel Sapezhko Date: Tue, 28 Sep 2021 15:50:46 +0200 Subject: [PATCH 01/19] Add special rule format for keyring type policy --- lib/puppet/provider/consul_policy/default.rb | 2 +- lib/puppet/type/consul_policy.rb | 4 ++-- spec/unit/puppet/type/consul_policy_spec.rb | 15 +++++++++++++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/lib/puppet/provider/consul_policy/default.rb b/lib/puppet/provider/consul_policy/default.rb index be864ddc..c3b04797 100644 --- a/lib/puppet/provider/consul_policy/default.rb +++ b/lib/puppet/provider/consul_policy/default.rb @@ -43,7 +43,7 @@ def self.encode_rules(rules) encoded = [] rules.each do |rule| - if ['acl', 'operator'].include?(rule['resource']) + if ['acl', 'operator', 'keyring'].include?(rule['resource']) encoded.push("#{rule['resource']} = \"#{rule['disposition']}\"") else encoded.push("#{rule['resource']} \"#{rule['segment']}\" {\n policy = \"#{rule['disposition']}\"\n}") diff --git a/lib/puppet/type/consul_policy.rb b/lib/puppet/type/consul_policy.rb index aa760a03..d73ea7bd 100644 --- a/lib/puppet/type/consul_policy.rb +++ b/lib/puppet/type/consul_policy.rb @@ -33,11 +33,11 @@ raise ArgumentError, 'Policy rule must be a hash' unless value.is_a?(Hash) raise ArgumentError, 'Policy rule needs to specify a resource' unless value.key?('resource') - raise ArgumentError, 'Policy rule needs to specify a segment' unless value.key?('segment') || ['acl', 'operator'].include?(value['resource']) + raise ArgumentError, 'Policy rule needs to specify a segment' unless value.key?('segment') || ['acl', 'operator', 'keyring'].include?(value['resource']) raise ArgumentError, 'Policy rule needs to specify a disposition' unless value.key?('disposition') raise ArgumentError, 'Policy rule resource must be a string' unless value['resource'].is_a?(String) - raise ArgumentError, 'Policy rule segment must be a string' unless value['segment'].is_a?(String) || ['acl', 'operator'].include?(value['resource']) + raise ArgumentError, 'Policy rule segment must be a string' unless value['segment'].is_a?(String) || ['acl', 'operator', 'keyring'].include?(value['resource']) raise ArgumentError, 'Policy rule disposition must be a string' unless value['disposition'].is_a?(String) end diff --git a/spec/unit/puppet/type/consul_policy_spec.rb b/spec/unit/puppet/type/consul_policy_spec.rb index 9d628b59..20105951 100644 --- a/spec/unit/puppet/type/consul_policy_spec.rb +++ b/spec/unit/puppet/type/consul_policy_spec.rb @@ -96,7 +96,7 @@ }.to raise_error(Puppet::Error, %r{Policy rule disposition must be a string}) end - context 'resource is acl or operator' do + context 'resource is acl, operator or keyring' do it 'passes if rule segment is missing' do expect { Puppet::Type.type(:consul_policy).new( @@ -121,6 +121,17 @@ }, ], ) + Puppet::Type.type(:consul_policy).new( + name: 'testing', + id: '39c75e12-7f43-0a40-dfba-9aa3fcda08d4', + description: 'test description', + rules: [ + { + 'resource' => 'keyring', + 'disposition' => 'read' + }, + ], + ) }.not_to raise_error end @@ -142,7 +153,7 @@ end end - context 'resource is neither acl nor operator' do + context 'resource is neither acl nor operator nor keyring' do it 'fails if rule segment is missing' do expect { Puppet::Type.type(:consul_policy).new( From 014223ad2c688957625b3824ba6980caee7f3a34 Mon Sep 17 00:00:00 2001 From: Pavel Sapezhko Date: Tue, 28 Sep 2021 16:13:16 +0200 Subject: [PATCH 02/19] Fix test for default params Fix test for default values of user and group parameter. Test was broken in d9b59cf. --- spec/classes/init_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 1e512ee8..65fba88c 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -241,7 +241,7 @@ end context 'By default, a user and group should be installed' do - it { is_expected.to contain_user('consul').with(ensure: :present).with_home('/opt/consul') } + it { is_expected.to contain_user('consul').with(ensure: :present) } it { is_expected.to contain_group('consul').with(ensure: :present) } end From 9ccdfad4056a0da96f3534b5dc6103ae5c1a834d Mon Sep 17 00:00:00 2001 From: Pavel Sapezhko Date: Tue, 28 Sep 2021 16:16:29 +0200 Subject: [PATCH 03/19] Run spec test on CI After migrating to github actions `spec` clause for rake command was missed --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 483479a5..6f709699 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,7 +48,7 @@ jobs: ruby-version: ${{ matrix.ruby }} bundler-cache: true - name: Run tests - run: bundle exec rake + run: bundle exec rake spec acceptance: needs: setup_matrix From 0574abe3923a02cdf02faa224b9291b312c51853 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 7 Jan 2022 13:03:40 +0100 Subject: [PATCH 04/19] Switch from camptocamp/systemd to puppet/systemd The module got migrated to a new namespace --- metadata.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metadata.json b/metadata.json index f4ced4f1..b106a241 100644 --- a/metadata.json +++ b/metadata.json @@ -9,8 +9,8 @@ "issues_url": "https://github.com/solarkennedy/puppet-consul/issues", "dependencies": [ { - "name": "camptocamp/systemd", - "version_requirement": ">= 3.0.0 < 4.0.0" + "name": "puppet/systemd", + "version_requirement": ">= 3.1.0 < 4.0.0" }, { "name": "puppet/archive", From 87931aea303ef53546117c5d0da9b2ec41d2ed83 Mon Sep 17 00:00:00 2001 From: Brennan Jones Date: Thu, 14 Apr 2022 15:40:02 -0400 Subject: [PATCH 05/19] Adding datacenters property for Consul policies --- lib/puppet/provider/consul_policy/default.rb | 18 +++++++++++------- lib/puppet/type/consul_policy.rb | 9 +++++++++ types/policystruct.pp | 1 + 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/lib/puppet/provider/consul_policy/default.rb b/lib/puppet/provider/consul_policy/default.rb index c3b04797..7ace3c51 100644 --- a/lib/puppet/provider/consul_policy/default.rb +++ b/lib/puppet/provider/consul_policy/default.rb @@ -75,7 +75,8 @@ def initialize(messages, client = nil, rules_encoded = '', existing_policy = nil if existing_policy @property_hash = { id: existing_policy.id, - description: existing_policy.description + description: existing_policy.description, + datacenters: existing_policy.datacenters } if rules_encoded == existing_policy.rules @@ -107,14 +108,15 @@ def flush end unless @existing_policy - policy = ConsulPolicy.new(nil, @resource[:name], @resource[:description], @rules_encoded) + policy = ConsulPolicy.new(nil, @resource[:name], @resource[:description], @resource[:datacenters], @rules_encoded) @client.create_policy(policy, @resource[:api_tries]) @resource[:id] = policy.id Puppet.notice("Created Consul ACL policy #{policy.name} with ID #{policy.id}") end - if @existing_policy && (@existing_policy.description != @resource[:description] || @existing_policy.rules != @rules_encoded) + if @existing_policy && (@existing_policy.description != @resource[:description] || @existing_policy.datacenters != @resource[:datacenters] || @existing_policy.rules != @rules_encoded) @existing_policy.description = @resource[:description] + @existing_policy.datacenters = @resource[:datacenters] @existing_policy.rules = @rules_encoded @client.update_policy(@existing_policy) @@ -129,13 +131,14 @@ def self.reset end class ConsulPolicy - attr_reader :id, :name, :description, :rules - attr_writer :id, :rules, :description + attr_reader :id, :name, :description, :datacenters, :rules + attr_writer :id, :rules, :description, :datacenters - def initialize(id, name, description, rules) + def initialize(id, name, description, datacenters, rules) @id = id @name = name @description = description + @datacenters = datacenters @rules = rules end end @@ -151,7 +154,7 @@ def get_all_policies(max_tries) collection = [] response.each do |item| - collection.push(ConsulPolicy.new(item['ID'], item['Name'], item['Description'], nil)) + collection.push(ConsulPolicy.new(item['ID'], item['Name'], item['Description'], item['Datacenters'], nil)) end collection @@ -193,6 +196,7 @@ def create_body(policy) body = {} body.store('Name', policy.name) body.store('Description', policy.description) + body.store('Datacenters', policy.datacenters) body.store('Rules', policy.rules) body diff --git a/lib/puppet/type/consul_policy.rb b/lib/puppet/type/consul_policy.rb index d73ea7bd..935e177e 100644 --- a/lib/puppet/type/consul_policy.rb +++ b/lib/puppet/type/consul_policy.rb @@ -27,6 +27,15 @@ end end + newproperty(:datacenters, array_matching: :all) do + desc 'List of datacenter names assigned to the policy' + validate do |value| + raise ArgumentError, 'Datacenter name list must be an array of strings' unless value.is_a?(String) + end + + defaultto [] + end + newproperty(:rules, array_matching: :all) do desc 'List of ACL rules for this policy' validate do |value| diff --git a/types/policystruct.pp b/types/policystruct.pp index 1f7697fc..7e99b8fd 100644 --- a/types/policystruct.pp +++ b/types/policystruct.pp @@ -3,6 +3,7 @@ id => Optional[String[1]], ensure => Optional[Enum['present', 'absent']], description => Optional[String[0]], + datacenters => Optional[Array[String]], rules => Optional[Array[Struct[{ resource => String[1], segment => Optional[String[0]], From befbe0d054f91e07d616de969afa95621330e8e8 Mon Sep 17 00:00:00 2001 From: Brennan Jones Date: Sun, 17 Apr 2022 23:02:10 -0400 Subject: [PATCH 06/19] fixing tests after addition of datacenters property to policies and adding tests for the datacenters property --- .../puppet/provider/consul_policy_spec.rb | 47 +++++++++++++++++-- spec/unit/puppet/type/consul_policy_spec.rb | 12 +++++ types/policystruct.pp | 2 +- 3 files changed, 57 insertions(+), 4 deletions(-) diff --git a/spec/unit/puppet/provider/consul_policy_spec.rb b/spec/unit/puppet/provider/consul_policy_spec.rb index a426ab04..fe21f715 100644 --- a/spec/unit/puppet/provider/consul_policy_spec.rb +++ b/spec/unit/puppet/provider/consul_policy_spec.rb @@ -7,6 +7,7 @@ { name: 'test_policy', description: 'test description', + datacenters: ['testdc'], rules: [ { 'resource' => 'service_prefix', @@ -139,12 +140,13 @@ 'ID' => 'ce6c53fb-aebd-4acb-b108-b65d4ea67853', 'Name' => 'test_policy', 'Description' => 'Test description', + 'Datacenters' => ['testdc'], 'Rules' => [] } stub_request(:put, 'http://localhost:8500/v1/acl/policy') .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }, - body: '{"Name":"test_policy","Description":"test description","Rules":"service_prefix \\"test_service\\" {\\n policy = \\"read\\"\\n}\\n\\nkey \\"test_key\\" {\\n policy = \\"write\\"\\n}"}') + body: '{"Name":"test_policy","Description":"test description","Datacenters":["testdc"],"Rules":"service_prefix \\"test_service\\" {\\n policy = \\"read\\"\\n}\\n\\nkey \\"test_key\\" {\\n policy = \\"write\\"\\n}"}') .to_return(status: 200, body: JSON.dump(create_response), headers: {}) resource[:id] = '' @@ -163,6 +165,7 @@ 'ID' => '02298dc3-e1cd-e031-b2c8-ec3023702b20', 'Name' => 'test_policy', 'Description' => 'other description', + 'Datacenters' => ['testdc'], }, ] @@ -182,7 +185,43 @@ stub_request(:put, 'http://localhost:8500/v1/acl/policy/02298dc3-e1cd-e031-b2c8-ec3023702b20') .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }, - body: '{"Name":"test_policy","Description":"test description","Rules":"service_prefix \\"test_service\\" {\\n policy = \\"read\\"\\n}\\n\\nkey \\"test_key\\" {\\n policy = \\"write\\"\\n}"}') + body: '{"Name":"test_policy","Description":"test description","Datacenters":["testdc"],"Rules":"service_prefix \\"test_service\\" {\\n policy = \\"read\\"\\n}\\n\\nkey \\"test_key\\" {\\n policy = \\"write\\"\\n}"}') + .to_return(status: 200, body: JSON.dump(update_response), headers: {}) + + resource[:id] = '' + described_class.prefetch(resources) + described_class.reset + resource.provider.create + resource.provider.flush + end + + it 'if datacenters do not match"' do + list_response = [ + { + 'ID' => '02298dc3-e1cd-e031-b2c8-ec3023702b20', + 'Name' => 'test_policy', + 'Description' => 'test description', + 'Datacenters' => ['otherdc'], + }, + ] + + stub_request(:get, 'http://localhost:8500/v1/acl/policies') + .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) + .to_return(status: 200, body: JSON.dump(list_response), headers: {}) + + policy_response = list_response.first + policy_response['Rules'] = described_class.encode_rules(resource[:rules]) + + stub_request(:get, 'http://localhost:8500/v1/acl/policy/02298dc3-e1cd-e031-b2c8-ec3023702b20') + .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) + .to_return(status: 200, body: JSON.dump(policy_response), headers: {}) + + update_response = policy_response + update_response['Datacenters'] = ['testdc'] + + stub_request(:put, 'http://localhost:8500/v1/acl/policy/02298dc3-e1cd-e031-b2c8-ec3023702b20') + .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }, + body: '{"Name":"test_policy","Description":"test description","Datacenters":["testdc"],"Rules":"service_prefix \\"test_service\\" {\\n policy = \\"read\\"\\n}\\n\\nkey \\"test_key\\" {\\n policy = \\"write\\"\\n}"}') .to_return(status: 200, body: JSON.dump(update_response), headers: {}) resource[:id] = '' @@ -198,6 +237,7 @@ 'ID' => '02298dc3-e1cd-e031-b2c8-ec3023702b20', 'Name' => 'test_policy', 'Description' => 'test description', + 'Datacenters' => ['testdc'], }, ] @@ -217,7 +257,7 @@ stub_request(:put, 'http://localhost:8500/v1/acl/policy/02298dc3-e1cd-e031-b2c8-ec3023702b20') .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }, - body: '{"Name":"test_policy","Description":"test description","Rules":"service_prefix \\"test_service\\" {\\n policy = \\"read\\"\\n}\\n\\nkey \\"test_key\\" {\\n policy = \\"write\\"\\n}"}') + body: '{"Name":"test_policy","Description":"test description","Datacenters":["testdc"],"Rules":"service_prefix \\"test_service\\" {\\n policy = \\"read\\"\\n}\\n\\nkey \\"test_key\\" {\\n policy = \\"write\\"\\n}"}') .to_return(status: 200, body: JSON.dump(update_response), headers: {}) resource[:id] = '' @@ -233,6 +273,7 @@ 'ID' => '02298dc3-e1cd-e031-b2c8-ec3023702b20', 'Name' => 'test_policy', 'Description' => 'test description', + 'Datacenters' => ['testdc'], }, ] diff --git a/spec/unit/puppet/type/consul_policy_spec.rb b/spec/unit/puppet/type/consul_policy_spec.rb index 20105951..3853e9cd 100644 --- a/spec/unit/puppet/type/consul_policy_spec.rb +++ b/spec/unit/puppet/type/consul_policy_spec.rb @@ -19,6 +19,12 @@ }.to raise_error(Puppet::Error, %r{Description must be a string}) end + it 'fails if datacenters list is not an array' do + expect { + Puppet::Type.type(:consul_policy).new(name: 'foo', datacenters: [[]]) + }.to raise_error(Puppet::Error, %r{Datacenter name list must be an array of strings}) + end + it 'fails if rules is not a hash' do expect { Puppet::Type.type(:consul_policy).new( @@ -201,12 +207,14 @@ 'disposition' => 'write' }, ] + datacenters = ['testdc'] before :each do @policy = Puppet::Type.type(:consul_policy).new( name: 'testing', id: '39c75e12-7f43-0a40-dfba-9aa3fcda08d4', description: 'test description', + datacenters: datacenters, rules: rules, ) end @@ -219,6 +227,10 @@ expect(@policy[:description]).to eq('test description') end + it 'accepts datacenters' do + expect(@policy[:datacenters]).to eq(datacenters) + end + it 'accepts rules' do expect(@policy[:rules]).to eq(rules) end diff --git a/types/policystruct.pp b/types/policystruct.pp index 7e99b8fd..5dc09a8c 100644 --- a/types/policystruct.pp +++ b/types/policystruct.pp @@ -3,7 +3,7 @@ id => Optional[String[1]], ensure => Optional[Enum['present', 'absent']], description => Optional[String[0]], - datacenters => Optional[Array[String]], + datacenters => Optional[Array[String[1]]], rules => Optional[Array[Struct[{ resource => String[1], segment => Optional[String[0]], From 86ee44ad8f4d292eb9286112a4535ac6aef649d6 Mon Sep 17 00:00:00 2001 From: Brennan Jones Date: Tue, 19 Apr 2022 09:19:24 -0400 Subject: [PATCH 07/19] updating README.md for consul version compatibility --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2f5aec27..4e31da9a 100644 --- a/README.md +++ b/README.md @@ -33,8 +33,9 @@ new versions of consul. Pin to the version that works for your setup! | Consul Version | Recommended Puppet Module Version | | ---------------- | ----------------------------------- | -| >= 1.1.0 | >= 4.0.0 | -| 1.1.0- 0.9.0 | <= 3.4.2 | +| >= 1.11.x | >= 6.0.0 | +| 1.1.0-1.10.x | 4.0.0-7.0.x | +| 0.9-1.1.0 | <= 3.4.2 | | 0.8.x | <= 3.2.4 | | 0.7.0 | <= 2.1.1 | | 0.6.0 | <= 2.1.1 | From 5ce99b98c5b96777a75ae575bf122107173be52d Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 19 Apr 2022 09:00:12 +0200 Subject: [PATCH 08/19] modulesync 5.2.0 --- .editorconfig | 15 + .fixtures.yml | 6 +- .github/CONTRIBUTING.md | 251 +++++++++++++++ .github/ISSUE_TEMPLATE.md | 26 ++ .github/PULL_REQUEST_TEMPLATE.md | 20 ++ .github/SECURITY.md | 3 + .github/workflows/ci.yml | 85 +---- .github/workflows/release.yml | 22 ++ .gitignore | 48 ++- .msync.yml | 5 + .overcommit.yml | 65 ++++ .pdkignore | 45 --- .pmtignore | 37 +++ .puppet-lint.rc | 3 +- .rspec | 5 +- .rspec_parallel | 3 + .rubocop.yml | 523 +------------------------------ .sync.yml | 94 +----- .yardopts | 1 - Dockerfile | 24 ++ Gemfile | 108 ++----- Rakefile | 134 ++++---- manifests/init.pp | 2 +- spec/default_facts.yml | 8 - spec/spec_helper.rb | 65 +--- spec/spec_helper_acceptance.rb | 6 +- tests/init.pp | 25 -- 27 files changed, 621 insertions(+), 1008 deletions(-) create mode 100644 .editorconfig create mode 100644 .github/CONTRIBUTING.md create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/SECURITY.md create mode 100644 .github/workflows/release.yml create mode 100644 .msync.yml create mode 100644 .overcommit.yml delete mode 100644 .pdkignore create mode 100644 .pmtignore delete mode 100644 .yardopts create mode 100644 Dockerfile delete mode 100644 spec/default_facts.yml delete mode 100644 tests/init.pp diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..ecb10a80 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +# editorconfig.org + +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-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/.fixtures.yml b/.fixtures.yml index e5bcc0b0..d4b907f5 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -6,8 +6,4 @@ fixtures: systemd: "https://github.com/camptocamp/puppet-systemd.git" apt: "https://github.com/puppetlabs/puppetlabs-apt.git" yum: "https://github.com/voxpupuli/puppet-yum.git" - yumrepo_core: - repo: "https://github.com/puppetlabs/puppetlabs-yumrepo_core.git" - puppet_version: ">= 6.0.0" - symlinks: - consul: "#{source_dir}" + yumrepo_core: "https://github.com/puppetlabs/puppetlabs-yumrepo_core.git" diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 00000000..8b466cfb --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,251 @@ +# Contribution guidelines + +## Table of contents + +* [Contributing](#contributing) +* [Writing proper commits - short version](#writing-proper-commits-short-version) +* [Writing proper commits - long version](#writing-proper-commits-long-version) +* [Dependencies](#dependencies) + * [Note for OS X users](#note-for-os-x-users) +* [The test matrix](#the-test-matrix) +* [Syntax and style](#syntax-and-style) +* [Running the unit tests](#running-the-unit-tests) +* [Unit tests in docker](#unit-tests-in-docker) +* [Integration tests](#integration-tests) + +This module has grown over time based on a range of contributions from +people using it. If you follow these contributing guidelines your patch +will likely make it into a release a little more quickly. + +## Contributing + +Please note that this project is released with a Contributor Code of Conduct. +By participating in this project you agree to abide by its terms. +[Contributor Code of Conduct](https://voxpupuli.org/coc/). + +* Fork the repo. +* Create a separate branch for your change. +* We only take pull requests with passing tests, and documentation. [GitHub Actions](https://docs.github.com/en/actions) run the tests for us. You can also execute them locally. This is explained [in a later section](#the-test-matrix). +* Checkout [our docs](https://voxpupuli.org/docs/reviewing_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. +* 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. +* Squash your commits down into logical components. Make sure to rebase against our current master. +* Push the branch to your fork and submit a pull request. + +Please be prepared to repeat some of these steps as our contributors review your code. + +Also consider sending in your profile code that calls this component module as an acceptance test or provide it via an issue. This helps reviewers a lot to test your use case and prevents future regressions! + +## Writing proper commits - short version + +* Make commits of logical units. +* Check for unnecessary whitespace with "git diff --check" before committing. +* Commit using Unix line endings (check the settings around "crlf" in git-config(1)). +* Do not check in commented out code or unneeded files. +* The first line of the commit message should be a short description (50 characters is the soft limit, excluding ticket number(s)), and should skip the full stop. +* Associate the issue in the message. The first line should include the issue number in the form "(#XXXX) Rest of message". +* The body should provide a meaningful commit message, which: + *uses the imperative, present tense: `change`, not `changed` or `changes`. + * includes motivation for the change, and contrasts its implementation with the previous behavior. + * Make sure that you have tests for the bug you are fixing, or feature you are adding. + * Make sure the test suites passes after your commit: + * When introducing a new feature, make sure it is properly documented in the README.md + +## Writing proper commits - long version + + 1. Make separate commits for logically separate changes. + + Please break your commits down into logically consistent units + which include new or changed tests relevant to the rest of the + change. The goal of doing this is to make the diff easier to + read for whoever is reviewing your code. In general, the easier + your diff is to read, the more likely someone will be happy to + review it and get it into the code base. + + If you are going to refactor a piece of code, please do so as a + separate commit from your feature or bug fix changes. + + We also really appreciate changes that include tests to make + sure the bug is not re-introduced, and that the feature is not + accidentally broken. + + Describe the technical detail of the change(s). If your + description starts to get too long, that is a good sign that you + probably need to split up your commit into more finely grained + pieces. + + Commits which plainly describe the things which help + reviewers check the patch and future developers understand the + code are much more likely to be merged in with a minimum of + bike-shedding or requested changes. Ideally, the commit message + would include information, and be in a form suitable for + inclusion in the release notes for the version of Puppet that + includes them. + + Please also check that you are not introducing any trailing + whitespace or other "whitespace errors". You can do this by + running "git diff --check" on your changes before you commit. + + 2. Sending your patches + + To submit your changes via a GitHub pull request, we _highly_ + recommend that you have them on a topic branch, instead of + directly on `master`. + It makes things much easier to keep track of, especially if + you decide to work on another thing before your first change + is merged in. + + GitHub has some pretty good + [general documentation](http://help.github.com/) on using + their site. They also have documentation on + [creating pull requests](http://help.github.com/send-pull-requests/). + + In general, after pushing your topic branch up to your + repository on GitHub, you can switch to the branch in the + GitHub UI and click "Pull Request" towards the top of the page + in order to open a pull request. + + + 3. Update the related GitHub issue. + + If there is a GitHub issue associated with the change you + submitted, then you should update the ticket to include the + location of your branch, along with any other commentary you + may wish to make. + +## Dependencies + +The testing and development tools have a bunch of dependencies, +all managed by [bundler](http://bundler.io/) according to the +[Puppet support matrix](http://docs.puppetlabs.com/guides/platforms.html#ruby-versions). + +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: + +```sh +export PUPPET_GEM_VERSION="~> 6.1.0" +``` + +You can install all needed gems for spec tests into the modules directory by +running: + +```sh +bundle install --path .vendor/ --without development system_tests release --jobs "$(nproc)" +``` + +If you also want to run acceptance tests: + +```sh +bundle install --path .vendor/ --with system_tests --without development release --jobs "$(nproc)" +``` + +Our all in one solution if you don't know if you need to install or update gems: + +```sh +bundle install --path .vendor/ --with system_tests --without development release --jobs "$(nproc)"; bundle update; bundle clean +``` + +As an alternative to the `--jobs "$(nproc)` parameter, you can set an +environment variable: + +```sh +BUNDLE_JOBS="$(nproc)" +``` + +### Note for OS X users + +`nproc` isn't a valid command under OS x. As an alternative, you can do: + +```sh +--jobs "$(sysctl -n hw.ncpu)" +``` + +## The test matrix + +### Syntax and style + +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: + +```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: + +```sh +bundle exec rake rubocop +``` + +### Running the unit tests + +The unit test suite covers most of the code, as mentioned above please +add tests if you're adding new functionality. If you've not used +[rspec-puppet](http://rspec-puppet.com/) before then feel free to ask +about how best to test your new feature. + +To run the linter, the syntax checker and the unit tests: + +```sh +bundle exec rake test +``` + +To run your all the unit tests + +```sh +bundle exec rake spec +``` + +To run a specific spec test set the `SPEC` variable: + +```sh +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 +we want on a real machine. For that we're using +[beaker](https://github.com/puppetlabs/beaker). + +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: + +```sh +BEAKER_setfile=debian11-64 bundle exec rake beaker +``` + +You can replace the string `debian10` with any common operating system. +The following strings are known to work: + +* ubuntu1804 +* ubuntu2004 +* debian10 +* debian11 +* centos7 +* centos8 + +For more information and tips & tricks, see [voxpupuli-acceptance's documentation](https://github.com/voxpupuli/voxpupuli-acceptance#running-tests). + +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/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 00000000..593e7aa8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,26 @@ + + +## Affected Puppet, Ruby, OS and module versions/distributions + +- Puppet: +- Ruby: +- Distribution: +- Module version: + +## How to reproduce (e.g Puppet code you use) + +## What are you seeing + +## What behaviour did you expect instead + +## Output log + +## Any additional information you'd like to impart diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..342807bc --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,20 @@ + +#### Pull Request (PR) description + + +#### This Pull Request (PR) fixes the following issues + diff --git a/.github/SECURITY.md b/.github/SECURITY.md new file mode 100644 index 00000000..cacadf22 --- /dev/null +++ b/.github/SECURITY.md @@ -0,0 +1,3 @@ +# Vox Pupuli Security Policy + +Our vulnerabilities reporting process is at https://voxpupuli.org/security/ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f709699..8a077911 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,77 +1,18 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + name: CI on: pull_request -jobs: - setup_matrix: - name: 'Setup Test Matrix' - runs-on: ubuntu-latest - timeout-minutes: 40 - outputs: - beaker_setfiles: ${{ steps.get-outputs.outputs.beaker_setfiles }} - puppet_major_versions: ${{ steps.get-outputs.outputs.puppet_major_versions }} - puppet_unit_test_matrix: ${{ steps.get-outputs.outputs.puppet_unit_test_matrix }} - # env: - # BUNDLE_WITHOUT: development:release - steps: - - uses: actions/checkout@v2 - - name: Setup ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '2.7' - bundler-cache: true - - name: Run rake validate - run: bundle exec rake validate - # - name: Run rake rubocop - # run: bundle exec rake rubocop - - name: Setup Test Matrix - id: get-outputs - run: bundle exec metadata2gha --use-fqdn --pidfile-workaround CentOS,Ubuntu - - unit: - needs: setup_matrix - runs-on: ubuntu-latest - timeout-minutes: 40 - strategy: - fail-fast: false - matrix: - include: ${{fromJson(needs.setup_matrix.outputs.puppet_unit_test_matrix)}} - env: - # BUNDLE_WITHOUT: development:system_tests:release - PUPPET_VERSION: "~> ${{ matrix.puppet }}.0" - name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }}) - steps: - - uses: actions/checkout@v2 - - name: Setup ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true - - name: Run tests - run: bundle exec rake spec +concurrency: + group: ${{ github.ref_name }} + cancel-in-progress: true - acceptance: - needs: setup_matrix - runs-on: ubuntu-latest - env: - LANG: en_US - LC_ALL: en_US.UTF-8 - # BUNDLE_WITHOUT: development:test:release - strategy: - fail-fast: false - matrix: - setfile: ${{fromJson(needs.setup_matrix.outputs.beaker_setfiles)}} - puppet: ${{fromJson(needs.setup_matrix.outputs.puppet_major_versions)}} - name: ${{ matrix.puppet.name }} - ${{ matrix.setfile.name }} - steps: - - uses: actions/checkout@v2 - - name: Setup ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '2.7' - bundler-cache: true - - name: Run tests - run: bundle exec rake beaker - env: - BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet.collection }} - BEAKER_setfile: ${{ matrix.setfile.value }} +jobs: + puppet: + name: Puppet + uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v1 + with: + pidfile_workaround: 'false' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..15f17213 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,22 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +name: Release + +on: + push: + tags: + - '*' + +jobs: + release: + name: Release + uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v1 + with: + allowed_owner: 'voxpupuli' + secrets: + # Configure secrets here: + # https://docs.github.com/en/actions/security-guides/encrypted-secrets + username: ${{ secrets.PUPPET_FORGE_USERNAME }} + api_key: ${{ secrets.PUPPET_FORGE_API_KEY }} diff --git a/.gitignore b/.gitignore index 2767022c..9b95224c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,27 +1,23 @@ -.git/ -.*.sw[op] -.metadata -.yardoc -.yardwarns +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +pkg/ +Gemfile.lock +Gemfile.local +vendor/ +.vendor/ +spec/fixtures/manifests/ +spec/fixtures/modules/ +.vagrant/ +.bundle/ +.ruby-version +coverage/ +log/ +.idea/ +.dependencies/ +.librarian/ +Puppetfile.lock *.iml -/.bundle/ -/.idea/ -/.vagrant/ -/coverage/ -/bin/ -/doc/ -/Gemfile.local -/Gemfile.lock -/junit/ -/log/ -/pkg/ -/spec/fixtures/manifests/ -/spec/fixtures/modules/ -/tmp/ -/vendor/ -/convert_report.txt -/update_report.txt -.DS_Store -.project -.envrc -/inventory.yaml +.*.sw? +.yardoc/ +Guardfile diff --git a/.msync.yml b/.msync.yml new file mode 100644 index 00000000..968a9367 --- /dev/null +++ b/.msync.yml @@ -0,0 +1,5 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +modulesync_config_version: '5.2.0' diff --git a/.overcommit.yml b/.overcommit.yml new file mode 100644 index 00000000..d367adae --- /dev/null +++ b/.overcommit.yml @@ -0,0 +1,65 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ +# +# Hooks are only enabled if you take action. +# +# To enable the hooks run: +# +# ``` +# bundle exec overcommit --install +# # ensure .overcommit.yml does not harm to you and then +# bundle exec overcommit --sign +# ``` +# +# (it will manage the .git/hooks directory): +# +# Examples howto skip a test for a commit or push: +# +# ``` +# SKIP=RuboCop git commit +# SKIP=PuppetLint git commit +# SKIP=RakeTask git push +# ``` +# +# Don't invoke overcommit at all: +# +# ``` +# OVERCOMMIT_DISABLE=1 git commit +# ``` +# +# Read more about overcommit: https://github.com/brigade/overcommit +# +# To manage this config yourself in your module add +# +# ``` +# .overcommit.yml: +# unmanaged: true +# ``` +# +# to your modules .sync.yml config +--- +PreCommit: + RuboCop: + enabled: true + description: 'Runs rubocop on modified files only' + command: ['bundle', 'exec', 'rubocop'] + PuppetLint: + enabled: true + description: 'Runs puppet-lint on modified files only' + command: ['bundle', 'exec', 'puppet-lint'] + YamlSyntax: + enabled: true + JsonSyntax: + enabled: true + TrailingWhitespace: + enabled: true + +PrePush: + RakeTarget: + enabled: true + description: 'Run rake targets' + targets: + - 'validate' + - 'test' + - 'rubocop' + command: ['bundle', 'exec', 'rake'] diff --git a/.pdkignore b/.pdkignore deleted file mode 100644 index a74c4c4f..00000000 --- a/.pdkignore +++ /dev/null @@ -1,45 +0,0 @@ -.git/ -.*.sw[op] -.metadata -.yardoc -.yardwarns -*.iml -/.bundle/ -/.idea/ -/.vagrant/ -/coverage/ -/bin/ -/doc/ -/Gemfile.local -/Gemfile.lock -/junit/ -/log/ -/pkg/ -/spec/fixtures/manifests/ -/spec/fixtures/modules/ -/tmp/ -/vendor/ -/convert_report.txt -/update_report.txt -.DS_Store -.project -.envrc -/inventory.yaml -/appveyor.yml -/.fixtures.yml -/Gemfile -/.gitattributes -/.gitignore -/.gitlab-ci.yml -/.pdkignore -/.puppet-lint.rc -/Rakefile -/rakelib/ -/.rspec -/.rubocop.yml -/.travis.yml -/.yardopts -/spec/ -/.vscode/ -/.sync.yml -/.devcontainer/ diff --git a/.pmtignore b/.pmtignore new file mode 100644 index 00000000..65f50514 --- /dev/null +++ b/.pmtignore @@ -0,0 +1,37 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +docs/ +pkg/ +Gemfile +Gemfile.lock +Gemfile.local +vendor/ +.vendor/ +spec/ +Rakefile +.vagrant/ +.bundle/ +.ruby-version +coverage/ +log/ +.idea/ +.dependencies/ +.github/ +.librarian/ +Puppetfile.lock +*.iml +.editorconfig +.fixtures.yml +.gitignore +.msync.yml +.overcommit.yml +.pmtignore +.rspec +.rspec_parallel +.rubocop.yml +.sync.yml +.*.sw? +.yardoc/ +.yardopts +Dockerfile diff --git a/.puppet-lint.rc b/.puppet-lint.rc index e5cc4f8d..dd8272c7 100644 --- a/.puppet-lint.rc +++ b/.puppet-lint.rc @@ -1,2 +1,3 @@ --fail-on-warnings ---relative +--no-parameter_documentation-check +--no-parameter_types-check diff --git a/.rspec b/.rspec index 16f9cdb0..f634583d 100644 --- a/.rspec +++ b/.rspec @@ -1,2 +1,5 @@ ---color +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + --format documentation +--color diff --git a/.rspec_parallel b/.rspec_parallel index e4d136b7..a9a84f85 100644 --- a/.rspec_parallel +++ b/.rspec_parallel @@ -1 +1,4 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + --format progress diff --git a/.rubocop.yml b/.rubocop.yml index 8f782e74..53ac1898 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,519 +1,6 @@ --- -require: -- rubocop-performance -- rubocop-rspec -AllCops: - DisplayCopNames: true - TargetRubyVersion: '2.4' - Include: - - "**/*.rb" - Exclude: - - bin/* - - ".vendor/**/*" - - "**/Gemfile" - - "**/Rakefile" - - pkg/**/* - - spec/fixtures/**/* - - vendor/**/* - - "**/Puppetfile" - - "**/Vagrantfile" - - "**/Guardfile" -Layout/LineLength: - Description: People have wide screens, use them. - Max: 200 -RSpec/BeforeAfterAll: - Description: Beware of using after(:all) as it may cause state to leak between tests. - A necessary evil in acceptance testing. - Exclude: - - spec/acceptance/**/*.rb -RSpec/HookArgument: - Description: Prefer explicit :each argument, matching existing module's style - EnforcedStyle: each -RSpec/DescribeSymbol: - Exclude: - - spec/unit/facter/**/*.rb -Style/BlockDelimiters: - Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to - be consistent then. - EnforcedStyle: braces_for_chaining -Style/ClassAndModuleChildren: - Description: Compact style reduces the required amount of indentation. - EnforcedStyle: compact -Style/EmptyElse: - Description: Enforce against empty else clauses, but allow `nil` for clarity. - EnforcedStyle: empty -Style/FormatString: - Description: Following the main puppet project's style, prefer the % format format. - EnforcedStyle: percent -Style/FormatStringToken: - Description: Following the main puppet project's style, prefer the simpler template - tokens over annotated ones. - EnforcedStyle: template -Style/Lambda: - Description: Prefer the keyword for easier discoverability. - EnforcedStyle: literal -Style/RegexpLiteral: - Description: Community preference. See https://github.com/voxpupuli/modulesync_config/issues/168 - EnforcedStyle: percent_r -Style/TernaryParentheses: - Description: Checks for use of parentheses around ternary conditions. Enforce parentheses - on complex expressions for better readability, but seriously consider breaking - it up. - EnforcedStyle: require_parentheses_when_complex -Style/TrailingCommaInArguments: - Description: Prefer always trailing comma on multiline argument lists. This makes - diffs, and re-ordering nicer. - EnforcedStyleForMultiline: comma -Style/TrailingCommaInArrayLiteral: - Description: Prefer always trailing comma on multiline literals. This makes diffs, - and re-ordering nicer. - EnforcedStyleForMultiline: comma -Style/SymbolArray: - Description: Using percent style obscures symbolic intent of array's contents. - EnforcedStyle: brackets -RSpec/MessageSpies: - EnforcedStyle: receive -Style/Documentation: - Exclude: - - lib/puppet/parser/functions/**/* - - spec/**/* -Style/WordArray: - EnforcedStyle: brackets -Performance/AncestorsInclude: - Enabled: true -Performance/BigDecimalWithNumericArgument: - Enabled: true -Performance/BlockGivenWithExplicitBlock: - Enabled: true -Performance/CaseWhenSplat: - Enabled: true -Performance/ConstantRegexp: - Enabled: true -Performance/MethodObjectAsBlock: - Enabled: true -Performance/RedundantSortBlock: - Enabled: true -Performance/RedundantStringChars: - Enabled: true -Performance/ReverseFirst: - Enabled: true -Performance/SortReverse: - Enabled: true -Performance/Squeeze: - Enabled: true -Performance/StringInclude: - Enabled: true -Performance/Sum: - Enabled: true -Style/CollectionMethods: - Enabled: true -Style/MethodCalledOnDoEndBlock: - Enabled: true -Style/StringMethods: - Enabled: true -Bundler/InsecureProtocolSource: - Enabled: false -Gemspec/DuplicatedAssignment: - Enabled: false -Gemspec/OrderedDependencies: - Enabled: false -Gemspec/RequiredRubyVersion: - Enabled: false -Gemspec/RubyVersionGlobalsUsage: - Enabled: false -Layout/ArgumentAlignment: - Enabled: false -Layout/BeginEndAlignment: - Enabled: false -Layout/ClosingHeredocIndentation: - Enabled: false -Layout/EmptyComment: - Enabled: false -Layout/EmptyLineAfterGuardClause: - Enabled: false -Layout/EmptyLinesAroundArguments: - Enabled: false -Layout/EmptyLinesAroundAttributeAccessor: - Enabled: false -Layout/EndOfLine: - Enabled: false -Layout/FirstArgumentIndentation: - Enabled: false -Layout/HashAlignment: - Enabled: false -Layout/HeredocIndentation: - Enabled: false -Layout/LeadingEmptyLines: - Enabled: false -Layout/SpaceAroundMethodCallOperator: - Enabled: false -Layout/SpaceInsideArrayLiteralBrackets: - Enabled: false -Layout/SpaceInsideReferenceBrackets: - Enabled: false -Lint/BigDecimalNew: - Enabled: false -Lint/BooleanSymbol: - Enabled: false -Lint/ConstantDefinitionInBlock: - Enabled: false -Lint/DeprecatedOpenSSLConstant: - Enabled: false -Lint/DisjunctiveAssignmentInConstructor: - Enabled: false -Lint/DuplicateElsifCondition: - Enabled: false -Lint/DuplicateRequire: - Enabled: false -Lint/DuplicateRescueException: - Enabled: false -Lint/EmptyConditionalBody: - Enabled: false -Lint/EmptyFile: - Enabled: false -Lint/ErbNewArguments: - Enabled: false -Lint/FloatComparison: - Enabled: false -Lint/HashCompareByIdentity: - Enabled: false -Lint/IdentityComparison: - Enabled: false -Lint/InterpolationCheck: - Enabled: false -Lint/MissingCopEnableDirective: - Enabled: false -Lint/MixedRegexpCaptureTypes: - Enabled: false -Lint/NestedPercentLiteral: - Enabled: false -Lint/NonDeterministicRequireOrder: - Enabled: false -Lint/OrderedMagicComments: - Enabled: false -Lint/OutOfRangeRegexpRef: - Enabled: false -Lint/RaiseException: - Enabled: false -Lint/RedundantCopEnableDirective: - Enabled: false -Lint/RedundantRequireStatement: - Enabled: false -Lint/RedundantSafeNavigation: - Enabled: false -Lint/RedundantWithIndex: - Enabled: false -Lint/RedundantWithObject: - Enabled: false -Lint/RegexpAsCondition: - Enabled: false -Lint/ReturnInVoidContext: - Enabled: false -Lint/SafeNavigationConsistency: - Enabled: false -Lint/SafeNavigationWithEmpty: - Enabled: false -Lint/SelfAssignment: - Enabled: false -Lint/SendWithMixinArgument: - Enabled: false -Lint/ShadowedArgument: - Enabled: false -Lint/StructNewOverride: - Enabled: false -Lint/ToJSON: - Enabled: false -Lint/TopLevelReturnWithArgument: - Enabled: false -Lint/TrailingCommaInAttributeDeclaration: - Enabled: false -Lint/UnreachableLoop: - Enabled: false -Lint/UriEscapeUnescape: - Enabled: false -Lint/UriRegexp: - Enabled: false -Lint/UselessMethodDefinition: - Enabled: false -Lint/UselessTimes: - Enabled: false -Metrics/AbcSize: - Enabled: false -Metrics/BlockLength: - Enabled: false -Metrics/BlockNesting: - Enabled: false -Metrics/ClassLength: - Enabled: false -Metrics/CyclomaticComplexity: - Enabled: false -Metrics/MethodLength: - Enabled: false -Metrics/ModuleLength: - Enabled: false -Metrics/ParameterLists: - Enabled: false -Metrics/PerceivedComplexity: - Enabled: false -Migration/DepartmentName: - Enabled: false -Naming/AccessorMethodName: - Enabled: false -Naming/BlockParameterName: - Enabled: false -Naming/HeredocDelimiterCase: - Enabled: false -Naming/HeredocDelimiterNaming: - Enabled: false -Naming/MemoizedInstanceVariableName: - Enabled: false -Naming/MethodParameterName: - Enabled: false -Naming/RescuedExceptionsVariableName: - Enabled: false -Naming/VariableNumber: - Enabled: false -Performance/BindCall: - Enabled: false -Performance/DeletePrefix: - Enabled: false -Performance/DeleteSuffix: - Enabled: false -Performance/InefficientHashSearch: - Enabled: false -Performance/UnfreezeString: - Enabled: false -Performance/UriDefaultParser: - Enabled: false -RSpec/Be: - Enabled: false -RSpec/Capybara/CurrentPathExpectation: - Enabled: false -RSpec/Capybara/FeatureMethods: - Enabled: false -RSpec/Capybara/VisibilityMatcher: - Enabled: false -RSpec/ContextMethod: - Enabled: false -RSpec/ContextWording: - Enabled: false -RSpec/DescribeClass: - Enabled: false -RSpec/EmptyHook: - Enabled: false -RSpec/EmptyLineAfterExample: - Enabled: false -RSpec/EmptyLineAfterExampleGroup: - Enabled: false -RSpec/EmptyLineAfterHook: - Enabled: false -RSpec/ExampleLength: - Enabled: false -RSpec/ExampleWithoutDescription: - Enabled: false -RSpec/ExpectChange: - Enabled: false -RSpec/ExpectInHook: - Enabled: false -RSpec/FactoryBot/AttributeDefinedStatically: - Enabled: false -RSpec/FactoryBot/CreateList: - Enabled: false -RSpec/FactoryBot/FactoryClassName: - Enabled: false -RSpec/HooksBeforeExamples: - Enabled: false -RSpec/ImplicitBlockExpectation: - Enabled: false -RSpec/ImplicitSubject: - Enabled: false -RSpec/LeakyConstantDeclaration: - Enabled: false -RSpec/LetBeforeExamples: - Enabled: false -RSpec/MissingExampleGroupArgument: - Enabled: false -RSpec/MultipleExpectations: - Enabled: false -RSpec/MultipleMemoizedHelpers: - Enabled: false -RSpec/MultipleSubjects: - Enabled: false -RSpec/NestedGroups: - Enabled: false -RSpec/PredicateMatcher: - Enabled: false -RSpec/ReceiveCounts: - Enabled: false -RSpec/ReceiveNever: - Enabled: false -RSpec/RepeatedExampleGroupBody: - Enabled: false -RSpec/RepeatedExampleGroupDescription: - Enabled: false -RSpec/RepeatedIncludeExample: - Enabled: false -RSpec/ReturnFromStub: - Enabled: false -RSpec/SharedExamples: - Enabled: false -RSpec/StubbedMock: - Enabled: false -RSpec/UnspecifiedException: - Enabled: false -RSpec/VariableDefinition: - Enabled: false -RSpec/VoidExpect: - Enabled: false -RSpec/Yield: - Enabled: false -Security/Open: - Enabled: false -Style/AccessModifierDeclarations: - Enabled: false -Style/AccessorGrouping: - Enabled: false -Style/AsciiComments: - Enabled: false -Style/BisectedAttrAccessor: - Enabled: false -Style/CaseLikeIf: - Enabled: false -Style/ClassEqualityComparison: - Enabled: false -Style/ColonMethodDefinition: - Enabled: false -Style/CombinableLoops: - Enabled: false -Style/CommentedKeyword: - Enabled: false -Style/Dir: - Enabled: false -Style/DoubleCopDisableDirective: - Enabled: false -Style/EmptyBlockParameter: - Enabled: false -Style/EmptyLambdaParameter: - Enabled: false -Style/Encoding: - Enabled: false -Style/EvalWithLocation: - Enabled: false -Style/ExpandPathArguments: - Enabled: false -Style/ExplicitBlockArgument: - Enabled: false -Style/ExponentialNotation: - Enabled: false -Style/FloatDivision: - Enabled: false -Style/FrozenStringLiteralComment: - Enabled: false -Style/GlobalStdStream: - Enabled: false -Style/HashAsLastArrayItem: - Enabled: false -Style/HashLikeCase: - Enabled: false -Style/HashTransformKeys: - Enabled: false -Style/HashTransformValues: - Enabled: false -Style/IfUnlessModifier: - Enabled: false -Style/KeywordParametersOrder: - Enabled: false -Style/MinMax: - Enabled: false -Style/MixinUsage: - Enabled: false -Style/MultilineWhenThen: - Enabled: false -Style/NegatedUnless: - Enabled: false -Style/NumericPredicate: - Enabled: false -Style/OptionalBooleanParameter: - Enabled: false -Style/OrAssignment: - Enabled: false -Style/RandomWithOffset: - Enabled: false -Style/RedundantAssignment: - Enabled: false -Style/RedundantCondition: - Enabled: false -Style/RedundantConditional: - Enabled: false -Style/RedundantFetchBlock: - Enabled: false -Style/RedundantFileExtensionInRequire: - Enabled: false -Style/RedundantRegexpCharacterClass: - Enabled: false -Style/RedundantRegexpEscape: - Enabled: false -Style/RedundantSelfAssignment: - Enabled: false -Style/RedundantSort: - Enabled: false -Style/RescueStandardError: - Enabled: false -Style/SingleArgumentDig: - Enabled: false -Style/SlicingWithRange: - Enabled: false -Style/SoleNestedConditional: - Enabled: false -Style/StderrPuts: - Enabled: false -Style/StringConcatenation: - Enabled: false -Style/Strip: - Enabled: false -Style/SymbolProc: - Enabled: false -Style/TrailingBodyOnClass: - Enabled: false -Style/TrailingBodyOnMethodDefinition: - Enabled: false -Style/TrailingBodyOnModule: - Enabled: false -Style/TrailingCommaInHashLiteral: - Enabled: false -Style/TrailingMethodEndStatement: - Enabled: false -Style/UnpackFirst: - Enabled: false -Lint/DuplicateBranch: - Enabled: false -Lint/DuplicateRegexpCharacterClassElement: - Enabled: false -Lint/EmptyBlock: - Enabled: false -Lint/EmptyClass: - Enabled: false -Lint/NoReturnInBeginEndBlocks: - Enabled: false -Lint/ToEnumArguments: - Enabled: false -Lint/UnexpectedBlockArity: - Enabled: false -Lint/UnmodifiedReduceAccumulator: - Enabled: false -Performance/CollectionLiteralInLoop: - Enabled: false -Style/ArgumentsForwarding: - Enabled: false -Style/CollectionCompact: - Enabled: false -Style/DocumentDynamicEvalDefinition: - Enabled: false -Style/NegatedIfElseCondition: - Enabled: false -Style/NilLambda: - Enabled: false -Style/RedundantArgument: - Enabled: false -Style/SwapValues: - Enabled: false +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +inherit_gem: + voxpupuli-test: rubocop.yml diff --git a/.sync.yml b/.sync.yml index 7bb22ead..6dc1a346 100644 --- a/.sync.yml +++ b/.sync.yml @@ -1,91 +1,9 @@ --- -.gitlab-ci.yml: - delete: true -.travis.yml: - delete: true -appveyor.yml: - delete: true +spec/spec_helper_acceptance.rb: + unmanaged: false Gemfile: - required: - ':development': - - gem: 'beaker' - version: '~> 4.26' - - gem: 'beaker-rspec' - version: '~> 6.3' - - gem: 'beaker-puppet_install_helper' - version: '~> 0.9.8' - - gem: 'beaker-module_install_helper' - version: '~> 0.1.7' - - gem: 'beaker-hostgenerator' - version: '~> 1.3' - - gem: 'beaker-docker' - version: '~> 0.8.4' - - gem: 'beaker-puppet' - version: '~> 1.21' - - gem: 'fog-openstack' - version: '~> 1.0' - - gem: 'github_changelog_generator' - version: '~> 1.15' - - gem: 'public_suffix' - version: '~> 4.0' - - gem: 'puppet-lint-absolute_classname-check' - version: '~> 3.0' - - gem: 'puppet-lint-absolute_template_path' - version: '~> 1.0' - - gem: 'puppet-lint-anchor-check' - version: '~> 1.0' - - gem: 'puppet-lint-classes_and_types_beginning_with_digits-check' - version: '~> 0.1' - - gem: 'puppet-lint-empty_string-check' - version: '~> 0.2' - - gem: 'puppet-lint-file_ensure-check' - version: '~> 0.3' - - gem: 'puppet-lint-leading_zero-check' - version: '~> 0.1' - - gem: 'puppet-lint-legacy_facts-check' - version: '~> 1.0' - - gem: 'puppet-lint-manifest_whitespace-check' - version: '~> 0.1' - - gem: 'puppet-lint-param-docs' - version: '~> 1.6' - - gem: 'puppet-lint-resource_reference_syntax' - version: '~> 1.0' - - gem: 'puppet-lint-spaceship_operator_without_tag-check' - version: '~> 0.1' - - gem: 'puppet-lint-strict_indent-check' - version: '~> 2.0' - - gem: 'puppet-lint-top_scope_facts-check' - version: '~> 1.0' - - gem: 'puppet-lint-topscope-variable-check' - version: '~> 1.0' - - gem: 'puppet-lint-trailing_comma-check' - version: '~> 0.4' - - gem: 'puppet-lint-trailing_newline-check' - version: '~> 1.1' - - gem: 'puppet-lint-undef_in_function-check' - version: '~> 0.2' - - gem: 'puppet-lint-unquoted_string-check' - version: '~> 2.0' - - gem: 'puppet-lint-variable_contains_upcase' - version: '~> 1.2' - - gem: 'puppet-lint-version_comparison-check' - version: '~> 0.2' - - gem: 'puppet_metadata' - version: '~> 0.3.0' - - gem: 'serverspec' - version: '~> 2.41' - - gem: 'vagrant-wrapper' - version: '~> 2.0' - - gem: 'voxpupuli-acceptance' - version: '~> 0.3.0' - - gem: 'voxpupuli-release' - version: '~> 1.0' - - gem: 'webmock' - version: '~> 3.12' -Rakefile: - linter_fail_on_warnings: true - requires: - - 'puppet-strings/tasks' + optional: + ':test': + - gem: webmock spec/spec_helper.rb: - mock_with: ':rspec' - coverage_report: true + spec_overrides: "require 'spec_helper_local'" diff --git a/.yardopts b/.yardopts deleted file mode 100644 index 29c933bc..00000000 --- a/.yardopts +++ /dev/null @@ -1 +0,0 @@ ---markup markdown diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..8dd82d63 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +# MANAGED BY MODULESYNC +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +FROM ruby:2.7 + +WORKDIR /opt/puppet + +# https://github.com/puppetlabs/puppet/blob/06ad255754a38f22fb3a22c7c4f1e2ce453d01cb/lib/puppet/provider/service/runit.rb#L39 +RUN mkdir -p /etc/sv + +ARG PUPPET_GEM_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 rake release_checks + +# Container should not saved +RUN exit 1 diff --git a/Gemfile b/Gemfile index e4a6b3bf..7ef4da21 100644 --- a/Gemfile +++ b/Gemfile @@ -1,99 +1,35 @@ -source ENV['GEM_SOURCE'] || 'https://rubygems.org' +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -def location_for(place_or_version, fake_version = nil) - git_url_regex = %r{\A(?(https?|git)[:@][^#]*)(#(?.*))?} - file_url_regex = %r{\Afile:\/\/(?.*)} +source ENV['GEM_SOURCE'] || 'https://rubygems.org' - if place_or_version && (git_url = place_or_version.match(git_url_regex)) - [fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact - elsif place_or_version && (file_url = place_or_version.match(file_url_regex)) - ['>= 0', { path: File.expand_path(file_url[:path]), require: false }] - else - [place_or_version, { require: false }] - end +group :test do + gem 'voxpupuli-test', '~> 5.0', :require => false + gem 'coveralls', :require => false + gem 'simplecov-console', :require => false + gem 'puppet_metadata', '~> 1.0', :require => false + gem 'webmock', :require => false end -ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments -minor_version = ruby_version_segments[0..1].join('.') - group :development do - gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "json", '= 2.3.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 2.8.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "puppet-module-posix-default-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby] - gem "puppet-module-posix-dev-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby] - gem "puppet-module-win-default-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "puppet-module-win-dev-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "beaker", '~> 4.26', require: false - gem "beaker-rspec", '~> 6.3', require: false - gem "beaker-puppet_install_helper", '~> 0.9.8', require: false - gem "beaker-module_install_helper", '~> 0.1.7', require: false - gem "beaker-hostgenerator", '~> 1.3', require: false - gem "beaker-docker", '~> 0.8.4', require: false - gem "beaker-puppet", '~> 1.21', require: false - gem "fog-openstack", '~> 1.0', require: false - gem "github_changelog_generator", '~> 1.15', require: false - gem "public_suffix", '~> 4.0', require: false - gem "puppet-lint-absolute_classname-check", '~> 3.0', require: false - gem "puppet-lint-absolute_template_path", '~> 1.0', require: false - gem "puppet-lint-anchor-check", '~> 1.0', require: false - gem "puppet-lint-classes_and_types_beginning_with_digits-check", '~> 0.1', require: false - gem "puppet-lint-empty_string-check", '~> 0.2', require: false - gem "puppet-lint-file_ensure-check", '~> 0.3', require: false - gem "puppet-lint-leading_zero-check", '~> 0.1', require: false - gem "puppet-lint-legacy_facts-check", '~> 1.0', require: false - gem "puppet-lint-manifest_whitespace-check", '~> 0.1', require: false - gem "puppet-lint-param-docs", '~> 1.6', require: false - gem "puppet-lint-resource_reference_syntax", '~> 1.0', require: false - gem "puppet-lint-spaceship_operator_without_tag-check", '~> 0.1', require: false - gem "puppet-lint-strict_indent-check", '~> 2.0', require: false - gem "puppet-lint-top_scope_facts-check", '~> 1.0', require: false - gem "puppet-lint-topscope-variable-check", '~> 1.0', require: false - gem "puppet-lint-trailing_comma-check", '~> 0.4', require: false - gem "puppet-lint-trailing_newline-check", '~> 1.1', require: false - gem "puppet-lint-undef_in_function-check", '~> 0.2', require: false - gem "puppet-lint-unquoted_string-check", '~> 2.0', require: false - gem "puppet-lint-variable_contains_upcase", '~> 1.2', require: false - gem "puppet-lint-version_comparison-check", '~> 0.2', require: false - gem "puppet_metadata", '~> 0.3.0', require: false - gem "serverspec", '~> 2.41', require: false - gem "vagrant-wrapper", '~> 2.0', require: false - gem "voxpupuli-acceptance", '~> 0.3.0', require: false - gem "voxpupuli-release", '~> 1.0', require: false - gem "webmock", '~> 3.12', require: false + gem 'guard-rake', :require => false + gem 'overcommit', '>= 0.39.1', :require => false end + group :system_tests do - gem "puppet-module-posix-system-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby] - gem "puppet-module-win-system-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw] + gem 'voxpupuli-acceptance', '~> 1.0', :require => false end -puppet_version = ENV['PUPPET_GEM_VERSION'] -facter_version = ENV['FACTER_GEM_VERSION'] -hiera_version = ENV['HIERA_GEM_VERSION'] - -gems = {} - -gems['puppet'] = location_for(puppet_version) - -# If facter or hiera versions have been specified via the environment -# variables - -gems['facter'] = location_for(facter_version) if facter_version -gems['hiera'] = location_for(hiera_version) if hiera_version - -gems.each do |gem_name, gem_params| - gem gem_name, *gem_params +group :release do + gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5' + gem 'voxpupuli-release', '>= 1.2.0', :require => false + gem 'puppet-strings', '>= 2.2', :require => false end -# Evaluate Gemfile.local and ~/.gemfile if they exist -extra_gemfiles = [ - "#{__FILE__}.local", - File.join(Dir.home, '.gemfile'), -] +gem 'rake', :require => false +gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] + +puppetversion = ENV['PUPPET_GEM_VERSION'] || '>= 6.0' +gem 'puppet', puppetversion, :require => false, :groups => [:test] -extra_gemfiles.each do |gemfile| - if File.file?(gemfile) && File.readable?(gemfile) - eval(File.read(gemfile), binding) - end -end # vim: syntax=ruby diff --git a/Rakefile b/Rakefile index aa9c094d..f92f0516 100644 --- a/Rakefile +++ b/Rakefile @@ -1,90 +1,72 @@ -# frozen_string_literal: true +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -require 'bundler' -require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any? -require 'puppetlabs_spec_helper/rake_tasks' -require 'puppet-syntax/tasks/puppet-syntax' -require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any? -require 'github_changelog_generator/task' if Bundler.rubygems.find_name('github_changelog_generator').any? -require 'puppet-strings/tasks' if Bundler.rubygems.find_name('puppet-strings').any? -require 'puppet-strings/tasks' - -def changelog_user - return unless Rake.application.top_level_tasks.include? "changelog" - returnVal = nil || JSON.load(File.read('metadata.json'))['author'] - raise "unable to find the changelog_user in .sync.yml, or the author in metadata.json" if returnVal.nil? - puts "GitHubChangelogGenerator user:#{returnVal}" - returnVal +# Attempt to load voxpupuli-test (which pulls in puppetlabs_spec_helper), +# otherwise attempt to load it directly. +begin + require 'voxpupuli/test/rake' +rescue LoadError + begin + require 'puppetlabs_spec_helper/rake_tasks' + rescue LoadError + end end -def changelog_project - return unless Rake.application.top_level_tasks.include? "changelog" +# load optional tasks for acceptance +# only available if gem group releases is installed +begin + require 'voxpupuli/acceptance/rake' +rescue LoadError +end - returnVal = nil - returnVal ||= begin - metadata_source = JSON.load(File.read('metadata.json'))['source'] - metadata_source_match = metadata_source && metadata_source.match(%r{.*\/([^\/]*?)(?:\.git)?\Z}) +# load optional tasks for releases +# only available if gem group releases is installed +begin + require 'voxpupuli/release/rake_tasks' +rescue LoadError +end - metadata_source_match && metadata_source_match[1] +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__)) + require 'coveralls/rake/task' + Coveralls::RakeTask.new + Rake::Task['coveralls:push'].invoke + else + puts 'Skipping reporting to coveralls. Module has no lib dir' end - - raise "unable to find the changelog_project in .sync.yml or calculate it from the source in metadata.json" if returnVal.nil? - - puts "GitHubChangelogGenerator project:#{returnVal}" - returnVal end -def changelog_future_release - return unless Rake.application.top_level_tasks.include? "changelog" - returnVal = "v%s" % JSON.load(File.read('metadata.json'))['version'] - raise "unable to find the future_release (version) in metadata.json" if returnVal.nil? - puts "GitHubChangelogGenerator future_release:#{returnVal}" - returnVal +desc 'Generate REFERENCE.md' +task :reference, [:debug, :backtrace] do |t, args| + patterns = '' + Rake::Task['strings:generate:reference'].invoke(patterns, args[:debug], args[:backtrace]) end -PuppetLint.configuration.send('disable_relative') -PuppetLint.configuration.fail_on_warnings = true - -if Bundler.rubygems.find_name('github_changelog_generator').any? +begin + require 'github_changelog_generator/task' + require 'puppet_blacksmith' GitHubChangelogGenerator::RakeTask.new :changelog do |config| - raise "Set CHANGELOG_GITHUB_TOKEN environment variable eg 'export CHANGELOG_GITHUB_TOKEN=valid_token_here'" if Rake.application.top_level_tasks.include? "changelog" and ENV['CHANGELOG_GITHUB_TOKEN'].nil? - config.user = "#{changelog_user}" - config.project = "#{changelog_project}" - config.future_release = "#{changelog_future_release}" - config.exclude_labels = ['maintenance'] - config.header = "# Change log\n\nAll notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org)." - config.add_pr_wo_labels = true - config.issues = false - config.merge_prefix = "### UNCATEGORIZED PRS; LABEL THEM ON GITHUB" - config.configure_sections = { - "Changed" => { - "prefix" => "### Changed", - "labels" => ["backwards-incompatible"], - }, - "Added" => { - "prefix" => "### Added", - "labels" => ["enhancement", "feature"], - }, - "Fixed" => { - "prefix" => "### Fixed", - "labels" => ["bug", "documentation", "bugfix"], - }, - } + metadata = Blacksmith::Modulefile.new + config.future_release = "v#{metadata.version}" if metadata.version =~ /^\d+\.\d+.\d+$/ + config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module." + config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog} + config.user = 'voxpupuli' + config.project = metadata.metadata['name'] end -else - desc 'Generate a Changelog from GitHub' - task :changelog do - raise < 1.15' - condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.3.0')" -EOM + + # Workaround for https://github.com/github-changelog-generator/github-changelog-generator/issues/715 + require 'rbconfig' + if RbConfig::CONFIG['host_os'] =~ /linux/ + task :changelog do + puts 'Fixing line endings...' + changelog_file = File.join(__dir__, 'CHANGELOG.md') + changelog_txt = File.read(changelog_file) + new_contents = changelog_txt.gsub(%r{\r\n}, "\n") + File.open(changelog_file, "w") {|file| file.puts new_contents } + end end -end +rescue LoadError +end +# vim: syntax=ruby diff --git a/manifests/init.pp b/manifests/init.pp index 401eafd7..6d050626 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -206,7 +206,7 @@ String[1] $acl_api_protocol = 'http', Integer[1, 65535] $acl_api_port = 8500, Integer[1] $acl_api_tries = 3, - String[0] $acl_api_token = '', # lint:ignore:empty_string_assignment + String[0] $acl_api_token = '', # lint:ignore:params_empty_string_assignment String[1] $arch = $consul::params::arch, Optional[Stdlib::Absolutepath] $archive_path = undef, Stdlib::Absolutepath $bin_dir = $consul::params::bin_dir, diff --git a/spec/default_facts.yml b/spec/default_facts.yml deleted file mode 100644 index f777abfc..00000000 --- a/spec/default_facts.yml +++ /dev/null @@ -1,8 +0,0 @@ -# Use default_module_facts.yml for module specific facts. -# -# Facts specified here will override the values provided by rspec-puppet-facts. ---- -ipaddress: "172.16.254.254" -ipaddress6: "FE80:0000:0000:0000:AAAA:AAAA:AAAA" -is_pe: false -macaddress: "AA:AA:AA:AA:AA:AA" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 16764b6f..2b4a8839 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,62 +1,19 @@ # frozen_string_literal: true -RSpec.configure do |c| - c.mock_with :rspec -end - -require 'puppetlabs_spec_helper/module_spec_helper' -require 'rspec-puppet-facts' - -require 'spec_helper_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_local.rb')) - -include RspecPuppetFacts - -default_facts = { - puppetversion: Puppet.version, - facterversion: Facter.version, -} - -default_fact_files = [ - File.expand_path(File.join(File.dirname(__FILE__), 'default_facts.yml')), - File.expand_path(File.join(File.dirname(__FILE__), 'default_module_facts.yml')), -] - -default_fact_files.each do |f| - next unless File.exist?(f) && File.readable?(f) && File.size?(f) +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ - begin - default_facts.merge!(YAML.safe_load(File.read(f), [], [], true)) - rescue => e - RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}" - end -end - -# read default_facts and merge them over what is provided by facterdb -default_facts.each do |fact, value| - add_custom_fact fact, value -end +# puppetlabs_spec_helper will set up coverage if the env variable is set. +# We want to do this if lib exists and it hasn't been explicitly set. +ENV['COVERAGE'] ||= 'yes' if Dir.exist?(File.expand_path('../lib', __dir__)) -RSpec.configure do |c| - c.default_facts = default_facts - c.before :each do - # set to strictest setting for testing - # by default Puppet runs at warning level - Puppet.settings[:strict] = :warning - Puppet.settings[:strict_variables] = true - end - c.filter_run_excluding(bolt: true) unless ENV['GEM_BOLT'] - c.after(:suite) do - RSpec::Puppet::Coverage.report!(0) - end -end +require 'voxpupuli/test/spec_helper' -# Ensures that a module is defined -# @param module_name Name of the module -def ensure_module_defined(module_name) - module_name.split('::').reduce(Object) do |last_module, next_module| - last_module.const_set(next_module, Module.new) unless last_module.const_defined?(next_module, false) - last_module.const_get(next_module, false) +if File.exist?(File.join(__dir__, 'default_module_facts.yml')) + facts = YAML.safe_load(File.read(File.join(__dir__, 'default_module_facts.yml'))) + facts&.each do |name, value| + add_custom_fact name.to_sym, value end end -# 'spec_overrides' from sync.yml will appear below this line +require 'spec_helper_local' diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 3e4531cc..d3a6e23c 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,4 +1,8 @@ -# This file is copied from what Vox Pupuli pushes out via modulesync +# frozen_string_literal: true + +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + require 'voxpupuli/acceptance/spec_helper_acceptance' configure_beaker diff --git a/tests/init.pp b/tests/init.pp deleted file mode 100644 index 5146397a..00000000 --- a/tests/init.pp +++ /dev/null @@ -1,25 +0,0 @@ -# The baseline for module testing used by Puppet Labs is that each manifest -# should have a corresponding test manifest that declares that class or defined -# type. -# -# Tests are then run by using puppet apply --noop (to check for compilation -# errors and view a log of events) or by fully applying the test in a virtual -# environment (to compare the resulting system state to the desired state). -# -# Learn more about module testing here: -# http://docs.puppetlabs.com/guides/tests_smoke.html -# -include consul - -# allows for a quick and dirty test of the consul_key_value with consul. -# You can execute consul in docker using: -# > docker run -d -p 8500:8500 --name=dev-consul consul -# use this to find the hostname -# > docker exec -t dev-consul consul members -# node default { -# consul_key_value{'sample/key': -# ensure => 'absent', -# value => 'testValue', -# datacenter => 'dc1' -# } -# } From d516fec0d5790ea5e6796b78dc75003887d8125b Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 19 Apr 2022 09:29:39 +0200 Subject: [PATCH 09/19] rubocop: safe autocorrect --- lib/facter/consul_version.rb | 2 +- lib/puppet/functions/consul/sorted_json.rb | 12 +- .../functions/consul/validate_checks.rb | 24 +- lib/puppet/provider/consul_acl/default.rb | 34 +- .../provider/consul_key_value/default.rb | 16 +- lib/puppet/provider/consul_policy/default.rb | 18 +- .../provider/consul_prepared_query/default.rb | 38 +- lib/puppet/provider/consul_token/default.rb | 30 +- lib/puppet/type/consul_policy.rb | 4 +- lib/puppet_x/consul/acl_base.rb | 8 +- spec/acceptance/class_spec.rb | 4 + spec/classes/init_spec.rb | 286 +++++++------- spec/defines/consul_check_spec.rb | 271 ++++++++------ spec/defines/consul_service_spec.rb | 154 ++++---- spec/defines/consul_watch_spec.rb | 144 +++---- spec/functions/consul_sorted_json_spec.rb | 27 +- spec/functions/consul_validate_checks_spec.rb | 22 +- spec/spec_helper.rb | 2 +- spec/unit/facter/consul_version_spec.rb | 12 +- .../puppet/provider/consul_key_value_spec.rb | 214 +++++------ .../puppet/provider/consul_policy_spec.rb | 256 ++++++------- .../unit/puppet/provider/consul_token_spec.rb | 354 +++++++++--------- spec/unit/puppet/type/consul_acl_spec.rb | 16 +- .../unit/puppet/type/consul_key_value_spec.rb | 8 +- spec/unit/puppet/type/consul_policy_spec.rb | 246 ++++++------ .../puppet/type/consul_prepared_query_spec.rb | 12 +- spec/unit/puppet/type/consul_token_spec.rb | 24 +- 27 files changed, 1137 insertions(+), 1101 deletions(-) diff --git a/lib/facter/consul_version.rb b/lib/facter/consul_version.rb index 1bfa7f64..e49105d8 100644 --- a/lib/facter/consul_version.rb +++ b/lib/facter/consul_version.rb @@ -8,7 +8,7 @@ ENV['PATH'] = path + ':/usr/local/bin' begin Facter::Util::Resolution.exec('consul --version 2> /dev/null').lines.first.split[1].tr('v', '') - rescue + rescue StandardError nil ensure ENV['PATH'] = original_path diff --git a/lib/puppet/functions/consul/sorted_json.rb b/lib/puppet/functions/consul/sorted_json.rb index 3266a088..4a8a8b70 100644 --- a/lib/puppet/functions/consul/sorted_json.rb +++ b/lib/puppet/functions/consul/sorted_json.rb @@ -58,7 +58,7 @@ # def sorted_json(unsorted_hash = {}, pretty = false, indent_len = 4) # simplify jsonification of standard types - simple_generate = ->(obj, quoted) do + simple_generate = lambda do |obj, quoted| case obj when NilClass, :undef 'null' @@ -67,11 +67,11 @@ def sorted_json(unsorted_hash = {}, pretty = false, indent_len = 4) else # Should be a string # keep string integers unquoted - (obj =~ %r{\A[-]?(0|[1-9]\d*)\z} && !quoted) ? obj : obj.to_json + obj =~ %r{\A-?(0|[1-9]\d*)\z} && !quoted ? obj : obj.to_json end end - sorted_generate = ->(obj, quoted) do + sorted_generate = lambda do |obj, quoted| case obj when NilClass, :undef, Integer, Float, TrueClass, FalseClass, String return simple_generate.call(obj, quoted) @@ -85,7 +85,7 @@ def sorted_json(unsorted_hash = {}, pretty = false, indent_len = 4) ret = [] obj.keys.sort.each do |k| # Stringify all children of node_meta, meta, and tags - quote_children = (k =~ %r{\A(node_meta|meta|tags|args)\z} || quoted) ? true : false + quote_children = k =~ %r{\A(node_meta|meta|tags|args)\z} || quoted ? true : false ret.push(k.to_json << ':' << sorted_generate.call(obj[k], quote_children)) end return '{' << ret.join(',') << '}' @@ -94,7 +94,7 @@ def sorted_json(unsorted_hash = {}, pretty = false, indent_len = 4) end end - sorted_pretty_generate = ->(obj, sorted_pretty_indent_len = 4, level = 0, quoted) do + sorted_pretty_generate = lambda do |obj, sorted_pretty_indent_len = 4, level = 0, quoted| # Indent length indent = ' ' * sorted_pretty_indent_len @@ -130,7 +130,7 @@ def sorted_json(unsorted_hash = {}, pretty = false, indent_len = 4) level += 1 obj.keys.sort.each do |k| # Stringify all children of node_meta, meta, and tags - quote_children = (k =~ %r{\A(node_meta|meta|tags|args)\z} || quoted) ? true : false + quote_children = k =~ %r{\A(node_meta|meta|tags|args)\z} || quoted ? true : false ret.push((indent * level).to_s << k.to_json << ': ' << sorted_pretty_generate.call(obj[k], sorted_pretty_indent_len, level, quote_children)) end level -= 1 diff --git a/lib/puppet/functions/consul/validate_checks.rb b/lib/puppet/functions/consul/validate_checks.rb index b32d4c78..8f9da6bd 100644 --- a/lib/puppet/functions/consul/validate_checks.rb +++ b/lib/puppet/functions/consul/validate_checks.rb @@ -14,30 +14,18 @@ def validate_checks(obj) validate_checks(c) end when Hash - if (obj.key?('http') || (obj.key?('script') || obj.key?('args')) || obj.key?('tcp')) && !obj.key?('interval') - raise Puppet::ParseError, 'interval must be defined for tcp, http, and script checks' - end + raise Puppet::ParseError, 'interval must be defined for tcp, http, and script checks' if (obj.key?('http') || (obj.key?('script') || obj.key?('args')) || obj.key?('tcp')) && !obj.key?('interval') if obj.key?('ttl') - if obj.key?('http') || (obj.key?('args') || obj.key?('script')) || obj.key?('tcp') || obj.key?('interval') - raise Puppet::ParseError, 'script, http, tcp, and interval must not be defined for ttl checks' - end + raise Puppet::ParseError, 'script, http, tcp, and interval must not be defined for ttl checks' if obj.key?('http') || (obj.key?('args') || obj.key?('script')) || obj.key?('tcp') || obj.key?('interval') elsif obj.key?('http') - if (obj.key?('args') || obj.key?('script')) || obj.key?('tcp') - raise Puppet::ParseError, 'script and tcp must not be defined for http checks' - end + raise Puppet::ParseError, 'script and tcp must not be defined for http checks' if (obj.key?('args') || obj.key?('script')) || obj.key?('tcp') elsif obj.key?('tcp') - if obj.key?('http') || (obj.key?('args') || obj.key?('script')) - raise Puppet::ParseError, 'script and http must not be defined for tcp checks' - end + raise Puppet::ParseError, 'script and http must not be defined for tcp checks' if obj.key?('http') || (obj.key?('args') || obj.key?('script')) elsif obj.key?('args') || obj.key?('script') - if obj.key?('http') || obj.key?('tcp') - raise Puppet::ParseError, 'http and tcp must not be defined for script checks' - end + raise Puppet::ParseError, 'http and tcp must not be defined for script checks' if obj.key?('http') || obj.key?('tcp') elsif obj.key?('alias_service') - if obj.key?('http') || obj.key?('tcp') || obj.key?('args') || obj.key?('script') || obj.key?('interval') - raise Puppet::ParseError, 'alias_service must not define http, tcp, args, script, or interval' - end + raise Puppet::ParseError, 'alias_service must not define http, tcp, args, script, or interval' if obj.key?('http') || obj.key?('tcp') || obj.key?('args') || obj.key?('script') || obj.key?('interval') else raise Puppet::ParseError, 'One of ttl, script, tcp, or http must be defined.' end diff --git a/lib/puppet/provider/consul_acl/default.rb b/lib/puppet/provider/consul_acl/default.rb index 2f44c6c0..2098bde6 100644 --- a/lib/puppet/provider/consul_acl/default.rb +++ b/lib/puppet/provider/consul_acl/default.rb @@ -3,7 +3,7 @@ require 'pp' require 'uri' Puppet::Type.type(:consul_acl).provide( - :default, + :default ) do mk_resource_methods @@ -33,9 +33,7 @@ def self.prefetch(resources) def self.list_resources(acl_api_token, port, hostname, protocol, tries) @acls ||= {} - if @acls[ "#{acl_api_token}#{port}#{hostname}#{protocol}#{tries}" ] - return @acls[ "#{acl_api_token}#{port}#{hostname}#{protocol}#{tries}" ] - end + return @acls["#{acl_api_token}#{port}#{hostname}#{protocol}#{tries}"] if @acls["#{acl_api_token}#{port}#{hostname}#{protocol}#{tries}"] # this might be configurable by searching /etc/consul.d # but would break for anyone using nonstandard paths @@ -59,9 +57,9 @@ def self.list_resources(acl_api_token, port, hostname, protocol, tries) res = http.request(req) res_code = res.code break if res_code == '200' - rescue Errno::ECONNREFUSED => exc - Puppet.debug("#{uri}/list?token= #{exc.class} #{exc.message}") - res_code = exc.class.to_s + rescue Errno::ECONNREFUSED => e + Puppet.debug("#{uri}/list?token= #{e.class} #{e.message}") + res_code = e.class.to_s end end @@ -87,7 +85,7 @@ def self.list_resources(acl_api_token, port, hostname, protocol, tries) } end - @acls[ "#{acl_api_token}#{port}#{hostname}#{protocol}#{tries}" ] = nacls + @acls["#{acl_api_token}#{port}#{hostname}#{protocol}#{tries}"] = nacls nacls end @@ -98,13 +96,9 @@ def put_acl(method, body) acl_api_token = @resource[:acl_api_token] path = uri.request_uri + "/#{method}?token=#{acl_api_token}" req = Net::HTTP::Put.new(path) - if body - req.body = body.to_json - end + req.body = body.to_json if body res = http.request(req) - if res.code != '200' - raise(Puppet::Error, "Session #{name} create: invalid return code #{res.code} uri: #{path} body: #{req.body}") - end + raise(Puppet::Error, "Session #{name} create: invalid return code #{res.code} uri: #{path} body: #{req.body}") if res.code != '200' end def get_resource(name, port, hostname, protocol, tries) @@ -152,15 +146,15 @@ def flush put_acl("destroy/#{id}", nil) return end - put_acl('update', { 'id' => id.to_s, - 'name' => name.to_s, - 'type' => type.to_s, + put_acl('update', { 'id' => id.to_s, + 'name' => name.to_s, + 'type' => type.to_s, 'rules' => rules.to_s }) else - put_acl('create', { 'id' => (@resource[:id]).to_s, - 'name' => name.to_s, - 'type' => type.to_s, + put_acl('create', { 'id' => (@resource[:id]).to_s, + 'name' => name.to_s, + 'type' => type.to_s, 'rules' => rules.to_s }) end @property_hash.clear diff --git a/lib/puppet/provider/consul_key_value/default.rb b/lib/puppet/provider/consul_key_value/default.rb index 672efed9..3faf7a92 100644 --- a/lib/puppet/provider/consul_key_value/default.rb +++ b/lib/puppet/provider/consul_key_value/default.rb @@ -3,7 +3,7 @@ require 'uri' require 'base64' Puppet::Type.type(:consul_key_value).provide( - :default, + :default ) do mk_resource_methods @@ -34,9 +34,7 @@ def self.prefetch(resources) def self.list_resources(acl_api_token, port, hostname, protocol, tries, datacenter) @key_values ||= {} - if @key_values[ "#{acl_api_token}#{port}#{hostname}#{protocol}#{tries}#{datacenter}" ] - return @key_values[ "#{acl_api_token}#{port}#{hostname}#{protocol}#{tries}#{datacenter}" ] - end + return @key_values["#{acl_api_token}#{port}#{hostname}#{protocol}#{tries}#{datacenter}"] if @key_values["#{acl_api_token}#{port}#{hostname}#{protocol}#{tries}#{datacenter}"] # this might be configurable by searching /etc/consul.d # but would break for anyone using nonstandard paths @@ -75,7 +73,7 @@ def self.list_resources(acl_api_token, port, hostname, protocol, tries, datacent protocol: protocol, } end - @key_values[ "#{acl_api_token}#{port}#{hostname}#{protocol}#{tries}#{datacenter}" ] = nkey_values + @key_values["#{acl_api_token}#{port}#{hostname}#{protocol}#{tries}#{datacenter}"] = nkey_values nkey_values end @@ -97,18 +95,14 @@ def create_or_update_key_value(name, value, flags) req = Net::HTTP::Put.new(path + "&flags=#{flags}") req.body = value res = http.request(req) - if res.code != '200' - raise(Puppet::Error, "Session #{name} create/update: invalid return code #{res.code} uri: #{path} body: #{req.body}") - end + raise(Puppet::Error, "Session #{name} create/update: invalid return code #{res.code} uri: #{path} body: #{req.body}") if res.code != '200' end def delete_key_value(name) path, http = get_path(name) req = Net::HTTP::Delete.new(path) res = http.request(req) - if res.code != '200' - raise(Puppet::Error, "Session #{name} delete: invalid return code #{res.code} uri: #{path} body: #{req.body}") - end + raise(Puppet::Error, "Session #{name} delete: invalid return code #{res.code} uri: #{path} body: #{req.body}") if res.code != '200' end def get_resource(name, port, hostname, protocol, tries, datacenter) diff --git a/lib/puppet/provider/consul_policy/default.rb b/lib/puppet/provider/consul_policy/default.rb index 7ace3c51..e396abfc 100644 --- a/lib/puppet/provider/consul_policy/default.rb +++ b/lib/puppet/provider/consul_policy/default.rb @@ -4,8 +4,8 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'puppet_x', 'consul', 'acl_base.rb')) Puppet::Type.type(:consul_policy).provide( - :default, - ) do + :default +) do mk_resource_methods def self.prefetch(resources) @@ -43,7 +43,7 @@ def self.encode_rules(rules) encoded = [] rules.each do |rule| - if ['acl', 'operator', 'keyring'].include?(rule['resource']) + if %w[acl operator keyring].include?(rule['resource']) encoded.push("#{rule['resource']} = \"#{rule['disposition']}\"") else encoded.push("#{rule['resource']} \"#{rule['segment']}\" {\n policy = \"#{rule['disposition']}\"\n}") @@ -55,9 +55,7 @@ def self.encode_rules(rules) def self.list_policies(acl_api_token, hostname, port, protocol, tries) @all_policies ||= nil - if @all_policies - return @all_policies - end + return @all_policies if @all_policies @client ||= ConsulACLPolicyClient.new(hostname, port, protocol, acl_api_token) @all_policies = @client.get_all_policies(tries) @@ -79,9 +77,7 @@ def initialize(messages, client = nil, rules_encoded = '', existing_policy = nil datacenters: existing_policy.datacenters } - if rules_encoded == existing_policy.rules - @property_hash[:rules] = resource[:rules] - end + @property_hash[:rules] = resource[:rules] if rules_encoded == existing_policy.rules end end @@ -131,8 +127,8 @@ def self.reset end class ConsulPolicy - attr_reader :id, :name, :description, :datacenters, :rules - attr_writer :id, :rules, :description, :datacenters + attr_accessor :id, :description, :datacenters, :rules + attr_reader :name def initialize(id, name, description, datacenters, rules) @id = id diff --git a/lib/puppet/provider/consul_prepared_query/default.rb b/lib/puppet/provider/consul_prepared_query/default.rb index d7137c24..81945c0e 100644 --- a/lib/puppet/provider/consul_prepared_query/default.rb +++ b/lib/puppet/provider/consul_prepared_query/default.rb @@ -2,7 +2,7 @@ require 'net/http' require 'uri' Puppet::Type.type(:consul_prepared_query).provide( - :default, + :default ) do mk_resource_methods @@ -31,9 +31,7 @@ def self.prefetch(resources) end def self.list_resources(acl_api_token, port, hostname, protocol, tries) - if @prepared_queries - return @prepared_queries - end + return @prepared_queries if @prepared_queries # this might be configurable by searching /etc/consul.d # but would break for anyone using nonstandard paths @@ -90,13 +88,9 @@ def get_path(id) def create_prepared_query(body) path, http = get_path(false) req = Net::HTTP::Post.new(path) - if body - req.body = body.to_json - end + req.body = body.to_json if body res = http.request(req) - if res.code != '200' - raise(Puppet::Error, "Session #{name} create: invalid return code #{res.code} uri: #{path} body: #{req.body}") - end + raise(Puppet::Error, "Session #{name} create: invalid return code #{res.code} uri: #{path} body: #{req.body}") if res.code != '200' end def update_prepared_query(id, body) @@ -107,18 +101,14 @@ def update_prepared_query(id, body) req.body = body.to_json end res = http.request(req) - if res.code != '200' - raise(Puppet::Error, "Session #{name} update: invalid return code #{res.code} uri: #{path} body: #{req.body}") - end + raise(Puppet::Error, "Session #{name} update: invalid return code #{res.code} uri: #{path} body: #{req.body}") if res.code != '200' end def delete_prepared_query(id) path, http = get_path(id) req = Net::HTTP::Delete.new(path) res = http.request(req) - if res.code != '200' - raise(Puppet::Error, "Session #{name} delete: invalid return code #{res.code} uri: #{path} body: #{req.body}") - end + raise(Puppet::Error, "Session #{name} delete: invalid return code #{res.code} uri: #{path} body: #{req.body}") if res.code != '200' end def get_resource(name, port, hostname, protocol, tries) @@ -166,17 +156,17 @@ def flush template_type = @resource[:template_type] prepared_query = get_resource(name, port, hostname, protocol, tries) query_data = { - 'Name' => name.to_s, - 'Token' => token.to_s, + 'Name' => name.to_s, + 'Token' => token.to_s, 'Service' => { - 'Service' => service_name.to_s, - 'Near' => service_near.to_s, - 'Failover' => { - 'NearestN' => service_failover_n, + 'Service' => service_name.to_s, + 'Near' => service_near.to_s, + 'Failover' => { + 'NearestN' => service_failover_n, 'Datacenters' => service_failover_dcs, }, 'OnlyPassing' => service_only_passing, - 'Tags' => service_tags, + 'Tags' => service_tags, }, 'DNS' => { 'TTL' => "#{ttl}s" @@ -185,7 +175,7 @@ def flush if template query_data['Template'] = { 'Type' => template_type, - 'Regexp' => template_regexp, + 'Regexp' => template_regexp, } end if prepared_query diff --git a/lib/puppet/provider/consul_token/default.rb b/lib/puppet/provider/consul_token/default.rb index 4d6bfa4f..51b95f26 100644 --- a/lib/puppet/provider/consul_token/default.rb +++ b/lib/puppet/provider/consul_token/default.rb @@ -5,8 +5,8 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'puppet_x', 'consul', 'acl_base.rb')) Puppet::Type.type(:consul_token).provide( - :default, - ) do + :default +) do mk_resource_methods def self.prefetch(resources) @@ -20,9 +20,7 @@ def self.prefetch(resources) def self.list_tokens(acl_api_token, hostname, port, protocol, tries) @token_collection ||= nil - if @token_collection - return @token_collection - end + return @token_collection if @token_collection @client ||= ConsulACLTokenClient.new(hostname, port, protocol, acl_api_token) @token_collection = @client.get_token_list(tries) @@ -68,7 +66,7 @@ def destroy def flush if @resource[:ensure] != :absent && !@existing_token created_token = @client.create_token(@resource[:accessor_id], @resource[:name], @resource[:policies_by_name], @resource[:policies_by_id], @resource[:api_tries], -@resource[:secret_id] ? @resource[:secret_id] : nil) + @resource[:secret_id] || nil) @resource[:accessor_id] = created_token.accessor_id @resource[:secret_id] = created_token.secret_id @@ -95,8 +93,8 @@ def self.reset end class ConsulToken - attr_reader :accessor_id, :secret_id, :description, :policies - attr_writer :policies, :description + attr_accessor :description, :policies + attr_reader :accessor_id, :secret_id def initialize(accessor_id, secret_id, description, policies) @accessor_id = accessor_id @@ -107,9 +105,7 @@ def initialize(accessor_id, secret_id, description, policies) def is_policy_list_equal(policies_by_id, policies_by_name) total_length = (policies_by_id.length + policies_by_name.length) - if @policies.length != total_length - return false - end + return false if @policies.length != total_length actual_policies_by_id = @policies.map(&:policy_id) actual_policies_by_name = @policies.map(&:policy_name) @@ -171,18 +167,14 @@ def update_token(accessor_id, description, policies_by_name, policies_by_id) def delete_token(accessor_id) response = delete('/token/' + accessor_id) - if response == 'false' - raise 'Consul API returned false as response' - end + raise 'Consul API returned false as response' if response == 'false' rescue StandardError => e Puppet.warning("Unable to delete token #{accessor_id}: #{e.message}") nil end def parse_policies(response) - unless response - return [] - end + return [] unless response policy_links = [] response.each do |policy| @@ -208,9 +200,7 @@ def encode_body(accessor_id, description, policies_by_name, policies_by_id, secr body.store('Local', false) body.store('Policies', policies) - if !secret_id.nil? && !secret_id.to_s.strip.empty? - body.store('SecretID', secret_id) - end + body.store('SecretID', secret_id) if !secret_id.nil? && !secret_id.to_s.strip.empty? body end diff --git a/lib/puppet/type/consul_policy.rb b/lib/puppet/type/consul_policy.rb index 935e177e..603746ef 100644 --- a/lib/puppet/type/consul_policy.rb +++ b/lib/puppet/type/consul_policy.rb @@ -42,11 +42,11 @@ raise ArgumentError, 'Policy rule must be a hash' unless value.is_a?(Hash) raise ArgumentError, 'Policy rule needs to specify a resource' unless value.key?('resource') - raise ArgumentError, 'Policy rule needs to specify a segment' unless value.key?('segment') || ['acl', 'operator', 'keyring'].include?(value['resource']) + raise ArgumentError, 'Policy rule needs to specify a segment' unless value.key?('segment') || %w[acl operator keyring].include?(value['resource']) raise ArgumentError, 'Policy rule needs to specify a disposition' unless value.key?('disposition') raise ArgumentError, 'Policy rule resource must be a string' unless value['resource'].is_a?(String) - raise ArgumentError, 'Policy rule segment must be a string' unless value['segment'].is_a?(String) || ['acl', 'operator', 'keyring'].include?(value['resource']) + raise ArgumentError, 'Policy rule segment must be a string' unless value['segment'].is_a?(String) || %w[acl operator keyring].include?(value['resource']) raise ArgumentError, 'Policy rule disposition must be a string' unless value['disposition'].is_a?(String) end diff --git a/lib/puppet_x/consul/acl_base.rb b/lib/puppet_x/consul/acl_base.rb index 194dac76..5cacb95d 100644 --- a/lib/puppet_x/consul/acl_base.rb +++ b/lib/puppet_x/consul/acl_base.rb @@ -39,9 +39,7 @@ def send_request(request, tries = 1, json_response = true) response_code = nil response = nil - unless @api_token.nil? - request['X-Consul-Token'] = @api_token - end + request['X-Consul-Token'] = @api_token unless @api_token.nil? (1..tries).each do |i| unless i == 1 @@ -53,8 +51,8 @@ def send_request(request, tries = 1, json_response = true) response = @http_client.request(request) response_code = response.code break if response_code == '200' - rescue Errno::ECONNREFUSED => exc - Puppet.debug("#{exc.class} #{exc.message}") + rescue Errno::ECONNREFUSED => e + Puppet.debug("#{e.class} #{e.message}") end end diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index 3788da05..3083800f 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -35,6 +35,7 @@ class { 'consul': its(:stdout) { is_expected.to match %r{Consul v1.0.5} } end end + context 'default parameters' do it 'works with no errors based on the example' do pp = <<-EOS @@ -70,6 +71,7 @@ class { 'consul': its(:stdout) { is_expected.to match %r{Consul v1.1.0} } end end + context 'with performance options' do it 'works with no errors based on the example' do pp = <<-EOS @@ -108,6 +110,7 @@ class { 'consul': its(:stdout) { is_expected.to match %r{Consul v1.2.0} } end end + context 'with performance options' do it 'works with no errors based on the example' do pp = <<-EOS @@ -146,6 +149,7 @@ class { 'consul': its(:stdout) { is_expected.to match %r{Consul v1.2.3} } end end + context 'with new ACL system' do acl_master_token = '222bf65c-2477-4003-8f8e-842a4b394d8d' diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 65fba88c..5edd18aa 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -3,6 +3,7 @@ describe 'consul' do on_supported_os.each do |os, facts| next unless facts[:kernel] == 'Linux' + puts "on #{os}" context "on #{os}" do provider = case facts[:os]['family'] @@ -93,7 +94,7 @@ let(:params) do { install_method: 'url', - manage_repo: true + manage_repo: true } end @@ -109,7 +110,7 @@ let(:params) do { install_method: 'package', - manage_repo: true + manage_repo: true } end @@ -135,8 +136,8 @@ let(:params) do { install_method: 'package', - package_ensure: 'specific_release', - package_name: 'custom_consul_package' + package_ensure: 'specific_release', + package_name: 'custom_consul_package' } end @@ -276,7 +277,7 @@ context 'The bootstrap_expect in config_hash is an int' do let(:params) do { - config_hash: { 'bootstrap_expect' => '5' } + config_hash: { 'bootstrap_expect' => '5' } } end @@ -290,9 +291,9 @@ config_defaults: { 'data_dir' => '/dir1', }, - config_hash: { - 'bootstrap_expect' => '5', - } + config_hash: { + 'bootstrap_expect' => '5', + } } end @@ -305,20 +306,20 @@ { config_defaults: { 'data_dir' => '/dir1', - 'server' => false, - 'ports' => { - 'http' => 1, - 'https' => '8300', - }, + 'server' => false, + 'ports' => { + 'http' => 1, + 'https' => '8300', + }, }, - config_hash: { - 'bootstrap_expect' => '5', - 'server' => true, - 'ports' => { - 'http' => -1, - 'https' => '8500', - }, - } + config_hash: { + 'bootstrap_expect' => '5', + 'server' => true, + 'ports' => { + 'http' => -1, + 'https' => '8500', + }, + } } end @@ -333,14 +334,14 @@ let(:params) do { pretty_config: true, - config_hash: { - 'bootstrap_expect' => '5', - 'server' => true, - 'ports' => { - 'http' => -1, - 'https' => 8500, - }, - } + config_hash: { + 'bootstrap_expect' => '5', + 'server' => true, + 'ports' => { + 'http' => -1, + 'https' => 8500, + }, + } } end @@ -373,11 +374,11 @@ let(:params) do { service_ensure: 'stopped', - services: { - 'test_service1' => { - 'port' => 8088 - } - } + services: { + 'test_service1' => { + 'port' => 8088 + } + } } end @@ -388,11 +389,11 @@ let(:params) do { manage_service: false, - services: { - 'test_service1' => { - 'port' => 8088 - } - } + services: { + 'test_service1' => { + 'port' => 8088 + } + } } end @@ -403,7 +404,7 @@ let(:params) do { user: 'custom_consul_user', - group: 'custom_consul_group', + group: 'custom_consul_group', } end @@ -415,27 +416,30 @@ let(:params) do { user: 'custom_consul_user', - group: 'custom_consul_group', - config_mode: '0600', + group: 'custom_consul_group', + config_mode: '0600', } end it { is_expected.to contain_file('consul config').with( - owner: 'custom_consul_user', - group: 'custom_consul_group', - mode: '0600', - ) + owner: 'custom_consul_user', + group: 'custom_consul_group', + mode: '0600' + ) } end - context "Config with custom config owner" do - let(:params) {{ - :config_owner => 'custom_consul_user', - :config_dir => '/etc/custom_consul_dir', - }} - it { should contain_file('consul config').with(:owner => 'custom_consul_user') } - it { should contain_file('/etc/custom_consul_dir').with(:owner => 'custom_consul_user') } + context 'Config with custom config owner' do + let(:params) do + { + config_owner: 'custom_consul_user', + config_dir: '/etc/custom_consul_dir', + } + end + + it { is_expected.to contain_file('consul config').with(owner: 'custom_consul_user') } + it { is_expected.to contain_file('/etc/custom_consul_dir').with(owner: 'custom_consul_user') } end context 'When consul is reloaded' do @@ -448,8 +452,8 @@ end it { - is_expected.to contain_exec('reload consul service') - .with_command('consul reload -http-addr=127.0.0.1:8500') + is_expected.to contain_exec('reload consul service'). + with_command('consul reload -http-addr=127.0.0.1:8500') } end @@ -459,20 +463,20 @@ services: { 'test_service1' => {} }, - config_hash: { - 'ports' => { - 'http' => 9999 - }, - 'addresses' => { - 'http' => 'consul.example.com' - } - } + config_hash: { + 'ports' => { + 'http' => 9999 + }, + 'addresses' => { + 'http' => 'consul.example.com' + } + } } end it { - is_expected.to contain_exec('reload consul service') - .with_command('consul reload -http-addr=consul.example.com:9999') + is_expected.to contain_exec('reload consul service'). + with_command('consul reload -http-addr=consul.example.com:9999') } end @@ -482,15 +486,15 @@ services: { 'test_service1' => {} }, - config_hash: { - 'client_addr' => '192.168.34.56', - } + config_hash: { + 'client_addr' => '192.168.34.56', + } } end it { - is_expected.to contain_exec('reload consul service') - .with_command('consul reload -http-addr=192.168.34.56:8500') + is_expected.to contain_exec('reload consul service'). + with_command('consul reload -http-addr=192.168.34.56:8500') } end @@ -516,7 +520,7 @@ watches: { 'test_watch1' => { 'type' => 'nodes', - 'handler' => 'test.sh', + 'handler' => 'test.sh', } } } @@ -534,7 +538,7 @@ checks: { 'test_check1' => { 'interval' => '30', - 'script' => 'test.sh', + 'script' => 'test.sh', } } } @@ -550,27 +554,27 @@ let(:params) do { config_hash: { - 'data_dir' => '/cust/consul', + 'data_dir' => '/cust/consul', 'datacenter' => 'devint', - 'log_level' => 'INFO', - 'node_name' => '${fqdn}' + 'log_level' => 'INFO', + 'node_name' => '${fqdn}' }, - watches: { - 'services' => { - 'type' => 'services', - 'handler' => 'sudo python /usr/local/bin/reacktor services' - }, - 'httpd_service' => { - 'type' => 'service', - 'service' => 'httpd', - 'handler' => 'sudo python /usr/local/bin/reacktor service --service httpd' - }, - 'tomcat_service' => { - 'type' => 'service', - 'service' => 'tomcat', - 'handler' => 'sudo python /usr/local/bin/reacktor service --service tomcat' - } - } + watches: { + 'services' => { + 'type' => 'services', + 'handler' => 'sudo python /usr/local/bin/reacktor services' + }, + 'httpd_service' => { + 'type' => 'service', + 'service' => 'httpd', + 'handler' => 'sudo python /usr/local/bin/reacktor service --service httpd' + }, + 'tomcat_service' => { + 'type' => 'service', + 'service' => 'tomcat', + 'handler' => 'sudo python /usr/local/bin/reacktor service --service tomcat' + } + } } end @@ -587,9 +591,10 @@ end it { is_expected.to contain_class('consul').with_init_style('init') } + it { - is_expected.to contain_file('/etc/init.d/consul') - .with_content(%r{-http-addr=127.0.0.1:8500}) + is_expected.to contain_file('/etc/init.d/consul'). + with_content(%r{-http-addr=127.0.0.1:8500}) } end @@ -597,21 +602,22 @@ let(:params) do { init_style: 'init', - config_hash: { - 'ports' => { - 'http' => 9999 - }, - 'addresses' => { - 'http' => 'consul.example.com' - } - } + config_hash: { + 'ports' => { + 'http' => 9999 + }, + 'addresses' => { + 'http' => 'consul.example.com' + } + } } end it { is_expected.to contain_class('consul').with_init_style('init') } + it { - is_expected.to contain_file('/etc/init.d/consul') - .with_content(%r{-http-addr=consul.example.com:9999}) + is_expected.to contain_file('/etc/init.d/consul'). + with_content(%r{-http-addr=consul.example.com:9999}) } end @@ -619,16 +625,17 @@ let(:params) do { init_style: 'init', - config_hash: { - 'client_addr' => '192.168.34.56', - } + config_hash: { + 'client_addr' => '192.168.34.56', + } } end it { is_expected.to contain_class('consul').with_init_style('init') } + it { - is_expected.to contain_file('/etc/init.d/consul') - .with_content(%r{-http-addr=192.168.34.56:8500}) + is_expected.to contain_file('/etc/init.d/consul'). + with_content(%r{-http-addr=192.168.34.56:8500}) } end @@ -640,9 +647,10 @@ end it { is_expected.to contain_class('consul').with_init_style('debian') } + it { - is_expected.to contain_file('/etc/init.d/consul') - .with_content(%r{-http-addr=127.0.0.1:8500}) + is_expected.to contain_file('/etc/init.d/consul'). + with_content(%r{-http-addr=127.0.0.1:8500}) } end @@ -650,21 +658,22 @@ let(:params) do { init_style: 'debian', - config_hash: { - 'ports' => { - 'http' => 9999 - }, - 'addresses' => { - 'http' => 'consul.example.com' - } - } + config_hash: { + 'ports' => { + 'http' => 9999 + }, + 'addresses' => { + 'http' => 'consul.example.com' + } + } } end it { is_expected.to contain_class('consul').with_init_style('debian') } + it { - is_expected.to contain_file('/etc/init.d/consul') - .with_content(%r{-http-addr=consul.example.com:9999}) + is_expected.to contain_file('/etc/init.d/consul'). + with_content(%r{-http-addr=consul.example.com:9999}) } end @@ -676,9 +685,10 @@ end it { is_expected.to contain_class('consul').with_init_style('upstart') } + it { - is_expected.to contain_file('/etc/init/consul.conf') - .with_content(%r{-http-addr=127.0.0.1:8500}) + is_expected.to contain_file('/etc/init/consul.conf'). + with_content(%r{-http-addr=127.0.0.1:8500}) } end @@ -686,23 +696,25 @@ let(:params) do { init_style: 'upstart', - config_hash: { - 'ports' => { - 'http' => 9999 - }, - 'addresses' => { - 'http' => 'consul.example.com' - } - } + config_hash: { + 'ports' => { + 'http' => 9999 + }, + 'addresses' => { + 'http' => 'consul.example.com' + } + } } end it { is_expected.to contain_class('consul').with_init_style('upstart') } + it { - is_expected.to contain_file('/etc/init/consul.conf') - .with_content(%r{-http-addr=consul.example.com:9999}) + is_expected.to contain_file('/etc/init/consul.conf'). + with_content(%r{-http-addr=consul.example.com:9999}) } end + context 'When asked not to manage the init system' do let(:params) { { init_style: 'unmanaged' } } @@ -710,6 +722,7 @@ it { is_expected.not_to contain_file('/etc/init.d/consul') } it { is_expected.not_to contain_file('/etc/systemd/system/consul.service') } end + case facts[:os]['family'] when 'RedHat' if facts[:os]['release']['major'].to_i == 6 @@ -749,11 +762,12 @@ if facts[:os]['release']['major'].to_i < 14 context 'On legacy Ubuntu' do it { is_expected.to contain_class('consul') } + it { - is_expected.to contain_file('/etc/init.d/consul') \ - .with_content(%r{start-stop-daemon .* \$DAEMON}) \ - .with_content(%r{DAEMON_ARGS="agent}) \ - .with_content(%r{--user \$USER}) + is_expected.to contain_file('/etc/init.d/consul'). \ + with_content(%r{start-stop-daemon .* \$DAEMON}). \ + with_content(%r{DAEMON_ARGS="agent}). \ + with_content(%r{--user \$USER}) } end elsif facts[:os]['release']['major'].to_i > 15 diff --git a/spec/defines/consul_check_spec.rb b/spec/defines/consul_check_spec.rb index ad776732..3913e22c 100644 --- a/spec/defines/consul_check_spec.rb +++ b/spec/defines/consul_check_spec.rb @@ -3,7 +3,8 @@ describe 'consul::check' do on_supported_os.each do |os, facts| next unless facts[:kernel] == 'Linux' - context "on #{os} " do + + context "on #{os}" do let :facts do facts end @@ -19,147 +20,156 @@ end } end + describe 'with script' do let(:params) do { 'interval' => '30s', - 'script' => 'true' + 'script' => 'true' } end it { - is_expected.to contain_file('/etc/consul/check_my_check.json') \ - .with_content(%r{"id" *: *"my_check"}) \ - .with_content(%r{"name" *: *"my_check"}) \ - .with_content(%r{"check" *: *\{}) \ - .with_content(%r{"interval" *: *"30s"}) \ - .with_content(%r{"script" *: *"true"}) + is_expected.to contain_file('/etc/consul/check_my_check.json'). \ + with_content(%r{"id" *: *"my_check"}). \ + with_content(%r{"name" *: *"my_check"}). \ + with_content(%r{"check" *: *\{}). \ + with_content(%r{"interval" *: *"30s"}). \ + with_content(%r{"script" *: *"true"}) } end + describe 'with args' do let(:params) do { 'interval' => '30s', - 'args' => ['sh', '-c', 'true', '1', 2], + 'args' => ['sh', '-c', 'true', '1', 2], } end it { - is_expected.to contain_file('/etc/consul/check_my_check.json') \ - .with_content(%r{"id" *: *"my_check"}) \ - .with_content(%r{"name" *: *"my_check"}) \ - .with_content(%r{"check" *: *\{}) \ - .with_content(%r{"interval" *: *"30s"}) \ - .with_content(%r{"args" *: *\[ *"sh", *"-c", *"true", *"1", *"2" *\]}) + is_expected.to contain_file('/etc/consul/check_my_check.json'). \ + with_content(%r{"id" *: *"my_check"}). \ + with_content(%r{"name" *: *"my_check"}). \ + with_content(%r{"check" *: *\{}). \ + with_content(%r{"interval" *: *"30s"}). \ + with_content(%r{"args" *: *\[ *"sh", *"-c", *"true", *"1", *"2" *\]}) } end + describe 'with script and service_id' do let(:params) do { 'interval' => '30s', - 'script' => 'true', - 'service_id' => 'my_service' + 'script' => 'true', + 'service_id' => 'my_service' } end it { - is_expected.to contain_file('/etc/consul/check_my_check.json') \ - .with_content(%r{"id" *: *"my_check"}) \ - .with_content(%r{"name" *: *"my_check"}) \ - .with_content(%r{"check" *: *\{}) \ - .with_content(%r{"interval" *: *"30s"}) \ - .with_content(%r{"script" *: *"true"}) \ - .with_content(%r{"service_id" *: *"my_service"}) + is_expected.to contain_file('/etc/consul/check_my_check.json'). \ + with_content(%r{"id" *: *"my_check"}). \ + with_content(%r{"name" *: *"my_check"}). \ + with_content(%r{"check" *: *\{}). \ + with_content(%r{"interval" *: *"30s"}). \ + with_content(%r{"script" *: *"true"}). \ + with_content(%r{"service_id" *: *"my_service"}) } end + describe 'reload service with script and token' do let(:params) do { 'interval' => '30s', - 'script' => 'true', - 'token' => 'too-cool-for-this-script' + 'script' => 'true', + 'token' => 'too-cool-for-this-script' } end it { - is_expected.to contain_file('/etc/consul/check_my_check.json') \ - .with_content(%r{"id" *: *"my_check"}) \ - .with_content(%r{"name" *: *"my_check"}) \ - .with_content(%r{"interval" *: *"30s"}) \ - .with_content(%r{"script" *: *"true"}) \ - .with_content(%r{"token" *: *"too-cool-for-this-script"}) \ - .that_notifies('Class[consul::reload_service]') \ + is_expected.to contain_file('/etc/consul/check_my_check.json'). \ + with_content(%r{"id" *: *"my_check"}). \ + with_content(%r{"name" *: *"my_check"}). \ + with_content(%r{"interval" *: *"30s"}). \ + with_content(%r{"script" *: *"true"}). \ + with_content(%r{"token" *: *"too-cool-for-this-script"}). \ + that_notifies('Class[consul::reload_service]') \ } end + describe 'with http' do let(:params) do { 'interval' => '30s', - 'http' => 'localhost' + 'http' => 'localhost' } end it { - is_expected.to contain_file('/etc/consul/check_my_check.json') \ - .with_content(%r{"id" *: *"my_check"}) \ - .with_content(%r{"name" *: *"my_check"}) \ - .with_content(%r{"check" *: *\{}) \ - .with_content(%r{"interval" *: *"30s"}) \ - .with_content(%r{"http" *: *"localhost"}) \ + is_expected.to contain_file('/etc/consul/check_my_check.json'). \ + with_content(%r{"id" *: *"my_check"}). \ + with_content(%r{"name" *: *"my_check"}). \ + with_content(%r{"check" *: *\{}). \ + with_content(%r{"interval" *: *"30s"}). \ + with_content(%r{"http" *: *"localhost"}) \ } end + describe 'with http and service_id' do let(:params) do { 'interval' => '30s', - 'http' => 'localhost', - 'service_id' => 'my_service' + 'http' => 'localhost', + 'service_id' => 'my_service' } end it { - is_expected.to contain_file('/etc/consul/check_my_check.json') \ - .with_content(%r{"id" *: *"my_check"}) \ - .with_content(%r{"name" *: *"my_check"}) \ - .with_content(%r{"check" *: *\{}) \ - .with_content(%r{"interval" *: *"30s"}) \ - .with_content(%r{"http" *: *"localhost"}) \ - .with_content(%r{"service_id" *: *"my_service"}) + is_expected.to contain_file('/etc/consul/check_my_check.json'). \ + with_content(%r{"id" *: *"my_check"}). \ + with_content(%r{"name" *: *"my_check"}). \ + with_content(%r{"check" *: *\{}). \ + with_content(%r{"interval" *: *"30s"}). \ + with_content(%r{"http" *: *"localhost"}). \ + with_content(%r{"service_id" *: *"my_service"}) } end + describe 'reload service with http and token' do let(:params) do { 'interval' => '30s', - 'http' => 'localhost', - 'token' => 'too-cool-for-this-http' + 'http' => 'localhost', + 'token' => 'too-cool-for-this-http' } end it { - is_expected.to contain_file('/etc/consul/check_my_check.json') \ - .with_content(%r{"id" *: *"my_check"}) \ - .with_content(%r{"name" *: *"my_check"}) \ - .with_content(%r{"interval" *: *"30s"}) \ - .with_content(%r{"http" *: *"localhost"}) \ - .with_content(%r{"token" *: *"too-cool-for-this-http"}) \ - .that_notifies('Class[consul::reload_service]') \ + is_expected.to contain_file('/etc/consul/check_my_check.json'). \ + with_content(%r{"id" *: *"my_check"}). \ + with_content(%r{"name" *: *"my_check"}). \ + with_content(%r{"interval" *: *"30s"}). \ + with_content(%r{"http" *: *"localhost"}). \ + with_content(%r{"token" *: *"too-cool-for-this-http"}). \ + that_notifies('Class[consul::reload_service]') \ } end + describe 'with http and removed undef values' do let(:params) do { 'interval' => '30s', - 'http' => 'localhost' + 'http' => 'localhost' } end it { - is_expected.to contain_file('/etc/consul/check_my_check.json') \ - .without_content(%r{"service_id"}) \ - .without_content(%r{"notes"}) + is_expected.to contain_file('/etc/consul/check_my_check.json'). \ + without_content(%r{"service_id"}). \ + without_content(%r{"notes"}) } end + describe 'with ttl' do let(:params) do { @@ -168,107 +178,113 @@ end it { - is_expected.to contain_file('/etc/consul/check_my_check.json') \ - .with_content(%r{"id" *: *"my_check"}) \ - .with_content(%r{"name" *: *"my_check"}) \ - .with_content(%r{"check" *: *\{}) \ - .with_content(%r{"ttl" *: *"30s"}) + is_expected.to contain_file('/etc/consul/check_my_check.json'). \ + with_content(%r{"id" *: *"my_check"}). \ + with_content(%r{"name" *: *"my_check"}). \ + with_content(%r{"check" *: *\{}). \ + with_content(%r{"ttl" *: *"30s"}) } end + describe 'with ttl and service_id' do let(:params) do { 'ttl' => '30s', - 'service_id' => 'my_service' + 'service_id' => 'my_service' } end it { - is_expected.to contain_file('/etc/consul/check_my_check.json') \ - .with_content(%r{"id" *: *"my_check"}) \ - .with_content(%r{"name" *: *"my_check"}) \ - .with_content(%r{"check" *: *\{}) \ - .with_content(%r{"ttl" *: *"30s"}) \ - .with_content(%r{"service_id" *: *"my_service"}) + is_expected.to contain_file('/etc/consul/check_my_check.json'). \ + with_content(%r{"id" *: *"my_check"}). \ + with_content(%r{"name" *: *"my_check"}). \ + with_content(%r{"check" *: *\{}). \ + with_content(%r{"ttl" *: *"30s"}). \ + with_content(%r{"service_id" *: *"my_service"}) } end + describe 'reload service with ttl and token' do let(:params) do { 'ttl' => '30s', - 'token' => 'too-cool-for-this-ttl' + 'token' => 'too-cool-for-this-ttl' } end it { - is_expected.to contain_file('/etc/consul/check_my_check.json') \ - .with_content(%r{"id" *: *"my_check"}) \ - .with_content(%r{"name" *: *"my_check"}) \ - .with_content(%r{"ttl" *: *"30s"}) \ - .with_content(%r{"token" *: *"too-cool-for-this-ttl"}) \ - .that_notifies('Class[consul::reload_service]') \ + is_expected.to contain_file('/etc/consul/check_my_check.json'). \ + with_content(%r{"id" *: *"my_check"}). \ + with_content(%r{"name" *: *"my_check"}). \ + with_content(%r{"ttl" *: *"30s"}). \ + with_content(%r{"token" *: *"too-cool-for-this-ttl"}). \ + that_notifies('Class[consul::reload_service]') \ } end + describe 'with tcp' do let(:params) do { 'tcp' => 'localhost:80', - 'interval' => '30s', + 'interval' => '30s', } end it { - is_expected.to contain_file('/etc/consul/check_my_check.json') \ - .with_content(%r{"id" *: *"my_check"}) \ - .with_content(%r{"name" *: *"my_check"}) \ - .with_content(%r{"check" *: *\{}) \ - .with_content(%r{"tcp" *: *"localhost:80"}) \ - .with_content(%r{"interval" *: *"30s"}) + is_expected.to contain_file('/etc/consul/check_my_check.json'). \ + with_content(%r{"id" *: *"my_check"}). \ + with_content(%r{"name" *: *"my_check"}). \ + with_content(%r{"check" *: *\{}). \ + with_content(%r{"tcp" *: *"localhost:80"}). \ + with_content(%r{"interval" *: *"30s"}) } end + describe 'with script and service_id' do let(:params) do { 'tcp' => 'localhost:80', - 'interval' => '30s', - 'service_id' => 'my_service' + 'interval' => '30s', + 'service_id' => 'my_service' } end it { - is_expected.to contain_file('/etc/consul/check_my_check.json') \ - .with_content(%r{"id" *: *"my_check"}) \ - .with_content(%r{"name" *: *"my_check"}) \ - .with_content(%r{"check" *: *\{}) \ - .with_content(%r{"tcp" *: *"localhost:80"}) \ - .with_content(%r{"interval" *: *"30s"}) \ - .with_content(%r{"service_id" *: *"my_service"}) + is_expected.to contain_file('/etc/consul/check_my_check.json'). \ + with_content(%r{"id" *: *"my_check"}). \ + with_content(%r{"name" *: *"my_check"}). \ + with_content(%r{"check" *: *\{}). \ + with_content(%r{"tcp" *: *"localhost:80"}). \ + with_content(%r{"interval" *: *"30s"}). \ + with_content(%r{"service_id" *: *"my_service"}) } end + describe 'reload service with script and token' do let(:params) do { 'tcp' => 'localhost:80', - 'interval' => '30s', - 'token' => 'too-cool-for-this-script' + 'interval' => '30s', + 'token' => 'too-cool-for-this-script' } end it { - is_expected.to contain_file('/etc/consul/check_my_check.json') \ - .with_content(%r{"id" *: *"my_check"}) \ - .with_content(%r{"name" *: *"my_check"}) \ - .with_content(%r{"tcp" *: *"localhost:80"}) \ - .with_content(%r{"interval" *: *"30s"}) \ - .with_content(%r{"token" *: *"too-cool-for-this-script"}) \ - .that_notifies('Class[consul::reload_service]') \ + is_expected.to contain_file('/etc/consul/check_my_check.json'). \ + with_content(%r{"id" *: *"my_check"}). \ + with_content(%r{"name" *: *"my_check"}). \ + with_content(%r{"tcp" *: *"localhost:80"}). \ + with_content(%r{"interval" *: *"30s"}). \ + with_content(%r{"token" *: *"too-cool-for-this-script"}). \ + that_notifies('Class[consul::reload_service]') \ } end + describe 'with both ttl and interval' do let(:params) do { 'ttl' => '30s', - 'interval' => '60s' + 'interval' => '60s' } end @@ -276,12 +292,13 @@ is_expected.to raise_error(Puppet::Error, %r{script, http, tcp, and interval must not be defined for ttl checks}) } end + describe 'with both ttl and script' do let(:params) do { 'ttl' => '30s', - 'script' => 'true', - 'interval' => '60s' + 'script' => 'true', + 'interval' => '60s' } end @@ -289,12 +306,13 @@ is_expected.to raise_error(Puppet::Error, %r{script, http, tcp, and interval must not be defined for ttl checks}) } end + describe 'with both ttl and http' do let(:params) do { 'ttl' => '30s', - 'http' => 'http://localhost/health', - 'interval' => '60s' + 'http' => 'http://localhost/health', + 'interval' => '60s' } end @@ -302,12 +320,13 @@ is_expected.to raise_error(Puppet::Error, %r{script, http, tcp, and interval must not be defined for ttl checks}) } end + describe 'with both ttl and tcp' do let(:params) do { 'ttl' => '30s', - 'tcp' => 'localhost', - 'interval' => '60s' + 'tcp' => 'localhost', + 'interval' => '60s' } end @@ -315,12 +334,13 @@ is_expected.to raise_error(Puppet::Error, %r{script, http, tcp, and interval must not be defined for ttl checks}) } end + describe 'with both script and http' do let(:params) do { 'script' => 'true', - 'http' => 'http://localhost/health', - 'interval' => '60s' + 'http' => 'http://localhost/health', + 'interval' => '60s' } end @@ -328,6 +348,7 @@ is_expected.to raise_error(Puppet::Error, %r{script and tcp must not be defined for http checks}) } end + describe 'with script but no interval' do let(:params) do { @@ -339,6 +360,7 @@ is_expected.to raise_error(Puppet::Error, %r{interval must be defined for tcp, http, and script checks}) } end + describe 'with http but no interval' do let(:params) do { @@ -350,6 +372,7 @@ is_expected.to raise_error(Puppet::Error, %r{interval must be defined for tcp, http, and script checks}) } end + describe 'with tcp but no interval' do let(:params) do { @@ -361,32 +384,34 @@ is_expected.to raise_error(Puppet::Error, %r{interval must be defined for tcp, http, and script checks}) } end + describe 'with a / in the id' do let(:params) do { 'ttl' => '30s', - 'service_id' => 'my_service', - 'id' => 'aa/bb', + 'service_id' => 'my_service', + 'id' => 'aa/bb', } end it { - is_expected.to contain_file('/etc/consul/check_aa_bb.json') \ - .with_content(%r{"id" *: *"aa/bb"}) + is_expected.to contain_file('/etc/consul/check_aa_bb.json'). \ + with_content(%r{"id" *: *"aa/bb"}) } end + describe 'with multiple / in the id' do let(:params) do { 'ttl' => '30s', - 'service_id' => 'my_service', - 'id' => 'aa/bb/cc', + 'service_id' => 'my_service', + 'id' => 'aa/bb/cc', } end it { - is_expected.to contain_file('/etc/consul/check_aa_bb_cc.json') \ - .with_content(%r{"id" *: *"aa/bb/cc"}) + is_expected.to contain_file('/etc/consul/check_aa_bb_cc.json'). \ + with_content(%r{"id" *: *"aa/bb/cc"}) } end end diff --git a/spec/defines/consul_service_spec.rb b/spec/defines/consul_service_spec.rb index 7024ca23..83b8f629 100644 --- a/spec/defines/consul_service_spec.rb +++ b/spec/defines/consul_service_spec.rb @@ -3,7 +3,8 @@ describe 'consul::service' do on_supported_os.each do |os, facts| next unless facts[:kernel] == 'Linux' - context "on #{os} " do + + context "on #{os}" do let :facts do facts end @@ -13,26 +14,28 @@ let(:params) { {} } it { - is_expected.to contain_file('/etc/consul/service_my_service.json') \ - .with_content(%r{"service" *: *\{}) \ - .with_content(%r{"id" *: *"my_service"}) \ - .with_content(%r{"name" *: *"my_service"}) \ - .with_content(%r{"enable_tag_override" *: *false}) + is_expected.to contain_file('/etc/consul/service_my_service.json'). \ + with_content(%r{"service" *: *\{}). \ + with_content(%r{"id" *: *"my_service"}). \ + with_content(%r{"name" *: *"my_service"}). \ + with_content(%r{"enable_tag_override" *: *false}) } end + describe 'with no args ( consul version not less than 1.1.0 )' do let(:pre_condition) do 'class { "consul": version => "1.1.0" }' end it { - is_expected.to contain_file('/etc/consul/service_my_service.json') \ - .with_content(%r{"service" *: *\{}) \ - .with_content(%r{"id" *: *"my_service"}) \ - .with_content(%r{"name" *: *"my_service"}) \ - .with_content(%r{"enable_tag_override" *: *false}) + is_expected.to contain_file('/etc/consul/service_my_service.json'). \ + with_content(%r{"service" *: *\{}). \ + with_content(%r{"id" *: *"my_service"}). \ + with_content(%r{"name" *: *"my_service"}). \ + with_content(%r{"enable_tag_override" *: *false}) } end + describe 'with different ensure' do let(:params) do { @@ -41,16 +44,18 @@ end it { - is_expected.to contain_file('/etc/consul/service_my_service.json') \ - .with('ensure' => 'absent') + is_expected.to contain_file('/etc/consul/service_my_service.json'). \ + with('ensure' => 'absent') } end + describe 'notify reload service' do it { - is_expected.to contain_file('/etc/consul/service_my_service.json') \ - .that_notifies('Class[consul::reload_service]') + is_expected.to contain_file('/etc/consul/service_my_service.json'). \ + that_notifies('Class[consul::reload_service]') } end + describe 'with service name' do let(:params) do { @@ -59,12 +64,13 @@ end it { - is_expected.to contain_file('/etc/consul/service_my_service.json') \ - .with_content(%r{"service" *: *\{}) \ - .with_content(%r{"id" *: *"my_service"}) \ - .with_content(%r{"name" *: *"different_name"}) + is_expected.to contain_file('/etc/consul/service_my_service.json'). \ + with_content(%r{"service" *: *\{}). \ + with_content(%r{"id" *: *"my_service"}). \ + with_content(%r{"name" *: *"different_name"}) } end + describe 'with enable_tag_override' do let(:params) do { @@ -73,29 +79,31 @@ end it { - is_expected.to contain_file('/etc/consul/service_my_service.json') \ - .with_content(%r{"service" *: *\{}) \ - .with_content(%r{"id" *: *"my_service"}) \ - .with_content(%r{"name" *: *"my_service"}) \ - .with_content(%r{"enable_tag_override" *: *true}) + is_expected.to contain_file('/etc/consul/service_my_service.json'). \ + with_content(%r{"service" *: *\{}). \ + with_content(%r{"id" *: *"my_service"}). \ + with_content(%r{"name" *: *"my_service"}). \ + with_content(%r{"enable_tag_override" *: *true}) } end + describe 'with service name and address' do let(:params) do { 'service_name' => 'different_name', - 'address' => '127.0.0.1', + 'address' => '127.0.0.1', } end it { - is_expected.to contain_file('/etc/consul/service_my_service.json') \ - .with_content(%r{"service" *: *\{}) \ - .with_content(%r{"id" *: *"my_service"}) \ - .with_content(%r{"name" *: *"different_name"}) \ - .with_content(%r{"address" *: *"127.0.0.1"}) + is_expected.to contain_file('/etc/consul/service_my_service.json'). \ + with_content(%r{"service" *: *\{}). \ + with_content(%r{"id" *: *"my_service"}). \ + with_content(%r{"name" *: *"different_name"}). \ + with_content(%r{"address" *: *"127.0.0.1"}) } end + describe 'with script and interval' do let(:params) do { @@ -109,12 +117,13 @@ end it { - is_expected.to contain_file('/etc/consul/service_my_service.json') \ - .with_content(%r{"checks" *: *\[}) \ - .with_content(%r{"interval" *: *"30s"}) \ - .with_content(%r{"script" *: *"true"}) + is_expected.to contain_file('/etc/consul/service_my_service.json'). \ + with_content(%r{"checks" *: *\[}). \ + with_content(%r{"interval" *: *"30s"}). \ + with_content(%r{"script" *: *"true"}) } end + describe 'with http and interval' do let(:params) do { @@ -128,12 +137,13 @@ end it { - is_expected.to contain_file('/etc/consul/service_my_service.json') \ - .with_content(%r{"checks" *: *\[}) \ - .with_content(%r{"interval" *: *"30s"}) \ - .with_content(%r{"http" *: *"localhost"}) + is_expected.to contain_file('/etc/consul/service_my_service.json'). \ + with_content(%r{"checks" *: *\[}). \ + with_content(%r{"interval" *: *"30s"}). \ + with_content(%r{"http" *: *"localhost"}) } end + describe 'with ttl' do let(:params) do { @@ -146,11 +156,12 @@ end it { - is_expected.to contain_file('/etc/consul/service_my_service.json') \ - .with_content(%r{"checks" *: *\[}) \ - .with_content(%r{"ttl" *: *"30s"}) + is_expected.to contain_file('/etc/consul/service_my_service.json'). \ + with_content(%r{"checks" *: *\[}). \ + with_content(%r{"ttl" *: *"30s"}) } end + describe 'with both ttl and interval' do let(:params) do { @@ -169,6 +180,7 @@ end } end + describe 'with port' do let(:params) do { @@ -177,19 +189,21 @@ 'ttl' => '30s', }, ], - 'port' => 5, + 'port' => 5, } end it { - is_expected.to contain_file('/etc/consul/service_my_service.json') \ - .with_content(%r{"port":5}) + is_expected.to contain_file('/etc/consul/service_my_service.json'). \ + with_content(%r{"port":5}) } + it { - is_expected.not_to contain_file('/etc/consul/service_my_service.json') \ - .with_content(%r{"port":"5"}) + is_expected.not_to contain_file('/etc/consul/service_my_service.json'). \ + with_content(%r{"port":"5"}) } end + describe 'with weight' do let(:params) do { @@ -203,20 +217,22 @@ end it { - is_expected.to contain_file('/etc/consul/service_my_service.json') \ - .with_content(%r{"passing":10}) + is_expected.to contain_file('/etc/consul/service_my_service.json'). \ + with_content(%r{"passing":10}) } + it { - is_expected.not_to contain_file('/etc/consul/service_my_service.json') \ - .with_content(%r{"passing":"10"}) + is_expected.not_to contain_file('/etc/consul/service_my_service.json'). \ + with_content(%r{"passing":"10"}) } end + describe 'with both ttl and script' do let(:params) do { 'checks' => [ { - 'ttl' => '30s', + 'ttl' => '30s', 'script' => 'true' }, ] @@ -229,6 +245,7 @@ end } end + describe 'with interval but no script' do let(:params) do { @@ -246,6 +263,7 @@ end } end + describe 'with multiple checks script and http' do let(:params) do { @@ -263,14 +281,15 @@ end it { - is_expected.to contain_file('/etc/consul/service_my_service.json') \ - .with_content(%r{"checks" *: *\[}) \ - .with_content(%r{"interval" *: *"30s"}) \ - .with_content(%r{"script" *: *"true"}) \ - .with_content(%r{"interval" *: *"10s"}) \ - .with_content(%r{"http" *: *"localhost"}) + is_expected.to contain_file('/etc/consul/service_my_service.json'). \ + with_content(%r{"checks" *: *\[}). \ + with_content(%r{"interval" *: *"30s"}). \ + with_content(%r{"script" *: *"true"}). \ + with_content(%r{"interval" *: *"10s"}). \ + with_content(%r{"http" *: *"localhost"}) } end + describe 'with a / in the id' do let(:params) do { @@ -279,10 +298,11 @@ end it { - is_expected.to contain_file('/etc/consul/service_aa_bb.json') \ - .with_content(%r{"id" *: *"aa/bb"}) + is_expected.to contain_file('/etc/consul/service_aa_bb.json'). \ + with_content(%r{"id" *: *"aa/bb"}) } end + describe 'with multiple / in the id' do let(:params) do { @@ -291,8 +311,8 @@ end it { - is_expected.to contain_file('/etc/consul/service_aa_bb_cc.json') \ - .with_content(%r{"id" *: *"aa/bb/cc"}) + is_expected.to contain_file('/etc/consul/service_aa_bb_cc.json'). \ + with_content(%r{"id" *: *"aa/bb/cc"}) } end @@ -317,6 +337,7 @@ end } end + describe 'with token' do let(:params) do { @@ -325,10 +346,11 @@ end it { - is_expected.to contain_file('/etc/consul/service_my_service.json') \ - .with_content(%r{"token" *: *"too-cool-for-this-service"}) + is_expected.to contain_file('/etc/consul/service_my_service.json'). \ + with_content(%r{"token" *: *"too-cool-for-this-service"}) } end + describe 'with meta' do let(:params) do { @@ -339,9 +361,9 @@ end it { - is_expected.to contain_file('/etc/consul/service_my_service.json') \ - .with_content(%r{"meta" *: *\{}) \ - .with_content(%r{"foo" *: *"bar"}) + is_expected.to contain_file('/etc/consul/service_my_service.json'). \ + with_content(%r{"meta" *: *\{}). \ + with_content(%r{"foo" *: *"bar"}) } end end diff --git a/spec/defines/consul_watch_spec.rb b/spec/defines/consul_watch_spec.rb index 0c717841..31c02d4f 100644 --- a/spec/defines/consul_watch_spec.rb +++ b/spec/defines/consul_watch_spec.rb @@ -3,7 +3,8 @@ describe 'consul::watch' do on_supported_os.each do |os, facts| next unless facts[:kernel] == 'Linux' - context "on #{os} " do + + context "on #{os}" do let :facts do facts end @@ -14,7 +15,7 @@ let(:params) do { 'type' => 'nodes', - 'handler' => 'handler_path', + 'handler' => 'handler_path', } end @@ -60,14 +61,14 @@ let(:params) do { 'type' => 'nodes', - 'handler' => 'handler_path', + 'handler' => 'handler_path', } end it { - is_expected.to contain_file('/etc/consul/watch_my_watch.json') \ - .with_content(%r{"handler" *: *"handler_path"}) \ - .with_content(%r{"type" *: *"nodes"}) + is_expected.to contain_file('/etc/consul/watch_my_watch.json'). \ + with_content(%r{"handler" *: *"handler_path"}). \ + with_content(%r{"type" *: *"nodes"}) } end @@ -75,14 +76,14 @@ let(:params) do { 'type' => 'nodes', - 'args' => ['sh', '-c', 'true'], + 'args' => ['sh', '-c', 'true'], } end it { - is_expected.to contain_file('/etc/consul/watch_my_watch.json') \ - .with_content(%r{"args" *: *\[ *"sh", *"-c", *"true" *\]}) \ - .with_content(%r{"type" *: *"nodes"}) + is_expected.to contain_file('/etc/consul/watch_my_watch.json'). \ + with_content(%r{"args" *: *\[ *"sh", *"-c", *"true" *\]}). \ + with_content(%r{"type" *: *"nodes"}) } end @@ -90,8 +91,8 @@ let(:params) do { 'type' => 'nodes', - 'handler' => 'handler_path', - 'args' => ['sh', '-c', 'true'], + 'handler' => 'handler_path', + 'args' => ['sh', '-c', 'true'], } end @@ -104,17 +105,17 @@ let(:params) do { 'type' => 'nodes', - 'handler' => 'handler_path', + 'handler' => 'handler_path', - 'datacenter' => 'dcName', - 'token' => 'tokenValue', + 'datacenter' => 'dcName', + 'token' => 'tokenValue', } end it { - is_expected.to contain_file('/etc/consul/watch_my_watch.json') \ - .with_content(%r{"datacenter" *: *"dcName"}) \ - .with_content(%r{"token" *: *"tokenValue"}) + is_expected.to contain_file('/etc/consul/watch_my_watch.json'). \ + with_content(%r{"datacenter" *: *"dcName"}). \ + with_content(%r{"token" *: *"tokenValue"}) } end @@ -124,7 +125,7 @@ let(:params) do { 'type' => 'key', - 'handler' => 'handler_path' + 'handler' => 'handler_path' } end @@ -132,20 +133,21 @@ expect { is_expected.to raise_error(Puppet::Error) } } end + context 'with key' do let(:params) do { 'type' => 'key', - 'handler' => 'handler_path', + 'handler' => 'handler_path', - 'key' => 'KeyName', + 'key' => 'KeyName', } end it { - is_expected.to contain_file('/etc/consul/watch_my_watch.json') \ - .with_content(%r{"type" *: *"key"}) \ - .with_content(%r{"key" *: *"KeyName"}) + is_expected.to contain_file('/etc/consul/watch_my_watch.json'). \ + with_content(%r{"type" *: *"key"}). \ + with_content(%r{"key" *: *"KeyName"}) } end end @@ -155,7 +157,7 @@ let(:params) do { 'type' => 'keyprefix', - 'handler' => 'handler_path' + 'handler' => 'handler_path' } end @@ -168,16 +170,16 @@ let(:params) do { 'type' => 'keyprefix', - 'handler' => 'handler_path', + 'handler' => 'handler_path', - 'keyprefix' => 'keyPref', + 'keyprefix' => 'keyPref', } end it { - is_expected.to contain_file('/etc/consul/watch_my_watch.json') \ - .with_content(%r{"type" *: *"keyprefix"}) \ - .with_content(%r{"prefix" *: *"keyPref"}) + is_expected.to contain_file('/etc/consul/watch_my_watch.json'). \ + with_content(%r{"type" *: *"keyprefix"}). \ + with_content(%r{"prefix" *: *"keyPref"}) } end end @@ -186,8 +188,8 @@ context 'without service' do let(:params) do { - 'type' => 'service', - 'handler' => 'handler_path', + 'type' => 'service', + 'handler' => 'handler_path', } end @@ -199,17 +201,17 @@ context 'with service' do let(:params) do { - 'type' => 'service', - 'handler' => 'handler_path', + 'type' => 'service', + 'handler' => 'handler_path', - 'service' => 'serviceName', + 'service' => 'serviceName', } end it { - is_expected.to contain_file('/etc/consul/watch_my_watch.json') \ - .with_content(%r{"type" *: *"service"}) \ - .with_content(%r{"service" *: *"serviceName"}) + is_expected.to contain_file('/etc/consul/watch_my_watch.json'). \ + with_content(%r{"type" *: *"service"}). \ + with_content(%r{"service" *: *"serviceName"}) } end @@ -217,18 +219,18 @@ let(:params) do { 'type' => 'service', - 'handler' => 'handler_path', - 'service' => 'serviceName', + 'handler' => 'handler_path', + 'service' => 'serviceName', - 'service_tag' => 'serviceTagName', - 'passingonly' => true + 'service_tag' => 'serviceTagName', + 'passingonly' => true } end it { - is_expected.to contain_file('/etc/consul/watch_my_watch.json') \ - .with_content(%r{"tag" *: *"serviceTagName"}) \ - .with_content(%r{"passingonly" *: *true}) + is_expected.to contain_file('/etc/consul/watch_my_watch.json'). \ + with_content(%r{"tag" *: *"serviceTagName"}). \ + with_content(%r{"passingonly" *: *true}) } end end @@ -238,13 +240,13 @@ let(:params) do { 'type' => 'checks', - 'handler' => 'handler_path', + 'handler' => 'handler_path', } end it { - is_expected.to contain_file('/etc/consul/watch_my_watch.json') \ - .with_content(%r{"type" *: *"checks"}) + is_expected.to contain_file('/etc/consul/watch_my_watch.json'). \ + with_content(%r{"type" *: *"checks"}) } end @@ -252,17 +254,17 @@ let(:params) do { 'type' => 'checks', - 'handler' => 'handler_path', + 'handler' => 'handler_path', - 'service' => 'serviceName', - 'state' => 'serviceState', + 'service' => 'serviceName', + 'state' => 'serviceState', } end it { - is_expected.to contain_file('/etc/consul/watch_my_watch.json') \ - .with_content(%r{"service" *: *"serviceName"}) \ - .with_content(%r{"state" *: *"serviceState"}) + is_expected.to contain_file('/etc/consul/watch_my_watch.json'). \ + with_content(%r{"service" *: *"serviceName"}). \ + with_content(%r{"state" *: *"serviceState"}) } end end @@ -272,13 +274,13 @@ let(:params) do { 'type' => 'event', - 'handler' => 'handler_path', + 'handler' => 'handler_path', } end it { - is_expected.to contain_file('/etc/consul/watch_my_watch.json') \ - .with_content(%r{"type" *: *"event"}) + is_expected.to contain_file('/etc/consul/watch_my_watch.json'). \ + with_content(%r{"type" *: *"event"}) } end @@ -286,15 +288,15 @@ let(:params) do { 'type' => 'event', - 'handler' => 'handler_path', + 'handler' => 'handler_path', - 'event_name' => 'eventName', + 'event_name' => 'eventName', } end it { - is_expected.to contain_file('/etc/consul/watch_my_watch.json') \ - .with_content(%r{"name" *: *"eventName"}) + is_expected.to contain_file('/etc/consul/watch_my_watch.json'). \ + with_content(%r{"name" *: *"eventName"}) } end end @@ -303,13 +305,13 @@ let(:params) do { 'type' => 'nodes', - 'handler' => 'handler_path' + 'handler' => 'handler_path' } end it { - is_expected.to contain_file('/etc/consul/watch_my_watch.json') \ - .with_content(%r{"type" *: *"nodes"}) + is_expected.to contain_file('/etc/consul/watch_my_watch.json'). \ + with_content(%r{"type" *: *"nodes"}) } end @@ -317,13 +319,13 @@ let(:params) do { 'type' => 'services', - 'handler' => 'handler_path' + 'handler' => 'handler_path' } end it { - is_expected.to contain_file('/etc/consul/watch_my_watch.json') \ - .with_content(%r{"type" *: *"services"}) + is_expected.to contain_file('/etc/consul/watch_my_watch.json'). \ + with_content(%r{"type" *: *"services"}) } end @@ -331,7 +333,7 @@ let(:params) do { 'type' => 'unknown_type', - 'handler' => 'handler_path', + 'handler' => 'handler_path', } end @@ -345,13 +347,13 @@ let(:params) do { 'type' => 'nodes', - 'handler' => 'handler_path', + 'handler' => 'handler_path', } end it { - is_expected.to contain_file('/etc/consul/watch_my_watch.json') \ - .that_notifies('Class[consul::reload_service]') \ + is_expected.to contain_file('/etc/consul/watch_my_watch.json'). \ + that_notifies('Class[consul::reload_service]') \ } end end diff --git a/spec/functions/consul_sorted_json_spec.rb b/spec/functions/consul_sorted_json_spec.rb index e4b134e4..75bcfe38 100644 --- a/spec/functions/consul_sorted_json_spec.rb +++ b/spec/functions/consul_sorted_json_spec.rb @@ -12,51 +12,67 @@ def deprettyfy(string, leave_pretty) it 'handles nil' do is_expected.to run.with_params({ 'key' => nil }, pretty).and_return(deprettyfy("{\n \"key\": null\n}\n", pretty)) end + it 'handles :undef' do is_expected.to run.with_params({ 'key' => :undef }, pretty).and_return(deprettyfy("{\n \"key\": null\n}\n", pretty)) end + it 'handles true' do is_expected.to run.with_params({ 'key' => true }, pretty).and_return(deprettyfy("{\n \"key\": true\n}\n", pretty)) end + it 'handles false' do is_expected.to run.with_params({ 'key' => false }, pretty).and_return(deprettyfy("{\n \"key\": false\n}\n", pretty)) end + it 'handles positive integer' do is_expected.to run.with_params({ 'key' => 1 }, pretty).and_return(deprettyfy("{\n \"key\": 1\n}\n", pretty)) end + it 'handles negative integer' do is_expected.to run.with_params({ 'key' => -1 }, pretty).and_return(deprettyfy("{\n \"key\": -1\n}\n", pretty)) end + it 'handles positive float' do is_expected.to run.with_params({ 'key' => 1.1 }, pretty).and_return(deprettyfy("{\n \"key\": 1.1\n}\n", pretty)) end + it 'handles negative float' do is_expected.to run.with_params({ 'key' => -1.1 }, pretty).and_return(deprettyfy("{\n \"key\": -1.1\n}\n", pretty)) end + it 'handles integer in a string' do is_expected.to run.with_params({ 'key' => '1' }, pretty).and_return(deprettyfy("{\n \"key\": 1\n}\n", pretty)) end + it 'handles zero in a string' do is_expected.to run.with_params({ 'key' => '0' }, pretty).and_return(deprettyfy("{\n \"key\": 0\n}\n", pretty)) end + it 'handles integers with a leading zero in a string' do is_expected.to run.with_params({ 'key' => '0640' }, pretty).and_return(deprettyfy("{\n \"key\": \"0640\"\n}\n", pretty)) end + it 'handles negative integer in a string' do is_expected.to run.with_params({ 'key' => '-1' }, pretty).and_return(deprettyfy("{\n \"key\": -1\n}\n", pretty)) end + it 'handles simple string' do is_expected.to run.with_params({ 'key' => 'aString' }, pretty).and_return(deprettyfy("{\n \"key\": \"aString\"\n}\n", pretty)) end + it 'quotes values of tags' do is_expected.to run.with_params({ 'tags' => 12 }, pretty).and_return(deprettyfy("{\n \"tags\": \"12\"\n}\n", pretty)) end + it 'quotes values of meta' do is_expected.to run.with_params({ 'meta' => { 'sla' => 2 } }, pretty).and_return(deprettyfy("{\n \"meta\": {\n \"sla\": \"2\"\n }\n}\n", pretty)) end + it 'quotes values of node_meta' do is_expected.to run.with_params({ 'node_meta' => { 'cpus' => 8 } }, pretty).and_return(deprettyfy("{\n \"node_meta\": {\n \"cpus\": \"8\"\n }\n}\n", pretty)) end + it 'quotes values of args' do is_expected.to run.with_params({ 'args' => ['aString', '1', 2] }, pretty).and_return(deprettyfy("{\n \"args\": [\n \"aString\",\n \"1\",\n \"2\"\n ]\n}\n", pretty)) end @@ -64,9 +80,10 @@ def deprettyfy(string, leave_pretty) describe 'consul::sorted_json', type: :puppet_function do let(:test_hash) { { 'z' => 3, 'a' => '1', 'p' => '2', 's' => '-7' } } - before(:each) do + before do @json = subject.execute(test_hash, true) end + it 'sorts keys' do expect(@json.index('a')).to be < @json.index('p') expect(@json.index('p')).to be < @json.index('s') @@ -102,11 +119,11 @@ def deprettyfy(string, leave_pretty) context 'nesting' do let(:nested_test_hash) do { 'z' => [{ 'l' => 3, 'k' => '2', 'j' => '1' }], - 'a' => { 'z' => '3', 'x' => '1', 'y' => '2' }, - 'p' => [ '9', '8', '7'] } + 'a' => { 'z' => '3', 'x' => '1', 'y' => '2' }, + 'p' => %w[9 8 7] } end - before(:each) do + before do @json = subject.execute(nested_test_hash, true) end @@ -115,10 +132,12 @@ def deprettyfy(string, leave_pretty) expect(@json.index('y')).to be < @json.index('z') end end + context 'test simple behavior' do context 'sorted' do include_examples 'handling_simple_types', false end + context 'sorted pretty' do include_examples 'handling_simple_types', true end diff --git a/spec/functions/consul_validate_checks_spec.rb b/spec/functions/consul_validate_checks_spec.rb index d6e5c2ce..0a0d17e7 100644 --- a/spec/functions/consul_validate_checks_spec.rb +++ b/spec/functions/consul_validate_checks_spec.rb @@ -6,7 +6,7 @@ is_expected.to run.with_params([ { 'http' => 'localhost', - 'script' => 'true' + 'script' => 'true' }, ]).and_raise_error(Exception) } @@ -16,8 +16,8 @@ it { is_expected.to run.with_params([ { - 'tcp' => 'localhost', - 'script' => 'true' + 'tcp' => 'localhost', + 'script' => 'true' }, ]).and_raise_error(Exception) } @@ -27,8 +27,8 @@ it { is_expected.to run.with_params([ { - 'tcp' => 'localhost', - 'http' => 'true' + 'tcp' => 'localhost', + 'http' => 'true' }, ]).and_raise_error(Exception) } @@ -39,7 +39,7 @@ is_expected.to run.with_params([ { 'interval' => '30s', - 'script' => 'true' + 'script' => 'true' }, ]) } @@ -80,7 +80,7 @@ is_expected.to run.with_params([ { 'script' => 'true', - 'ttl' => 'true' + 'ttl' => 'true' }, ]).and_raise_error(Exception) } @@ -91,7 +91,7 @@ is_expected.to run.with_params([ { 'http' => 'localhost', - 'ttl' => 'true' + 'ttl' => 'true' }, ]).and_raise_error(Exception) } @@ -102,7 +102,7 @@ is_expected.to run.with_params([ { 'tcp' => 'localhost', - 'ttl' => 'true' + 'ttl' => 'true' }, ]).and_raise_error(Exception) } @@ -113,7 +113,7 @@ is_expected.to run.with_params([ { 'tcp' => 'localhost:80', - 'interval' => '30s', + 'interval' => '30s', }, ]) } @@ -124,7 +124,7 @@ is_expected.to run.with_params([ { 'name' => 'foo-service-alias', - 'alias_service' => 'foo-service', + 'alias_service' => 'foo-service', }, ]) } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 2b4a8839..d28a15c2 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -8,7 +8,7 @@ ENV['COVERAGE'] ||= 'yes' if Dir.exist?(File.expand_path('../lib', __dir__)) require 'voxpupuli/test/spec_helper' - +require 'webmock' if File.exist?(File.join(__dir__, 'default_module_facts.yml')) facts = YAML.safe_load(File.read(File.join(__dir__, 'default_module_facts.yml'))) facts&.each do |name, value| diff --git a/spec/unit/facter/consul_version_spec.rb b/spec/unit/facter/consul_version_spec.rb index 1a4fcb09..1b9c1a9d 100644 --- a/spec/unit/facter/consul_version_spec.rb +++ b/spec/unit/facter/consul_version_spec.rb @@ -1,20 +1,20 @@ require 'spec_helper' describe Facter::Util::Fact do - before(:each) do + before do Facter.clear end describe 'consul_version' do context 'Returns consul version on Linux' it do - consul_version_output = <<-EOS -Consul v0.6.0 -Consul Protocol: 3 (Understands back to: 1) + consul_version_output = <<~EOS + Consul v0.6.0 + Consul Protocol: 3 (Understands back to: 1) EOS allow(Facter.fact(:kernel)).to receive(:value).and_return('Linux') - allow(Facter::Util::Resolution).to receive(:exec).with('consul --version 2> /dev/null') - .and_return(consul_version_output) + allow(Facter::Util::Resolution).to receive(:exec).with('consul --version 2> /dev/null'). + and_return(consul_version_output) expect(Facter.fact(:consul_version).value).to match('0.6.0') end end diff --git a/spec/unit/puppet/provider/consul_key_value_spec.rb b/spec/unit/puppet/provider/consul_key_value_spec.rb index 37111714..c7459b97 100644 --- a/spec/unit/puppet/provider/consul_key_value_spec.rb +++ b/spec/unit/puppet/provider/consul_key_value_spec.rb @@ -4,13 +4,13 @@ describe Puppet::Type.type(:consul_key_value).provider(:default) do let(:resource) do Puppet::Type.type(:consul_key_value).new( - { - name: 'sample/key', - value: 'sampleValue', - acl_api_token: 'sampleToken', - datacenter: 'dc1', - }, - ) + { + name: 'sample/key', + value: 'sampleValue', + acl_api_token: 'sampleToken', + datacenter: 'dc1', + } + ) end let(:resources) { { 'sample/key' => resource } } @@ -20,17 +20,17 @@ it 'retries 3 times' do kv_content = [ { 'LockIndex' => 0, - 'Key' => 'sample/key', - 'Flags' => 0, - 'Value' => 'RGlmZmVyZW50IHZhbHVl', # Different value - 'CreateIndex' => 1_350_503, - 'ModifyIndex' => 1_350_503 }, + 'Key' => 'sample/key', + 'Flags' => 0, + 'Value' => 'RGlmZmVyZW50IHZhbHVl', # Different value + 'CreateIndex' => 1_350_503, + 'ModifyIndex' => 1_350_503 }, ] - stub_request(:get, 'http://localhost:8500/v1/kv/?dc=dc1&recurse&token=sampleToken') - .with(headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }) - .to_return(status: 400, body: '', headers: {}).times(2).then - .to_return(status: 200, body: JSON.dump(kv_content), headers: {}) + stub_request(:get, 'http://localhost:8500/v1/kv/?dc=dc1&recurse&token=sampleToken'). + with(headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }). + to_return(status: 400, body: '', headers: {}).times(2).then. + to_return(status: 200, body: JSON.dump(kv_content), headers: {}) described_class.reset described_class.prefetch(resources) @@ -40,9 +40,9 @@ context 'when the first three responses are unexpected' do it 'silentlies fail to prefetch' do - stub_request(:get, 'http://localhost:8500/v1/kv/?dc=dc1&recurse&token=sampleToken') - .with(headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }) - .to_return(status: 400, body: '', headers: {}) + stub_request(:get, 'http://localhost:8500/v1/kv/?dc=dc1&recurse&token=sampleToken'). + with(headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }). + to_return(status: 400, body: '', headers: {}) described_class.reset described_class.prefetch(resources) @@ -52,9 +52,9 @@ context 'when a timeout is received' do it 'does not handle the timeout' do - stub_request(:get, 'http://localhost:8500/v1/kv/?dc=dc1&recurse&token=sampleToken') - .with(headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }) - .to_timeout + stub_request(:get, 'http://localhost:8500/v1/kv/?dc=dc1&recurse&token=sampleToken'). + with(headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }). + to_timeout described_class.reset # expect(described_class.prefetch( resources )).to raise_error @@ -75,7 +75,7 @@ value: 'sampleValue', acl_api_token: 'sampleToken', datacenter: 'dc1', - }, + } ) res_dc2 = Puppet::Type.type(:consul_key_value).new( @@ -84,27 +84,27 @@ value: 'sampleValue', acl_api_token: 'sampleToken', datacenter: 'dc2', - }, + } ) resources = { 'sample/keydc1' => res_dc1, 'sample/keydc2' => res_dc2 } kv_content = [ { 'LockIndex' => 0, - 'Key' => 'sample/keydc1', - 'Flags' => 0, - 'Value' => 'RGlmZmVyZW50IHZhbHVl', # Different value - 'CreateIndex' => 1_350_503, - 'ModifyIndex' => 1_350_503 }, + 'Key' => 'sample/keydc1', + 'Flags' => 0, + 'Value' => 'RGlmZmVyZW50IHZhbHVl', # Different value + 'CreateIndex' => 1_350_503, + 'ModifyIndex' => 1_350_503 }, ] - stub_request(:get, 'http://localhost:8500/v1/kv/?dc=dc1&recurse&token=sampleToken') - .with(headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: JSON.dump(kv_content), headers: {}) + stub_request(:get, 'http://localhost:8500/v1/kv/?dc=dc1&recurse&token=sampleToken'). + with(headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: JSON.dump(kv_content), headers: {}) - stub_request(:get, 'http://localhost:8500/v1/kv/?dc=dc2&recurse&token=sampleToken') - .with(headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }) - .to_return(status: 404, body: '', headers: {}) + stub_request(:get, 'http://localhost:8500/v1/kv/?dc=dc2&recurse&token=sampleToken'). + with(headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }). + to_return(status: 404, body: '', headers: {}) described_class.reset described_class.prefetch(resources) @@ -117,9 +117,9 @@ describe '#exists?' do context 'when resource does not exists' do it 'returns false' do - stub_request(:get, 'http://localhost:8500/v1/kv/?dc=dc1&recurse&token=sampleToken') - .with(headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }) - .to_return(status: 404, body: '', headers: {}) + stub_request(:get, 'http://localhost:8500/v1/kv/?dc=dc1&recurse&token=sampleToken'). + with(headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }). + to_return(status: 404, body: '', headers: {}) described_class.reset described_class.prefetch(resources) @@ -131,16 +131,16 @@ it 'returns true' do kv_content = [ { 'LockIndex' => 0, - 'Key' => 'sample/key', - 'Flags' => 0, - 'Value' => 'RGlmZmVyZW50IHZhbHVl', # Different value - 'CreateIndex' => 1_350_503, - 'ModifyIndex' => 1_350_503 }, + 'Key' => 'sample/key', + 'Flags' => 0, + 'Value' => 'RGlmZmVyZW50IHZhbHVl', # Different value + 'CreateIndex' => 1_350_503, + 'ModifyIndex' => 1_350_503 }, ] - stub_request(:get, 'http://localhost:8500/v1/kv/?dc=dc1&recurse&token=sampleToken') - .with(headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: JSON.dump(kv_content), headers: {}) + stub_request(:get, 'http://localhost:8500/v1/kv/?dc=dc1&recurse&token=sampleToken'). + with(headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: JSON.dump(kv_content), headers: {}) described_class.reset described_class.prefetch(resources) @@ -154,21 +154,21 @@ it 'writes to consul' do kv_content = [ { 'LockIndex' => 0, - 'Key' => 'sample/key-different-key', - 'Flags' => 0, - 'Value' => 'RGlmZmVyZW50IHZhbHVl', # Different value - 'CreateIndex' => 1_350_503, - 'ModifyIndex' => 1_350_503 }, + 'Key' => 'sample/key-different-key', + 'Flags' => 0, + 'Value' => 'RGlmZmVyZW50IHZhbHVl', # Different value + 'CreateIndex' => 1_350_503, + 'ModifyIndex' => 1_350_503 }, ] - stub_request(:get, 'http://localhost:8500/v1/kv/?dc=dc1&recurse&token=sampleToken') - .with(headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: JSON.dump(kv_content), headers: {}) + stub_request(:get, 'http://localhost:8500/v1/kv/?dc=dc1&recurse&token=sampleToken'). + with(headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: JSON.dump(kv_content), headers: {}) - stub_request(:put, 'http://localhost:8500/v1/kv/sample/key?dc=dc1&flags=0&token=sampleToken') - .with(body: 'sampleValue', - headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: '', headers: {}) + stub_request(:put, 'http://localhost:8500/v1/kv/sample/key?dc=dc1&flags=0&token=sampleToken'). + with(body: 'sampleValue', + headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: '', headers: {}) described_class.reset described_class.prefetch(resources) @@ -181,21 +181,21 @@ it 'writes to consul' do kv_content = [ { 'LockIndex' => 0, - 'Key' => 'sample/key', - 'Flags' => 0, - 'Value' => 'RGlmZmVyZW50IHZhbHVl', # Different value - 'CreateIndex' => 1_350_503, - 'ModifyIndex' => 1_350_503 }, + 'Key' => 'sample/key', + 'Flags' => 0, + 'Value' => 'RGlmZmVyZW50IHZhbHVl', # Different value + 'CreateIndex' => 1_350_503, + 'ModifyIndex' => 1_350_503 }, ] - stub_request(:get, 'http://localhost:8500/v1/kv/?dc=dc1&recurse&token=sampleToken') - .with(headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: JSON.dump(kv_content), headers: {}) + stub_request(:get, 'http://localhost:8500/v1/kv/?dc=dc1&recurse&token=sampleToken'). + with(headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: JSON.dump(kv_content), headers: {}) - stub_request(:put, 'http://localhost:8500/v1/kv/sample/key?dc=dc1&flags=0&token=sampleToken') - .with(body: 'sampleValue', - headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: '', headers: {}) + stub_request(:put, 'http://localhost:8500/v1/kv/sample/key?dc=dc1&flags=0&token=sampleToken'). + with(body: 'sampleValue', + headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: '', headers: {}) described_class.reset described_class.prefetch(resources) @@ -208,11 +208,11 @@ it 'writes to consul' do kv_content = [ { 'LockIndex' => 0, - 'Key' => 'sample/key', - 'Flags' => 1, - 'Value' => 'c2FtcGxlVmFsdWU=', # sampleValue - 'CreateIndex' => 1_350_503, - 'ModifyIndex' => 1_350_503 }, + 'Key' => 'sample/key', + 'Flags' => 1, + 'Value' => 'c2FtcGxlVmFsdWU=', # sampleValue + 'CreateIndex' => 1_350_503, + 'ModifyIndex' => 1_350_503 }, ] resource = Puppet::Type.type(:consul_key_value).new( @@ -222,18 +222,18 @@ flags: 2, acl_api_token: 'sampleToken', datacenter: 'dc1', - }, + } ) resources = { 'sample/key' => resource } - stub_request(:get, 'http://localhost:8500/v1/kv/?dc=dc1&recurse&token=sampleToken') - .with(headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: JSON.dump(kv_content), headers: {}) + stub_request(:get, 'http://localhost:8500/v1/kv/?dc=dc1&recurse&token=sampleToken'). + with(headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: JSON.dump(kv_content), headers: {}) - stub_request(:put, 'http://localhost:8500/v1/kv/sample/key?dc=dc1&flags=2&token=sampleToken') - .with(body: 'sampleValue', - headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: '', headers: {}) + stub_request(:put, 'http://localhost:8500/v1/kv/sample/key?dc=dc1&flags=2&token=sampleToken'). + with(body: 'sampleValue', + headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: '', headers: {}) described_class.reset described_class.prefetch(resources) @@ -246,21 +246,21 @@ it 'raises Puppet::Error on failed create' do kv_content = [ { 'LockIndex' => 0, - 'Key' => 'sample/different-key', - 'Flags' => 0, - 'Value' => 'c2FtcGxlVmFsdWU=', # sampleValue - 'CreateIndex' => 1_350_503, - 'ModifyIndex' => 1_350_503 }, + 'Key' => 'sample/different-key', + 'Flags' => 0, + 'Value' => 'c2FtcGxlVmFsdWU=', # sampleValue + 'CreateIndex' => 1_350_503, + 'ModifyIndex' => 1_350_503 }, ] - stub_request(:get, 'http://localhost:8500/v1/kv/?dc=dc1&recurse&token=sampleToken') - .with(headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: JSON.dump(kv_content), headers: {}) + stub_request(:get, 'http://localhost:8500/v1/kv/?dc=dc1&recurse&token=sampleToken'). + with(headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: JSON.dump(kv_content), headers: {}) - stub_request(:put, 'http://localhost:8500/v1/kv/sample/key?dc=dc1&flags=0&token=sampleToken') - .with(body: 'sampleValue', - headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }) - .to_return(status: 400, body: '', headers: {}) + stub_request(:put, 'http://localhost:8500/v1/kv/sample/key?dc=dc1&flags=0&token=sampleToken'). + with(body: 'sampleValue', + headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }). + to_return(status: 400, body: '', headers: {}) described_class.reset described_class.prefetch(resources) @@ -282,13 +282,13 @@ 'ModifyIndex' => 1_350_503 }, ] - stub_request(:get, 'http://localhost:8500/v1/kv/?dc=dc1&recurse&token=sampleToken') - .with(headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: JSON.dump(kv_content), headers: {}) + stub_request(:get, 'http://localhost:8500/v1/kv/?dc=dc1&recurse&token=sampleToken'). + with(headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: JSON.dump(kv_content), headers: {}) - stub_request(:delete, 'http://localhost:8500/v1/kv/sample/key?dc=dc1&token=sampleToken') - .with(headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: '', headers: {}) + stub_request(:delete, 'http://localhost:8500/v1/kv/sample/key?dc=dc1&token=sampleToken'). + with(headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: '', headers: {}) described_class.reset described_class.prefetch(resources) @@ -308,13 +308,13 @@ 'ModifyIndex' => 1_350_503 }, ] - stub_request(:get, 'http://localhost:8500/v1/kv/?dc=dc1&recurse&token=sampleToken') - .with(headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: JSON.dump(kv_content), headers: {}) + stub_request(:get, 'http://localhost:8500/v1/kv/?dc=dc1&recurse&token=sampleToken'). + with(headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: JSON.dump(kv_content), headers: {}) - stub_request(:delete, 'http://localhost:8500/v1/kv/sample/key?dc=dc1&token=sampleToken') - .with(headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }) - .to_return(status: 400, body: '', headers: {}) + stub_request(:delete, 'http://localhost:8500/v1/kv/sample/key?dc=dc1&token=sampleToken'). + with(headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }). + to_return(status: 400, body: '', headers: {}) described_class.reset described_class.prefetch(resources) diff --git a/spec/unit/puppet/provider/consul_policy_spec.rb b/spec/unit/puppet/provider/consul_policy_spec.rb index fe21f715..f221dd11 100644 --- a/spec/unit/puppet/provider/consul_policy_spec.rb +++ b/spec/unit/puppet/provider/consul_policy_spec.rb @@ -6,24 +6,24 @@ Puppet::Type.type(:consul_policy).new( { name: 'test_policy', - description: 'test description', - datacenters: ['testdc'], - rules: [ - { - 'resource' => 'service_prefix', - 'segment' => 'test_service', - 'disposition' => 'read' - }, - { - 'resource' => 'key', - 'segment' => 'test_key', - 'disposition' => 'write' - }, - ], - acl_api_token: 'e33653a6-0320-4a71-b3af-75f14578e3aa', - api_tries: 3, - ensure: 'present' - }, + description: 'test description', + datacenters: ['testdc'], + rules: [ + { + 'resource' => 'service_prefix', + 'segment' => 'test_service', + 'disposition' => 'read' + }, + { + 'resource' => 'key', + 'segment' => 'test_key', + 'disposition' => 'write' + }, + ], + acl_api_token: 'e33653a6-0320-4a71-b3af-75f14578e3aa', + api_tries: 3, + ensure: 'present' + } ) end @@ -32,10 +32,10 @@ describe '.list_resources' do context 'when the first two responses are unexpected' do it 'retries 3 times' do - stub_request(:get, 'http://localhost:8500/v1/acl/policies') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) - .to_return(status: 400, body: '', headers: {}).times(2).then - .to_return(status: 200, body: '[]', headers: {}) + stub_request(:get, 'http://localhost:8500/v1/acl/policies'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }). + to_return(status: 400, body: '', headers: {}).times(2).then. + to_return(status: 200, body: '[]', headers: {}) described_class.prefetch(resources) described_class.reset @@ -45,22 +45,22 @@ it 'ID matched' do list_response = [ { - 'ID' => '02298dc3-e1cd-e031-b2c8-ec3023702b20', - 'Name' => 'test_policy', - 'Description' => 'Test description', + 'ID' => '02298dc3-e1cd-e031-b2c8-ec3023702b20', + 'Name' => 'test_policy', + 'Description' => 'Test description', }, ] - stub_request(:get, 'http://localhost:8500/v1/acl/policies') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: JSON.dump(list_response), headers: {}) + stub_request(:get, 'http://localhost:8500/v1/acl/policies'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: JSON.dump(list_response), headers: {}) policy_response = list_response.first policy_response['Rules'] = [] - stub_request(:get, 'http://localhost:8500/v1/acl/policy/02298dc3-e1cd-e031-b2c8-ec3023702b20') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: JSON.dump(policy_response), headers: {}) + stub_request(:get, 'http://localhost:8500/v1/acl/policy/02298dc3-e1cd-e031-b2c8-ec3023702b20'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: JSON.dump(policy_response), headers: {}) resource[:id] = '' described_class.prefetch(resources) @@ -73,10 +73,10 @@ describe 'create' do context 'when the first two responses are unexpected' do it 'retries 3 times' do - stub_request(:get, 'http://localhost:8500/v1/acl/policies') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) - .to_return(status: 400, body: '', headers: {}).times(2).then - .to_return(status: 200, body: '[]', headers: {}) + stub_request(:get, 'http://localhost:8500/v1/acl/policies'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }). + to_return(status: 400, body: '', headers: {}).times(2).then. + to_return(status: 200, body: '[]', headers: {}) described_class.prefetch(resources) described_class.reset @@ -88,27 +88,27 @@ it 'matches ID on equal names' do list_response = [ { - 'ID' => '02298dc3-e1cd-e031-b2c8-ec3023702b20', - 'Name' => 'test_policy', - 'Description' => 'Test description', + 'ID' => '02298dc3-e1cd-e031-b2c8-ec3023702b20', + 'Name' => 'test_policy', + 'Description' => 'Test description', }, { - 'ID' => '92cc32cd-ef8e-4c5d-909a-e3fc625293fc', - 'Name' => 'other_policy', - 'Description' => 'Other description', + 'ID' => '92cc32cd-ef8e-4c5d-909a-e3fc625293fc', + 'Name' => 'other_policy', + 'Description' => 'Other description', }, ] - stub_request(:get, 'http://localhost:8500/v1/acl/policies') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: JSON.dump(list_response), headers: {}) + stub_request(:get, 'http://localhost:8500/v1/acl/policies'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: JSON.dump(list_response), headers: {}) policy_response = list_response.first policy_response['Rules'] = [] - stub_request(:get, 'http://localhost:8500/v1/acl/policy/02298dc3-e1cd-e031-b2c8-ec3023702b20') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: JSON.dump(policy_response), headers: {}) + stub_request(:get, 'http://localhost:8500/v1/acl/policy/02298dc3-e1cd-e031-b2c8-ec3023702b20'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: JSON.dump(policy_response), headers: {}) resource[:id] = '' described_class.prefetch(resources) @@ -117,9 +117,9 @@ end it 'aborts if no policy is found by specified ID' do - stub_request(:get, 'http://localhost:8500/v1/acl/policies') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: '[]', headers: {}) + stub_request(:get, 'http://localhost:8500/v1/acl/policies'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: '[]', headers: {}) resource[:id] = '02298dc3-e1cd-e031-b2c8-ec3023702b20' described_class.prefetch(resources) @@ -132,22 +132,22 @@ describe 'flush' do context 'create' do it 'if policy is not existing' do - stub_request(:get, 'http://localhost:8500/v1/acl/policies') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: '[]', headers: {}) + stub_request(:get, 'http://localhost:8500/v1/acl/policies'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: '[]', headers: {}) create_response = { 'ID' => 'ce6c53fb-aebd-4acb-b108-b65d4ea67853', - 'Name' => 'test_policy', - 'Description' => 'Test description', - 'Datacenters' => ['testdc'], - 'Rules' => [] + 'Name' => 'test_policy', + 'Description' => 'Test description', + 'Datacenters' => ['testdc'], + 'Rules' => [] } - stub_request(:put, 'http://localhost:8500/v1/acl/policy') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }, - body: '{"Name":"test_policy","Description":"test description","Datacenters":["testdc"],"Rules":"service_prefix \\"test_service\\" {\\n policy = \\"read\\"\\n}\\n\\nkey \\"test_key\\" {\\n policy = \\"write\\"\\n}"}') - .to_return(status: 200, body: JSON.dump(create_response), headers: {}) + stub_request(:put, 'http://localhost:8500/v1/acl/policy'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }, + body: '{"Name":"test_policy","Description":"test description","Datacenters":["testdc"],"Rules":"service_prefix \\"test_service\\" {\\n policy = \\"read\\"\\n}\\n\\nkey \\"test_key\\" {\\n policy = \\"write\\"\\n}"}'). + to_return(status: 200, body: JSON.dump(create_response), headers: {}) resource[:id] = '' described_class.prefetch(resources) @@ -162,31 +162,31 @@ it 'if descriptions do not match"' do list_response = [ { - 'ID' => '02298dc3-e1cd-e031-b2c8-ec3023702b20', - 'Name' => 'test_policy', - 'Description' => 'other description', - 'Datacenters' => ['testdc'], + 'ID' => '02298dc3-e1cd-e031-b2c8-ec3023702b20', + 'Name' => 'test_policy', + 'Description' => 'other description', + 'Datacenters' => ['testdc'], }, ] - stub_request(:get, 'http://localhost:8500/v1/acl/policies') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: JSON.dump(list_response), headers: {}) + stub_request(:get, 'http://localhost:8500/v1/acl/policies'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: JSON.dump(list_response), headers: {}) policy_response = list_response.first policy_response['Rules'] = described_class.encode_rules(resource[:rules]) - stub_request(:get, 'http://localhost:8500/v1/acl/policy/02298dc3-e1cd-e031-b2c8-ec3023702b20') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: JSON.dump(policy_response), headers: {}) + stub_request(:get, 'http://localhost:8500/v1/acl/policy/02298dc3-e1cd-e031-b2c8-ec3023702b20'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: JSON.dump(policy_response), headers: {}) update_response = policy_response update_response['Description'] = 'test description' - stub_request(:put, 'http://localhost:8500/v1/acl/policy/02298dc3-e1cd-e031-b2c8-ec3023702b20') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }, - body: '{"Name":"test_policy","Description":"test description","Datacenters":["testdc"],"Rules":"service_prefix \\"test_service\\" {\\n policy = \\"read\\"\\n}\\n\\nkey \\"test_key\\" {\\n policy = \\"write\\"\\n}"}') - .to_return(status: 200, body: JSON.dump(update_response), headers: {}) + stub_request(:put, 'http://localhost:8500/v1/acl/policy/02298dc3-e1cd-e031-b2c8-ec3023702b20'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }, + body: '{"Name":"test_policy","Description":"test description","Datacenters":["testdc"],"Rules":"service_prefix \\"test_service\\" {\\n policy = \\"read\\"\\n}\\n\\nkey \\"test_key\\" {\\n policy = \\"write\\"\\n}"}'). + to_return(status: 200, body: JSON.dump(update_response), headers: {}) resource[:id] = '' described_class.prefetch(resources) @@ -198,31 +198,31 @@ it 'if datacenters do not match"' do list_response = [ { - 'ID' => '02298dc3-e1cd-e031-b2c8-ec3023702b20', - 'Name' => 'test_policy', - 'Description' => 'test description', - 'Datacenters' => ['otherdc'], + 'ID' => '02298dc3-e1cd-e031-b2c8-ec3023702b20', + 'Name' => 'test_policy', + 'Description' => 'test description', + 'Datacenters' => ['otherdc'], }, ] - stub_request(:get, 'http://localhost:8500/v1/acl/policies') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: JSON.dump(list_response), headers: {}) + stub_request(:get, 'http://localhost:8500/v1/acl/policies'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: JSON.dump(list_response), headers: {}) policy_response = list_response.first policy_response['Rules'] = described_class.encode_rules(resource[:rules]) - stub_request(:get, 'http://localhost:8500/v1/acl/policy/02298dc3-e1cd-e031-b2c8-ec3023702b20') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: JSON.dump(policy_response), headers: {}) + stub_request(:get, 'http://localhost:8500/v1/acl/policy/02298dc3-e1cd-e031-b2c8-ec3023702b20'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: JSON.dump(policy_response), headers: {}) update_response = policy_response update_response['Datacenters'] = ['testdc'] - stub_request(:put, 'http://localhost:8500/v1/acl/policy/02298dc3-e1cd-e031-b2c8-ec3023702b20') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }, - body: '{"Name":"test_policy","Description":"test description","Datacenters":["testdc"],"Rules":"service_prefix \\"test_service\\" {\\n policy = \\"read\\"\\n}\\n\\nkey \\"test_key\\" {\\n policy = \\"write\\"\\n}"}') - .to_return(status: 200, body: JSON.dump(update_response), headers: {}) + stub_request(:put, 'http://localhost:8500/v1/acl/policy/02298dc3-e1cd-e031-b2c8-ec3023702b20'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }, + body: '{"Name":"test_policy","Description":"test description","Datacenters":["testdc"],"Rules":"service_prefix \\"test_service\\" {\\n policy = \\"read\\"\\n}\\n\\nkey \\"test_key\\" {\\n policy = \\"write\\"\\n}"}'). + to_return(status: 200, body: JSON.dump(update_response), headers: {}) resource[:id] = '' described_class.prefetch(resources) @@ -234,31 +234,31 @@ it 'if rules do not match"' do list_response = [ { - 'ID' => '02298dc3-e1cd-e031-b2c8-ec3023702b20', - 'Name' => 'test_policy', - 'Description' => 'test description', - 'Datacenters' => ['testdc'], + 'ID' => '02298dc3-e1cd-e031-b2c8-ec3023702b20', + 'Name' => 'test_policy', + 'Description' => 'test description', + 'Datacenters' => ['testdc'], }, ] - stub_request(:get, 'http://localhost:8500/v1/acl/policies') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: JSON.dump(list_response), headers: {}) + stub_request(:get, 'http://localhost:8500/v1/acl/policies'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: JSON.dump(list_response), headers: {}) policy_response = list_response.first policy_response['Rules'] = '' - stub_request(:get, 'http://localhost:8500/v1/acl/policy/02298dc3-e1cd-e031-b2c8-ec3023702b20') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: JSON.dump(policy_response), headers: {}) + stub_request(:get, 'http://localhost:8500/v1/acl/policy/02298dc3-e1cd-e031-b2c8-ec3023702b20'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: JSON.dump(policy_response), headers: {}) update_response = policy_response update_response['Rules'] = described_class.encode_rules(resource[:rules]) - stub_request(:put, 'http://localhost:8500/v1/acl/policy/02298dc3-e1cd-e031-b2c8-ec3023702b20') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }, - body: '{"Name":"test_policy","Description":"test description","Datacenters":["testdc"],"Rules":"service_prefix \\"test_service\\" {\\n policy = \\"read\\"\\n}\\n\\nkey \\"test_key\\" {\\n policy = \\"write\\"\\n}"}') - .to_return(status: 200, body: JSON.dump(update_response), headers: {}) + stub_request(:put, 'http://localhost:8500/v1/acl/policy/02298dc3-e1cd-e031-b2c8-ec3023702b20'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }, + body: '{"Name":"test_policy","Description":"test description","Datacenters":["testdc"],"Rules":"service_prefix \\"test_service\\" {\\n policy = \\"read\\"\\n}\\n\\nkey \\"test_key\\" {\\n policy = \\"write\\"\\n}"}'). + to_return(status: 200, body: JSON.dump(update_response), headers: {}) resource[:id] = '' described_class.prefetch(resources) @@ -270,23 +270,23 @@ it 'no update if rules and description are equal"' do list_response = [ { - 'ID' => '02298dc3-e1cd-e031-b2c8-ec3023702b20', - 'Name' => 'test_policy', - 'Description' => 'test description', - 'Datacenters' => ['testdc'], + 'ID' => '02298dc3-e1cd-e031-b2c8-ec3023702b20', + 'Name' => 'test_policy', + 'Description' => 'test description', + 'Datacenters' => ['testdc'], }, ] - stub_request(:get, 'http://localhost:8500/v1/acl/policies') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: JSON.dump(list_response), headers: {}) + stub_request(:get, 'http://localhost:8500/v1/acl/policies'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: JSON.dump(list_response), headers: {}) policy_response = list_response.first policy_response['Rules'] = described_class.encode_rules(resource[:rules]) - stub_request(:get, 'http://localhost:8500/v1/acl/policy/02298dc3-e1cd-e031-b2c8-ec3023702b20') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: JSON.dump(policy_response), headers: {}) + stub_request(:get, 'http://localhost:8500/v1/acl/policy/02298dc3-e1cd-e031-b2c8-ec3023702b20'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: JSON.dump(policy_response), headers: {}) resource[:id] = '' described_class.prefetch(resources) @@ -300,26 +300,26 @@ it 'absent and existing policy"' do list_response = [ { - 'ID' => '02298dc3-e1cd-e031-b2c8-ec3023702b20', - 'Name' => 'test_policy', - 'Description' => 'other description', + 'ID' => '02298dc3-e1cd-e031-b2c8-ec3023702b20', + 'Name' => 'test_policy', + 'Description' => 'other description', }, ] - stub_request(:get, 'http://localhost:8500/v1/acl/policies') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: JSON.dump(list_response), headers: {}) + stub_request(:get, 'http://localhost:8500/v1/acl/policies'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: JSON.dump(list_response), headers: {}) policy_response = list_response.first policy_response['Rules'] = described_class.encode_rules(resource[:rules]) - stub_request(:get, 'http://localhost:8500/v1/acl/policy/02298dc3-e1cd-e031-b2c8-ec3023702b20') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: JSON.dump(policy_response), headers: {}) + stub_request(:get, 'http://localhost:8500/v1/acl/policy/02298dc3-e1cd-e031-b2c8-ec3023702b20'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: JSON.dump(policy_response), headers: {}) - stub_request(:delete, 'http://localhost:8500/v1/acl/policy/02298dc3-e1cd-e031-b2c8-ec3023702b20') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: '[]', headers: {}) + stub_request(:delete, 'http://localhost:8500/v1/acl/policy/02298dc3-e1cd-e031-b2c8-ec3023702b20'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: '[]', headers: {}) resource[:id] = '' resource[:ensure] = :absent @@ -330,9 +330,9 @@ end it 'absent and non-existing policy"' do - stub_request(:get, 'http://localhost:8500/v1/acl/policies') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: '[]', headers: {}) + stub_request(:get, 'http://localhost:8500/v1/acl/policies'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: '[]', headers: {}) resource[:id] = 'd555e778-b2e0-441e-9734-f76f3e9f43ca' resource[:ensure] = :absent diff --git a/spec/unit/puppet/provider/consul_token_spec.rb b/spec/unit/puppet/provider/consul_token_spec.rb index c32cf7e2..5accd861 100644 --- a/spec/unit/puppet/provider/consul_token_spec.rb +++ b/spec/unit/puppet/provider/consul_token_spec.rb @@ -6,18 +6,18 @@ Puppet::Type.type(:consul_token).new( { name: 'test_token', - description: 'test_token', - accessor_id: '123123-1234-1234-1234-123456789', - acl_api_token: 'e33653a6-0320-4a71-b3af-75f14578e3aa', - policies_by_name: [ - 'test_policy_1', - ], - policies_by_id: [ - '652f27c9-d08d-412b-8985-9becc9c42fb2', - ], - api_tries: 3, - ensure: 'present' - }, + description: 'test_token', + accessor_id: '123123-1234-1234-1234-123456789', + acl_api_token: 'e33653a6-0320-4a71-b3af-75f14578e3aa', + policies_by_name: [ + 'test_policy_1', + ], + policies_by_id: [ + '652f27c9-d08d-412b-8985-9becc9c42fb2', + ], + api_tries: 3, + ensure: 'present' + } ) end @@ -28,16 +28,16 @@ it 'retries 3 times' do response = [ { - 'AccessorID' => '803ba11a-afe9-4198-a179-ef25a2adbf0b', - 'Description' => 'Test description', - 'Policies' => [] + 'AccessorID' => '803ba11a-afe9-4198-a179-ef25a2adbf0b', + 'Description' => 'Test description', + 'Policies' => [] }, ] - stub_request(:get, 'http://localhost:8500/v1/acl/tokens') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) - .to_return(status: 400, body: '', headers: {}).times(2).then - .to_return(status: 200, body: JSON.dump(response), headers: {}) + stub_request(:get, 'http://localhost:8500/v1/acl/tokens'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }). + to_return(status: 400, body: '', headers: {}).times(2).then. + to_return(status: 200, body: JSON.dump(response), headers: {}) described_class.prefetch(resources) described_class.reset @@ -49,20 +49,20 @@ it 'sets accessor' do response = [ { - 'AccessorID' => '123123-1234-1234-1234-123456789', - 'Description' => 'test_token', - 'Policies' => [] + 'AccessorID' => '123123-1234-1234-1234-123456789', + 'Description' => 'test_token', + 'Policies' => [] }, { - 'AccessorID' => '54636c2c-f378-428d-8b74-ac72cc6dd32d', - 'Description' => 'other token', - 'Policies' => [] + 'AccessorID' => '54636c2c-f378-428d-8b74-ac72cc6dd32d', + 'Description' => 'other token', + 'Policies' => [] }, ] - stub_request(:get, 'http://localhost:8500/v1/acl/tokens') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: JSON.dump(response), headers: {}) + stub_request(:get, 'http://localhost:8500/v1/acl/tokens'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: JSON.dump(response), headers: {}) described_class.prefetch(resources) described_class.reset @@ -74,21 +74,21 @@ describe '.flush' do context 'creation' do it 'creates token if not existing' do - stub_request(:get, 'http://localhost:8500/v1/acl/tokens') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: JSON.dump([]), headers: {}) + stub_request(:get, 'http://localhost:8500/v1/acl/tokens'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: JSON.dump([]), headers: {}) response = { 'AccessorID' => 'f28febb0-8746-4b6a-b6bf-03cde92005a1', - 'SecretID' => '11cfc2b9-a823-495d-8d6e-4392f182670e', - 'Description' => 'test_token', - 'Policies' => [] + 'SecretID' => '11cfc2b9-a823-495d-8d6e-4392f182670e', + 'Description' => 'test_token', + 'Policies' => [] } - create_response_stub = stub_request(:put, 'http://localhost:8500/v1/acl/token') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }, - body: '{"AccessorID":"123123-1234-1234-1234-123456789","Description":"test_token","Local":false,"Policies":[{"Name":"test_policy_1"},{"ID":"652f27c9-d08d-412b-8985-9becc9c42fb2"}]}') - .to_return(status: 200, body: JSON.dump(response), headers: {}) + create_response_stub = stub_request(:put, 'http://localhost:8500/v1/acl/token'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }, + body: '{"AccessorID":"123123-1234-1234-1234-123456789","Description":"test_token","Local":false,"Policies":[{"Name":"test_policy_1"},{"ID":"652f27c9-d08d-412b-8985-9becc9c42fb2"}]}'). + to_return(status: 200, body: JSON.dump(response), headers: {}) described_class.prefetch(resources) described_class.reset @@ -105,37 +105,37 @@ Puppet::Type.type(:consul_token).new( { name: 'test_token', - accessor_id: '123123-1234-1234-1234-123456789', - secret_id: '11cfc2b9-a823-495d-8d6e-4392f182670e', - acl_api_token: 'e33653a6-0320-4a71-b3af-75f14578e3aa', - policies_by_name: [ - 'test_policy_1', - ], - policies_by_id: [ - '652f27c9-d08d-412b-8985-9becc9c42fb2', - ], - api_tries: 3, - ensure: 'present' - }, + accessor_id: '123123-1234-1234-1234-123456789', + secret_id: '11cfc2b9-a823-495d-8d6e-4392f182670e', + acl_api_token: 'e33653a6-0320-4a71-b3af-75f14578e3aa', + policies_by_name: [ + 'test_policy_1', + ], + policies_by_id: [ + '652f27c9-d08d-412b-8985-9becc9c42fb2', + ], + api_tries: 3, + ensure: 'present' + } ) end it 'sets secret_id if present' do - stub_request(:get, 'http://localhost:8500/v1/acl/tokens') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: JSON.dump([]), headers: {}) + stub_request(:get, 'http://localhost:8500/v1/acl/tokens'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: JSON.dump([]), headers: {}) response = { 'AccessorID' => 'f28febb0-8746-4b6a-b6bf-03cde92005a1', - 'SecretID' => '11cfc2b9-a823-495d-8d6e-4392f182670e', - 'Description' => 'test_token', - 'Policies' => [] + 'SecretID' => '11cfc2b9-a823-495d-8d6e-4392f182670e', + 'Description' => 'test_token', + 'Policies' => [] } - create_response_stub = stub_request(:put, 'http://localhost:8500/v1/acl/token') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }, - body: '{"AccessorID":"123123-1234-1234-1234-123456789","Description":"test_token","Local":false,"Policies":[{"Name":"test_policy_1"},{"ID":"652f27c9-d08d-412b-8985-9becc9c42fb2"}],"SecretID":"11cfc2b9-a823-495d-8d6e-4392f182670e"}') - .to_return(status: 200, body: JSON.dump(response), headers: {}) + create_response_stub = stub_request(:put, 'http://localhost:8500/v1/acl/token'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }, + body: '{"AccessorID":"123123-1234-1234-1234-123456789","Description":"test_token","Local":false,"Policies":[{"Name":"test_policy_1"},{"ID":"652f27c9-d08d-412b-8985-9becc9c42fb2"}],"SecretID":"11cfc2b9-a823-495d-8d6e-4392f182670e"}'). + to_return(status: 200, body: JSON.dump(response), headers: {}) described_class.prefetch(resources) described_class.reset @@ -151,33 +151,33 @@ it 'updates policies in case of missing policy ID' do list_response = [ { - 'AccessorID' => '123123-1234-1234-1234-123456789', - 'SecretID' => 'ebc71d90-7a30-4f83-b108-6c5d9bda3225', - 'Description' => 'test_token', - 'Policies' => [ - { - 'ID' => '91c889b8-88fe-46d0-bdbd-54447fcd191b', - 'Name' => 'test_policy_1' - }, - ] + 'AccessorID' => '123123-1234-1234-1234-123456789', + 'SecretID' => 'ebc71d90-7a30-4f83-b108-6c5d9bda3225', + 'Description' => 'test_token', + 'Policies' => [ + { + 'ID' => '91c889b8-88fe-46d0-bdbd-54447fcd191b', + 'Name' => 'test_policy_1' + }, + ] }, ] - stub_request(:get, 'http://localhost:8500/v1/acl/tokens') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: JSON.dump(list_response), headers: {}) + stub_request(:get, 'http://localhost:8500/v1/acl/tokens'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: JSON.dump(list_response), headers: {}) update_response = { 'AccessorID' => '123123-1234-1234-1234-123456789', - 'SecretID' => 'ebc71d90-7a30-4f83-b108-6c5d9bda3225', - 'Description' => 'test_token', - 'Policies' => [] + 'SecretID' => 'ebc71d90-7a30-4f83-b108-6c5d9bda3225', + 'Description' => 'test_token', + 'Policies' => [] } - update_response_stub = stub_request(:put, 'http://localhost:8500/v1/acl/token/123123-1234-1234-1234-123456789') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }, - body: '{"AccessorID":"123123-1234-1234-1234-123456789","Description":"test_token","Local":false,"Policies":[{"Name":"test_policy_1"},{"ID":"652f27c9-d08d-412b-8985-9becc9c42fb2"}]}') - .to_return(status: 200, body: JSON.dump(update_response), headers: {}) + update_response_stub = stub_request(:put, 'http://localhost:8500/v1/acl/token/123123-1234-1234-1234-123456789'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }, + body: '{"AccessorID":"123123-1234-1234-1234-123456789","Description":"test_token","Local":false,"Policies":[{"Name":"test_policy_1"},{"ID":"652f27c9-d08d-412b-8985-9becc9c42fb2"}]}'). + to_return(status: 200, body: JSON.dump(update_response), headers: {}) described_class.prefetch(resources) described_class.reset @@ -190,33 +190,33 @@ it 'updates policies in case of missing policy Name' do list_response = [ { - 'AccessorID' => '123123-1234-1234-1234-123456789', - 'SecretID' => 'ebc71d90-7a30-4f83-b108-6c5d9bda3225', - 'Description' => 'test_token', - 'Policies' => [ - { - 'ID' => '652f27c9-d08d-412b-8985-9becc9c42fb2', - 'Name' => 'test_policy_2' - }, - ] + 'AccessorID' => '123123-1234-1234-1234-123456789', + 'SecretID' => 'ebc71d90-7a30-4f83-b108-6c5d9bda3225', + 'Description' => 'test_token', + 'Policies' => [ + { + 'ID' => '652f27c9-d08d-412b-8985-9becc9c42fb2', + 'Name' => 'test_policy_2' + }, + ] }, ] - stub_request(:get, 'http://localhost:8500/v1/acl/tokens') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: JSON.dump(list_response), headers: {}) + stub_request(:get, 'http://localhost:8500/v1/acl/tokens'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: JSON.dump(list_response), headers: {}) update_response = { 'AccessorID' => '123123-1234-1234-1234-123456789', - 'SecretID' => 'ebc71d90-7a30-4f83-b108-6c5d9bda3225', - 'Description' => 'test_token', - 'Policies' => [] + 'SecretID' => 'ebc71d90-7a30-4f83-b108-6c5d9bda3225', + 'Description' => 'test_token', + 'Policies' => [] } - update_response_stub = stub_request(:put, 'http://localhost:8500/v1/acl/token/123123-1234-1234-1234-123456789') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }, - body: '{"AccessorID":"123123-1234-1234-1234-123456789","Description":"test_token","Local":false,"Policies":[{"Name":"test_policy_1"},{"ID":"652f27c9-d08d-412b-8985-9becc9c42fb2"}]}') - .to_return(status: 200, body: JSON.dump(update_response), headers: {}) + update_response_stub = stub_request(:put, 'http://localhost:8500/v1/acl/token/123123-1234-1234-1234-123456789'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }, + body: '{"AccessorID":"123123-1234-1234-1234-123456789","Description":"test_token","Local":false,"Policies":[{"Name":"test_policy_1"},{"ID":"652f27c9-d08d-412b-8985-9becc9c42fb2"}]}'). + to_return(status: 200, body: JSON.dump(update_response), headers: {}) described_class.prefetch(resources) described_class.reset @@ -229,41 +229,41 @@ it 'updates policies in case of surplus policy' do list_response = [ { - 'AccessorID' => '123123-1234-1234-1234-123456789', - 'SecretID' => 'ebc71d90-7a30-4f83-b108-6c5d9bda3225', - 'Description' => 'test_token', - 'Policies' => [ - { - 'ID' => '91c889b8-88fe-46d0-bdbd-54447fcd191b', - 'Name' => 'test_policy_1' - }, - { - 'ID' => '652f27c9-d08d-412b-8985-9becc9c42fb2', - 'Name' => 'test_policy_2' - }, - { - 'ID' => 'a213e6b6-a7d9-484a-9223-94dfb96cc99f', - 'Name' => 'surplus_policy' - }, - ] + 'AccessorID' => '123123-1234-1234-1234-123456789', + 'SecretID' => 'ebc71d90-7a30-4f83-b108-6c5d9bda3225', + 'Description' => 'test_token', + 'Policies' => [ + { + 'ID' => '91c889b8-88fe-46d0-bdbd-54447fcd191b', + 'Name' => 'test_policy_1' + }, + { + 'ID' => '652f27c9-d08d-412b-8985-9becc9c42fb2', + 'Name' => 'test_policy_2' + }, + { + 'ID' => 'a213e6b6-a7d9-484a-9223-94dfb96cc99f', + 'Name' => 'surplus_policy' + }, + ] }, ] - stub_request(:get, 'http://localhost:8500/v1/acl/tokens') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: JSON.dump(list_response), headers: {}) + stub_request(:get, 'http://localhost:8500/v1/acl/tokens'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: JSON.dump(list_response), headers: {}) update_response = { 'AccessorID' => '123123-1234-1234-1234-123456789', - 'SecretID' => 'ebc71d90-7a30-4f83-b108-6c5d9bda3225', - 'Description' => 'test_token', - 'Policies' => [] + 'SecretID' => 'ebc71d90-7a30-4f83-b108-6c5d9bda3225', + 'Description' => 'test_token', + 'Policies' => [] } - update_response_stub = stub_request(:put, 'http://localhost:8500/v1/acl/token/123123-1234-1234-1234-123456789') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }, - body: '{"AccessorID":"123123-1234-1234-1234-123456789","Description":"test_token","Local":false,"Policies":[{"Name":"test_policy_1"},{"ID":"652f27c9-d08d-412b-8985-9becc9c42fb2"}]}') - .to_return(status: 200, body: JSON.dump(update_response), headers: {}) + update_response_stub = stub_request(:put, 'http://localhost:8500/v1/acl/token/123123-1234-1234-1234-123456789'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }, + body: '{"AccessorID":"123123-1234-1234-1234-123456789","Description":"test_token","Local":false,"Policies":[{"Name":"test_policy_1"},{"ID":"652f27c9-d08d-412b-8985-9becc9c42fb2"}]}'). + to_return(status: 200, body: JSON.dump(update_response), headers: {}) described_class.prefetch(resources) described_class.reset @@ -276,37 +276,37 @@ it 'updates policies in case of other policy_name' do list_response = [ { - 'AccessorID' => '123123-1234-1234-1234-123456789', - 'SecretID' => 'ebc71d90-7a30-4f83-b108-6c5d9bda3225', - 'Description' => 'test_token', - 'Policies' => [ - { - 'ID' => '91c889b8-88fe-46d0-bdbd-54447fcd191b', - 'Name' => 'other_name' - }, - { - 'ID' => '652f27c9-d08d-412b-8985-9becc9c42fb2', - 'Name' => 'test_policy_2' - }, - ] + 'AccessorID' => '123123-1234-1234-1234-123456789', + 'SecretID' => 'ebc71d90-7a30-4f83-b108-6c5d9bda3225', + 'Description' => 'test_token', + 'Policies' => [ + { + 'ID' => '91c889b8-88fe-46d0-bdbd-54447fcd191b', + 'Name' => 'other_name' + }, + { + 'ID' => '652f27c9-d08d-412b-8985-9becc9c42fb2', + 'Name' => 'test_policy_2' + }, + ] }, ] - stub_request(:get, 'http://localhost:8500/v1/acl/tokens') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: JSON.dump(list_response), headers: {}) + stub_request(:get, 'http://localhost:8500/v1/acl/tokens'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: JSON.dump(list_response), headers: {}) update_response = { 'AccessorID' => '123123-1234-1234-1234-123456789', - 'SecretID' => 'ebc71d90-7a30-4f83-b108-6c5d9bda3225', - 'Description' => 'test_token', - 'Policies' => [] + 'SecretID' => 'ebc71d90-7a30-4f83-b108-6c5d9bda3225', + 'Description' => 'test_token', + 'Policies' => [] } - update_response_stub = stub_request(:put, 'http://localhost:8500/v1/acl/token/123123-1234-1234-1234-123456789') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }, - body: '{"AccessorID":"123123-1234-1234-1234-123456789","Description":"test_token","Local":false,"Policies":[{"Name":"test_policy_1"},{"ID":"652f27c9-d08d-412b-8985-9becc9c42fb2"}]}') - .to_return(status: 200, body: JSON.dump(update_response), headers: {}) + update_response_stub = stub_request(:put, 'http://localhost:8500/v1/acl/token/123123-1234-1234-1234-123456789'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }, + body: '{"AccessorID":"123123-1234-1234-1234-123456789","Description":"test_token","Local":false,"Policies":[{"Name":"test_policy_1"},{"ID":"652f27c9-d08d-412b-8985-9becc9c42fb2"}]}'). + to_return(status: 200, body: JSON.dump(update_response), headers: {}) described_class.prefetch(resources) described_class.reset @@ -319,25 +319,25 @@ it 'no update if policies match' do list_response = [ { - 'AccessorID' => '123123-1234-1234-1234-123456789', - 'SecretID' => 'ebc71d90-7a30-4f83-b108-6c5d9bda3225', - 'Description' => 'test_token', - 'Policies' => [ - { - 'ID' => '91c889b8-88fe-46d0-bdbd-54447fcd191b', - 'Name' => 'test_policy_1' - }, - { - 'ID' => '652f27c9-d08d-412b-8985-9becc9c42fb2', - 'Name' => 'test_policy_2' - }, - ] + 'AccessorID' => '123123-1234-1234-1234-123456789', + 'SecretID' => 'ebc71d90-7a30-4f83-b108-6c5d9bda3225', + 'Description' => 'test_token', + 'Policies' => [ + { + 'ID' => '91c889b8-88fe-46d0-bdbd-54447fcd191b', + 'Name' => 'test_policy_1' + }, + { + 'ID' => '652f27c9-d08d-412b-8985-9becc9c42fb2', + 'Name' => 'test_policy_2' + }, + ] }, ] - stub_request(:get, 'http://localhost:8500/v1/acl/tokens') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: JSON.dump(list_response), headers: {}) + stub_request(:get, 'http://localhost:8500/v1/acl/tokens'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: JSON.dump(list_response), headers: {}) described_class.prefetch(resources) described_class.reset @@ -350,20 +350,20 @@ it 'deletes absent existing token' do list_response = [ { - 'AccessorID' => '123123-1234-1234-1234-123456789', - 'SecretID' => 'ebc71d90-7a30-4f83-b108-6c5d9bda3225', - 'Description' => 'test_token', - 'Policies' => [] + 'AccessorID' => '123123-1234-1234-1234-123456789', + 'SecretID' => 'ebc71d90-7a30-4f83-b108-6c5d9bda3225', + 'Description' => 'test_token', + 'Policies' => [] }, ] - stub_request(:get, 'http://localhost:8500/v1/acl/tokens') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: JSON.dump(list_response), headers: {}) + stub_request(:get, 'http://localhost:8500/v1/acl/tokens'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: JSON.dump(list_response), headers: {}) - delete_response_stub = stub_request(:delete, 'http://localhost:8500/v1/acl/token/123123-1234-1234-1234-123456789') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: '[]', headers: {}) + delete_response_stub = stub_request(:delete, 'http://localhost:8500/v1/acl/token/123123-1234-1234-1234-123456789'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: '[]', headers: {}) described_class.prefetch(resources) described_class.reset @@ -375,9 +375,9 @@ end it 'does not delete absent non-existing token' do - stub_request(:get, 'http://localhost:8500/v1/acl/tokens') - .with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }) - .to_return(status: 200, body: '[]', headers: {}) + stub_request(:get, 'http://localhost:8500/v1/acl/tokens'). + with(headers: { 'X-Consul-Token' => 'e33653a6-0320-4a71-b3af-75f14578e3aa', 'User-Agent' => 'Ruby' }). + to_return(status: 200, body: '[]', headers: {}) described_class.prefetch(resources) described_class.reset diff --git a/spec/unit/puppet/type/consul_acl_spec.rb b/spec/unit/puppet/type/consul_acl_spec.rb index 208f4d05..1b4e6143 100644 --- a/spec/unit/puppet/type/consul_acl_spec.rb +++ b/spec/unit/puppet/type/consul_acl_spec.rb @@ -10,29 +10,29 @@ } it 'fails if type is not client or management' do - expect { + expect do Puppet::Type.type(:consul_acl).new(name: 'foo', type: 'blah') - }.to raise_error(Puppet::Error, %r{Invalid value}) + end.to raise_error(Puppet::Error, %r{Invalid value}) end it 'fails if rules is not a hash' do - expect { + expect do Puppet::Type.type(:consul_acl).new(name: 'foo', rules: 'blah') - }.to raise_error(Puppet::Error, %r{ACL rules must be provided as a hash}) + end.to raise_error(Puppet::Error, %r{ACL rules must be provided as a hash}) end it 'fails if no name is provided' do - expect { + expect do Puppet::Type.type(:consul_acl).new(type: 'client') - }.to raise_error(Puppet::Error, %r{Title or name must be provided}) + end.to raise_error(Puppet::Error, %r{Title or name must be provided}) end context 'with type and rules provided' do - before :each do + before do @acl = Puppet::Type.type(:consul_acl).new( name: 'testing', type: 'management', - rules: samplerules, + rules: samplerules ) end diff --git a/spec/unit/puppet/type/consul_key_value_spec.rb b/spec/unit/puppet/type/consul_key_value_spec.rb index 7a9a53a1..e9d9a3a7 100644 --- a/spec/unit/puppet/type/consul_key_value_spec.rb +++ b/spec/unit/puppet/type/consul_key_value_spec.rb @@ -2,17 +2,17 @@ describe Puppet::Type.type(:consul_key_value) do it 'fails if no name is provided' do - expect { + expect do Puppet::Type.type(:consul_key_value).new(type: 'client') - }.to raise_error(Puppet::Error, %r{Title or name must be provided}) + end.to raise_error(Puppet::Error, %r{Title or name must be provided}) end context 'with query parameters provided' do - before :each do + before do @key_value = Puppet::Type.type(:consul_key_value).new( name: 'sample/key', value: 'sampleValue', - flags: 1, + flags: 1 ) end diff --git a/spec/unit/puppet/type/consul_policy_spec.rb b/spec/unit/puppet/type/consul_policy_spec.rb index 3853e9cd..1e248248 100644 --- a/spec/unit/puppet/type/consul_policy_spec.rb +++ b/spec/unit/puppet/type/consul_policy_spec.rb @@ -2,120 +2,120 @@ describe Puppet::Type.type(:consul_policy) do it 'fails if no name is provided' do - expect { + expect do Puppet::Type.type(:consul_policy).new(id: {}, rules: {}) - }.to raise_error(Puppet::Error, %r{Title or name must be provided}) + end.to raise_error(Puppet::Error, %r{Title or name must be provided}) end it 'fails if ID ist not a string' do - expect { + expect do Puppet::Type.type(:consul_policy).new(name: 'foo', id: {}) - }.to raise_error(Puppet::Error, %r{ID must be a string}) + end.to raise_error(Puppet::Error, %r{ID must be a string}) end it 'fails if description ist not a string' do - expect { + expect do Puppet::Type.type(:consul_policy).new(name: 'foo', description: {}) - }.to raise_error(Puppet::Error, %r{Description must be a string}) + end.to raise_error(Puppet::Error, %r{Description must be a string}) end it 'fails if datacenters list is not an array' do - expect { + expect do Puppet::Type.type(:consul_policy).new(name: 'foo', datacenters: [[]]) - }.to raise_error(Puppet::Error, %r{Datacenter name list must be an array of strings}) + end.to raise_error(Puppet::Error, %r{Datacenter name list must be an array of strings}) end it 'fails if rules is not a hash' do - expect { + expect do Puppet::Type.type(:consul_policy).new( - name: 'testing', - id: '39c75e12-7f43-0a40-dfba-9aa3fcda08d4', - description: 'test description', - rules: 'abc', - ) - }.to raise_error(Puppet::Error, %r{Policy rule must be a hash}) + name: 'testing', + id: '39c75e12-7f43-0a40-dfba-9aa3fcda08d4', + description: 'test description', + rules: 'abc' + ) + end.to raise_error(Puppet::Error, %r{Policy rule must be a hash}) end it 'fails if rule resource is missing' do - expect { + expect do Puppet::Type.type(:consul_policy).new( - name: 'testing', - id: '39c75e12-7f43-0a40-dfba-9aa3fcda08d4', - description: 'test description', - rules: [ - { - 'segment' => 'test_service', - 'disposition' => 'read' - }, - ], - ) - }.to raise_error(Puppet::Error, %r{Policy rule needs to specify a resource}) + name: 'testing', + id: '39c75e12-7f43-0a40-dfba-9aa3fcda08d4', + description: 'test description', + rules: [ + { + 'segment' => 'test_service', + 'disposition' => 'read' + }, + ] + ) + end.to raise_error(Puppet::Error, %r{Policy rule needs to specify a resource}) end it 'fails if rule disposition is missing' do - expect { + expect do Puppet::Type.type(:consul_policy).new( - name: 'testing', - id: '39c75e12-7f43-0a40-dfba-9aa3fcda08d4', - description: 'test description', - rules: [ - { - 'resource' => 'service_prefix', - 'segment' => 'test_service', - }, - ], - ) - }.to raise_error(Puppet::Error, %r{Policy rule needs to specify a disposition}) + name: 'testing', + id: '39c75e12-7f43-0a40-dfba-9aa3fcda08d4', + description: 'test description', + rules: [ + { + 'resource' => 'service_prefix', + 'segment' => 'test_service', + }, + ] + ) + end.to raise_error(Puppet::Error, %r{Policy rule needs to specify a disposition}) end it 'fails if rule resource is not a string' do - expect { + expect do Puppet::Type.type(:consul_policy).new( - name: 'testing', - id: '39c75e12-7f43-0a40-dfba-9aa3fcda08d4', - description: 'test description', - rules: [ - { - 'resource' => [], - 'segment' => 'test_service', - 'disposition' => 'read' - }, - ], - ) - }.to raise_error(Puppet::Error, %r{Policy rule resource must be a string}) + name: 'testing', + id: '39c75e12-7f43-0a40-dfba-9aa3fcda08d4', + description: 'test description', + rules: [ + { + 'resource' => [], + 'segment' => 'test_service', + 'disposition' => 'read' + }, + ] + ) + end.to raise_error(Puppet::Error, %r{Policy rule resource must be a string}) end it 'fails if rule disposition is not a string' do - expect { + expect do Puppet::Type.type(:consul_policy).new( + name: 'testing', + id: '39c75e12-7f43-0a40-dfba-9aa3fcda08d4', + description: 'test description', + rules: [ + { + 'resource' => 'key_prefix', + 'segment' => 'test_service', + 'disposition' => [] + }, + ] + ) + end.to raise_error(Puppet::Error, %r{Policy rule disposition must be a string}) + end + + context 'resource is acl, operator or keyring' do + it 'passes if rule segment is missing' do + expect do + Puppet::Type.type(:consul_policy).new( name: 'testing', id: '39c75e12-7f43-0a40-dfba-9aa3fcda08d4', description: 'test description', rules: [ { - 'resource' => 'key_prefix', - 'segment' => 'test_service', - 'disposition' => [] + 'resource' => 'acl', + 'disposition' => 'read' }, - ], + ] ) - }.to raise_error(Puppet::Error, %r{Policy rule disposition must be a string}) - end - - context 'resource is acl, operator or keyring' do - it 'passes if rule segment is missing' do - expect { - Puppet::Type.type(:consul_policy).new( - name: 'testing', - id: '39c75e12-7f43-0a40-dfba-9aa3fcda08d4', - description: 'test description', - rules: [ - { - 'resource' => 'acl', - 'disposition' => 'read' - }, - ], - ) Puppet::Type.type(:consul_policy).new( name: 'testing', id: '39c75e12-7f43-0a40-dfba-9aa3fcda08d4', @@ -123,9 +123,9 @@ rules: [ { 'resource' => 'operator', - 'disposition' => 'read' + 'disposition' => 'read' }, - ], + ] ) Puppet::Type.type(:consul_policy).new( name: 'testing', @@ -134,63 +134,63 @@ rules: [ { 'resource' => 'keyring', - 'disposition' => 'read' + 'disposition' => 'read' }, - ], + ] ) - }.not_to raise_error + end.not_to raise_error end it 'passes if rule segment is not a string' do - expect { + expect do Puppet::Type.type(:consul_policy).new( - name: 'testing', - id: '39c75e12-7f43-0a40-dfba-9aa3fcda08d4', - description: 'test description', - rules: [ - { - 'resource' => 'operator', - 'segment' => [], - 'disposition' => 'read' - }, - ], - ) - }.not_to raise_error + name: 'testing', + id: '39c75e12-7f43-0a40-dfba-9aa3fcda08d4', + description: 'test description', + rules: [ + { + 'resource' => 'operator', + 'segment' => [], + 'disposition' => 'read' + }, + ] + ) + end.not_to raise_error end end context 'resource is neither acl nor operator nor keyring' do it 'fails if rule segment is missing' do - expect { + expect do Puppet::Type.type(:consul_policy).new( - name: 'testing', - id: '39c75e12-7f43-0a40-dfba-9aa3fcda08d4', - description: 'test description', - rules: [ - { - 'resource' => 'service_prefix', - 'disposition' => 'read' - }, - ], - ) - }.to raise_error(Puppet::Error, %r{Policy rule needs to specify a segment}) + name: 'testing', + id: '39c75e12-7f43-0a40-dfba-9aa3fcda08d4', + description: 'test description', + rules: [ + { + 'resource' => 'service_prefix', + 'disposition' => 'read' + }, + ] + ) + end.to raise_error(Puppet::Error, %r{Policy rule needs to specify a segment}) end it 'fails if rule segment is not a string' do - expect { + expect do Puppet::Type.type(:consul_policy).new( - name: 'testing', - id: '39c75e12-7f43-0a40-dfba-9aa3fcda08d4', - description: 'test description', - rules: [ - { - 'resource' => 'key_prefix', - 'segment' => [], - 'disposition' => 'read' - }, - ], - ) - }.to raise_error(Puppet::Error, %r{Policy rule segment must be a string}) + name: 'testing', + id: '39c75e12-7f43-0a40-dfba-9aa3fcda08d4', + description: 'test description', + rules: [ + { + 'resource' => 'key_prefix', + 'segment' => [], + 'disposition' => 'read' + }, + ] + ) + end.to raise_error(Puppet::Error, %r{Policy rule segment must be a string}) end end @@ -198,24 +198,24 @@ rules = [ { 'resource' => 'service_prefix', - 'segment' => 'test_service', - 'disposition' => 'read' + 'segment' => 'test_service', + 'disposition' => 'read' }, { 'resource' => 'key_prefix', - 'segment' => 'key', - 'disposition' => 'write' + 'segment' => 'key', + 'disposition' => 'write' }, ] datacenters = ['testdc'] - before :each do + before do @policy = Puppet::Type.type(:consul_policy).new( name: 'testing', id: '39c75e12-7f43-0a40-dfba-9aa3fcda08d4', description: 'test description', datacenters: datacenters, - rules: rules, + rules: rules ) end diff --git a/spec/unit/puppet/type/consul_prepared_query_spec.rb b/spec/unit/puppet/type/consul_prepared_query_spec.rb index 8b1ec986..525b4bcf 100644 --- a/spec/unit/puppet/type/consul_prepared_query_spec.rb +++ b/spec/unit/puppet/type/consul_prepared_query_spec.rb @@ -2,22 +2,22 @@ describe Puppet::Type.type(:consul_prepared_query) do it 'fails if no name is provided' do - expect { + expect do Puppet::Type.type(:consul_prepared_query).new(type: 'client') - }.to raise_error(Puppet::Error, %r{Title or name must be provided}) + end.to raise_error(Puppet::Error, %r{Title or name must be provided}) end context 'with query parameters provided' do - before :each do + before do @prepared_query = Puppet::Type.type(:consul_prepared_query).new( name: 'testing', token: '', service_name: 'testing', service_failover_n: 1, - service_failover_dcs: [ 'dc1', 'dc2' ], - service_tags: [ 'tag1', 'tag2' ], + service_failover_dcs: %w[dc1 dc2], + service_tags: %w[tag1 tag2], service_only_passing: true, - ttl: 10, + ttl: 10 ) end diff --git a/spec/unit/puppet/type/consul_token_spec.rb b/spec/unit/puppet/type/consul_token_spec.rb index 632de082..91c316a5 100644 --- a/spec/unit/puppet/type/consul_token_spec.rb +++ b/spec/unit/puppet/type/consul_token_spec.rb @@ -2,45 +2,45 @@ describe Puppet::Type.type(:consul_token) do it 'fails if no name is provided' do - expect { + expect do Puppet::Type.type(:consul_token).new(type: 'client') - }.to raise_error(Puppet::Error, %r{Title or name must be provided}) + end.to raise_error(Puppet::Error, %r{Title or name must be provided}) end it 'fails if accessor_id ist not a string' do - expect { + expect do Puppet::Type.type(:consul_token).new(name: 'foo', accessor_id: {}) - }.to raise_error(Puppet::Error, %r{ID must be a string}) + end.to raise_error(Puppet::Error, %r{ID must be a string}) end it 'fails if secret_id ist not a string' do - expect { + expect do Puppet::Type.type(:consul_token).new(name: 'foo', secret_id: {}) - }.to raise_error(Puppet::Error, %r{ID must be a string}) + end.to raise_error(Puppet::Error, %r{ID must be a string}) end it 'fails if policy name list is not an array' do - expect { + expect do Puppet::Type.type(:consul_token).new(name: 'foo', policies_by_name: [[]]) - }.to raise_error(Puppet::Error, %r{Policy name list must be an array of strings}) + end.to raise_error(Puppet::Error, %r{Policy name list must be an array of strings}) end it 'fails if policy ID list is not an array' do - expect { + expect do Puppet::Type.type(:consul_token).new(name: 'foo', policies_by_id: [[]]) - }.to raise_error(Puppet::Error, %r{Policy ID list must be an array of strings}) + end.to raise_error(Puppet::Error, %r{Policy ID list must be an array of strings}) end context 'with name defined' do policies_by_name = ['test_1' 'test_2'] policies_by_id = ['abc-123' 'xyz-456'] - before :each do + before do @token = Puppet::Type.type(:consul_token).new( name: 'testing', accessor_id: '39c75e12-7f43-0a40-dfba-9aa3fcda08d4', policies_by_name: policies_by_name, - policies_by_id: policies_by_id, + policies_by_id: policies_by_id ) end From dad64dab02bcaa813f8ae0f8ac34f3b1dd655289 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 19 Apr 2022 09:31:43 +0200 Subject: [PATCH 10/19] rubocop: generate todo file --- .rubocop.yml | 2 + .rubocop_todo.yml | 158 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 160 insertions(+) create mode 100644 .rubocop_todo.yml diff --git a/.rubocop.yml b/.rubocop.yml index 53ac1898..ea22bff8 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,4 +1,6 @@ --- +inherit_from: .rubocop_todo.yml + # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 00000000..fe12e5a3 --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,158 @@ +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2022-04-19 07:31:23 UTC using RuboCop version 1.22.3. +# The point is for the user to remove these configuration records +# one by one as the offenses are removed from the code base. +# Note that changes in the inspected code, or installation of new +# versions of RuboCop, may require this file to be generated again. + +# Offense count: 3 +# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches. +Lint/DuplicateBranch: + Exclude: + - 'spec/classes/init_spec.rb' + +# Offense count: 1 +# Configuration parameters: AllowComments, AllowEmptyLambdas. +Lint/EmptyBlock: + Exclude: + - 'lib/puppet/type/consul_acl.rb' + +# Offense count: 2 +Lint/ImplicitStringConcatenation: + Exclude: + - 'spec/unit/puppet/type/consul_token_spec.rb' + +# Offense count: 1 +Lint/NonLocalExitFromIterator: + Exclude: + - 'lib/puppet/provider/consul_policy/default.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: AllowedImplicitNamespaces. +# AllowedImplicitNamespaces: Gem +Lint/RaiseException: + Exclude: + - 'lib/puppet/functions/consul/sorted_json.rb' + +# Offense count: 1 +Lint/ShadowingOuterLocalVariable: + Exclude: + - 'lib/puppet/provider/consul_token/default.rb' + +# Offense count: 2 +Lint/UselessAssignment: + Exclude: + - 'lib/puppet/provider/consul_key_value/default.rb' + +# Offense count: 1 +# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros. +# NamePrefix: is_, has_, have_ +# ForbiddenPrefixes: is_, has_, have_ +# AllowedMethods: is_a? +# MethodDefinitionMacros: define_method, define_singleton_method +Naming/PredicateName: + Exclude: + - 'spec/**/*' + - 'lib/puppet/provider/consul_token/default.rb' + +# Offense count: 32 +# Configuration parameters: AssignmentOnly. +RSpec/InstanceVariable: + Exclude: + - 'spec/functions/consul_sorted_json_spec.rb' + - 'spec/unit/puppet/type/consul_acl_spec.rb' + - 'spec/unit/puppet/type/consul_key_value_spec.rb' + - 'spec/unit/puppet/type/consul_policy_spec.rb' + - 'spec/unit/puppet/type/consul_prepared_query_spec.rb' + - 'spec/unit/puppet/type/consul_token_spec.rb' + +# Offense count: 2 +RSpec/RepeatedExampleGroupBody: + Exclude: + - 'spec/classes/init_spec.rb' + +# Offense count: 10 +RSpec/RepeatedExampleGroupDescription: + Exclude: + - 'spec/acceptance/class_spec.rb' + - 'spec/classes/init_spec.rb' + - 'spec/defines/consul_check_spec.rb' + +# Offense count: 13 +RSpec/VoidExpect: + Exclude: + - 'spec/defines/consul_check_spec.rb' + - 'spec/defines/consul_service_spec.rb' + - 'spec/defines/consul_watch_spec.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/CaseLikeIf: + Exclude: + - 'lib/puppet/provider/consul_key_value/default.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: PreferredMethods, MethodsAcceptingSymbol. +# MethodsAcceptingSymbol: inject, reduce +Style/CollectionMethods: + Exclude: + - 'lib/puppet/provider/consul_acl/default.rb' + - 'lib/puppet/provider/consul_key_value/default.rb' + - 'lib/puppet/provider/consul_prepared_query/default.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: allowed_in_returns, forbidden +Style/DoubleNegation: + Exclude: + - 'lib/puppet/type/consul_prepared_query.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: format, sprintf, percent +Style/FormatString: + Exclude: + - 'lib/puppet/functions/consul/validate_checks.rb' + +# Offense count: 3 +# Configuration parameters: MinBodyLength. +Style/GuardClause: + Exclude: + - 'lib/puppet/provider/consul_policy/default.rb' + - 'lib/puppet/provider/consul_token/default.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, IgnoredMethods. +# SupportedStyles: predicate, comparison +Style/NumericPredicate: + Exclude: + - 'spec/**/*' + - 'lib/puppet/provider/consul_policy/default.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: SafeForConstants. +Style/RedundantFetchBlock: + Exclude: + - 'lib/facter/consul_version.rb' + +# Offense count: 6 +# Cop supports --auto-correct. +# Configuration parameters: Mode. +Style/StringConcatenation: + Exclude: + - 'lib/facter/consul_version.rb' + - 'lib/puppet/provider/consul_policy/default.rb' + - 'lib/puppet/provider/consul_token/default.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/ZeroLengthPredicate: + Exclude: + - 'lib/puppet/provider/consul_policy/default.rb' From 396d03c05aed09f45ee6d89c7798a2bf915b9414 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 19 Apr 2022 09:43:43 +0200 Subject: [PATCH 11/19] rubocop: disable Style/FrozenStringLiteralComment --- .rubocop_todo.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index fe12e5a3..ee923e1c 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2022-04-19 07:31:23 UTC using RuboCop version 1.22.3. +# on 2022-04-19 07:43:26 UTC using RuboCop version 1.22.3. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -119,6 +119,13 @@ Style/FormatString: Exclude: - 'lib/puppet/functions/consul/validate_checks.rb' +# Offense count: 31 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: always, always_true, never +Style/FrozenStringLiteralComment: + Enabled: false + # Offense count: 3 # Configuration parameters: MinBodyLength. Style/GuardClause: @@ -135,13 +142,6 @@ Style/NumericPredicate: - 'spec/**/*' - 'lib/puppet/provider/consul_policy/default.rb' -# Offense count: 1 -# Cop supports --auto-correct. -# Configuration parameters: SafeForConstants. -Style/RedundantFetchBlock: - Exclude: - - 'lib/facter/consul_version.rb' - # Offense count: 6 # Cop supports --auto-correct. # Configuration parameters: Mode. From 26d875e04312b1d5aa5d737ad9e7c81f22e0a6df Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 20 Apr 2022 16:06:55 +0200 Subject: [PATCH 12/19] Cleanup metadata.json/README.md after migration Fixes https://github.com/voxpupuli/puppet-consul/issues/576 --- README.md | 26 ++++++++++++++++++++------ metadata.json | 15 ++++++--------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 4e31da9a..fc159458 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,14 @@ -# KyleAnderson/consul - -[![Puppet Forge](https://img.shields.io/puppetforge/e/KyleAnderson/consul.svg)](https://forge.puppetlabs.com/KyleAnderson/consul) -[![Puppet Forge](https://img.shields.io/puppetforge/v/KyleAnderson/consul.svg)](https://forge.puppetlabs.com/KyleAnderson/consul) -[![Puppet Forge](https://img.shields.io/puppetforge/f/KyleAnderson/consul.svg)](https://forge.puppetlabs.com/KyleAnderson/consul) -[![Build Status](https://github.com/solarkennedy/puppet-consul/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/solarkennedy/puppet-consul/actions/workflows/ci.yml) +# puppet-consul + +[![Build Status](https://github.com/voxpupuli/puppet-consul/workflows/CI/badge.svg)](https://github.com/voxpupuli/puppet-consul/actions?query=workflow%3ACI) +[![Release](https://github.com/voxpupuli/puppet-consul/actions/workflows/release.yml/badge.svg)](https://github.com/voxpupuli/puppet-consul/actions/workflows/release.yml) +[![Puppet Forge](https://img.shields.io/puppetforge/v/puppet/consul.svg)](https://forge.puppetlabs.com/puppet/consul) +[![Puppet Forge - downloads](https://img.shields.io/puppetforge/dt/puppet/consul.svg)](https://forge.puppetlabs.com/puppet/consul) +[![Puppet Forge - endorsement](https://img.shields.io/puppetforge/e/puppet/consul.svg)](https://forge.puppetlabs.com/puppet/consul) +[![Puppet Forge - scores](https://img.shields.io/puppetforge/f/puppet/consul.svg)](https://forge.puppetlabs.com/puppet/consul) +[![puppetmodule.info docs](http://www.puppetmodule.info/images/badge.png)](http://www.puppetmodule.info/m/puppet-consul) +[![Apache-2 License](https://img.shields.io/github/license/voxpupuli/puppet-consul.svg)](LICENSE) +[![Donated by KyleAnderson](https://img.shields.io/badge/donated%20by-KyleAnderson-fb7047.svg)](#transfer-notice) This module manages Consul servers and agents. @@ -499,3 +504,12 @@ a module that can do that. Open an [issue](https://github.com/solarkennedy/puppet-consul/issues) or [fork](https://github.com/solarkennedy/puppet-consul/fork) and open a [Pull Request](https://github.com/solarkennedy/puppet-consul/pulls) + + +## Transfer Notice + +This plugin was originally authored by [KyleAnderson](http://github.com/KyleAnderson). +The maintainer preferred that Vox Pupuli take ownership of the module for future improvement and maintenance. +Existing pull requests and issues were transferred over, please fork and continue to contribute here instead of Camptocamp. + +Previously: https://github.com/KyleAnderson/puppet-consul diff --git a/metadata.json b/metadata.json index b106a241..b43b928e 100644 --- a/metadata.json +++ b/metadata.json @@ -1,12 +1,12 @@ { - "name": "KyleAnderson-consul", + "name": "puppet-consul", "version": "7.0.2", - "author": "Kyle Anderson ", + "author": "Vox Pupuli", "summary": "Configures Consul by Hashicorp", "license": "Apache-2.0", - "source": "https://github.com/solarkennedy/puppet-consul", - "project_page": "https://github.com/solarkennedy/puppet-consul", - "issues_url": "https://github.com/solarkennedy/puppet-consul/issues", + "source": "https://github.com/voxpuupli/puppet-consul", + "project_page": "https://github.com/voxpupuli/puppet-consul", + "issues_url": "https://github.com/voxpupuli/puppet-consul/issues", "dependencies": [ { "name": "puppet/systemd", @@ -120,8 +120,5 @@ "version_requirement": ">= 6.1.0 < 8.0.0" } ], - "description": "Configures Consul by Hashicorp", - "pdk-version": "2.1.0", - "template-url": "pdk-default#2.1.0", - "template-ref": "tags/2.1.0-0-ga675ea5" + "description": "Configures Consul by Hashicorp" } From d5366abe22c5991cb3dc9b74eddd4ee5625d68d1 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 20 Apr 2022 16:08:46 +0200 Subject: [PATCH 13/19] puppet/archive: Allow 6.x --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index b106a241..a83e091f 100644 --- a/metadata.json +++ b/metadata.json @@ -14,7 +14,7 @@ }, { "name": "puppet/archive", - "version_requirement": ">= 5.0.0 < 6.0.0" + "version_requirement": ">= 5.0.0 < 7.0.0" }, { "name": "puppet/hashi_stack", From e09c598c50d4d8745ec878c398718d99b325e8a3 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 20 Apr 2022 16:09:16 +0200 Subject: [PATCH 14/19] puppetlabs/stdlib: Allow 8.x --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index a83e091f..efa1f781 100644 --- a/metadata.json +++ b/metadata.json @@ -22,7 +22,7 @@ }, { "name": "puppetlabs/stdlib", - "version_requirement": ">= 6.6.0 < 8.0.0" + "version_requirement": ">= 6.6.0 < 9.0.0" } ], "operatingsystem_support": [ From ac3b3497705747f11ef794c3aac36c1789c07b7d Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 20 Apr 2022 16:22:49 +0200 Subject: [PATCH 15/19] Release 7.1.0 --- CHANGELOG.md | 1114 +++++++++++++++++++++++++------------------------ metadata.json | 2 +- 2 files changed, 573 insertions(+), 543 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57b56a03..fc1f6d34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,864 +1,894 @@ # Changelog -## [7.0.2](https://github.com/solarkennedy/puppet-consul/tree/7.0.2) (2021-06-12) +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. -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v7.0.1...7.0.2) +## [v7.1.0](https://github.com/voxpupuli/puppet-consul/tree/v7.1.0) (2022-04-20) + +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v7.0.2...v7.1.0) + +**Implemented enhancements:** + +- Adding datacenters property for Consul policies [\#590](https://github.com/voxpupuli/puppet-consul/pull/590) ([jonesbrennan](https://github.com/jonesbrennan)) +- Add special rule format for keyring type policy [\#582](https://github.com/voxpupuli/puppet-consul/pull/582) ([weastur](https://github.com/weastur)) +- Allow changing the configuration directory and files owner [\#535](https://github.com/voxpupuli/puppet-consul/pull/535) ([thias](https://github.com/thias)) + +**Closed issues:** + +- migrate module to Vox Pupuli? [\#576](https://github.com/voxpupuli/puppet-consul/issues/576) +- info required - Apply ACL on https consul [\#517](https://github.com/voxpupuli/puppet-consul/issues/517) + +**Merged pull requests:** + +- puppet/archive & puppetlabs/stdli: Allow latest versions [\#594](https://github.com/voxpupuli/puppet-consul/pull/594) ([bastelfreak](https://github.com/bastelfreak)) +- Cleanup metadata.json/README.md after migration [\#593](https://github.com/voxpupuli/puppet-consul/pull/593) ([bastelfreak](https://github.com/bastelfreak)) +- updating README.md for consul version compatibility [\#592](https://github.com/voxpupuli/puppet-consul/pull/592) ([jonesbrennan](https://github.com/jonesbrennan)) +- Switch from camptocamp/systemd to puppet/systemd [\#586](https://github.com/voxpupuli/puppet-consul/pull/586) ([bastelfreak](https://github.com/bastelfreak)) +- Run unit tests on CI [\#583](https://github.com/voxpupuli/puppet-consul/pull/583) ([weastur](https://github.com/weastur)) + +## [v7.0.2](https://github.com/voxpupuli/puppet-consul/tree/v7.0.2) (2021-06-12) + +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v7.0.1...v7.0.2) + +**Closed issues:** + +- Module Release? [\#578](https://github.com/voxpupuli/puppet-consul/issues/578) **Merged pull requests:** -- enable ssl when protocol is https [\#577](https://github.com/solarkennedy/puppet-consul/pull/577) ([SimonPe](https://github.com/SimonPe)) +- enable ssl when protocol is https [\#577](https://github.com/voxpupuli/puppet-consul/pull/577) ([SimonPe](https://github.com/SimonPe)) -## [v7.0.1](https://github.com/solarkennedy/puppet-consul/tree/v7.0.1) (2021-06-12) +## [v7.0.1](https://github.com/voxpupuli/puppet-consul/tree/v7.0.1) (2021-06-12) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v7.0.0...v7.0.1) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v7.0.0...v7.0.1) **Fixed bugs:** -- Make home directory location setting optional [\#575](https://github.com/solarkennedy/puppet-consul/pull/575) ([genebean](https://github.com/genebean)) +- Make home directory location setting optional [\#575](https://github.com/voxpupuli/puppet-consul/pull/575) ([genebean](https://github.com/genebean)) **Closed issues:** -- Migrate from master to main [\#572](https://github.com/solarkennedy/puppet-consul/issues/572) -- New Home Attribute on consul user resource breaks our puppet runs. [\#559](https://github.com/solarkennedy/puppet-consul/issues/559) -- Compatibility with Puppet 3.6 [\#503](https://github.com/solarkennedy/puppet-consul/issues/503) -- upgrade puppetlabs-stdlib version in dependencies to \< 7.0.0? [\#496](https://github.com/solarkennedy/puppet-consul/issues/496) -- service weights needs integer [\#492](https://github.com/solarkennedy/puppet-consul/issues/492) +- Migrate from master to main [\#572](https://github.com/voxpupuli/puppet-consul/issues/572) +- New Home Attribute on consul user resource breaks our puppet runs. [\#559](https://github.com/voxpupuli/puppet-consul/issues/559) +- Compatibility with Puppet 3.6 [\#503](https://github.com/voxpupuli/puppet-consul/issues/503) +- upgrade puppetlabs-stdlib version in dependencies to \< 7.0.0? [\#496](https://github.com/voxpupuli/puppet-consul/issues/496) +- service weights needs integer [\#492](https://github.com/voxpupuli/puppet-consul/issues/492) **Merged pull requests:** -- Release v7.0.0 [\#574](https://github.com/solarkennedy/puppet-consul/pull/574) ([solarkennedy](https://github.com/solarkennedy)) +- Release v7.0.0 [\#574](https://github.com/voxpupuli/puppet-consul/pull/574) ([solarkennedy](https://github.com/solarkennedy)) -## [v7.0.0](https://github.com/solarkennedy/puppet-consul/tree/v7.0.0) (2021-05-12) +## [v7.0.0](https://github.com/voxpupuli/puppet-consul/tree/v7.0.0) (2021-05-12) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v6.1.0...v7.0.0) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v6.1.0...v7.0.0) **Breaking changes:** -- Drop support for EoL Puppet 5 [\#571](https://github.com/solarkennedy/puppet-consul/issues/571) -- Drop support for old SLES/SLED versions [\#570](https://github.com/solarkennedy/puppet-consul/issues/570) -- Drop EoL FreeBSD 10 support [\#569](https://github.com/solarkennedy/puppet-consul/issues/569) -- Drop EoL Fedora 25/26/27 support [\#568](https://github.com/solarkennedy/puppet-consul/issues/568) -- Drop EoL Amazon Linux support [\#567](https://github.com/solarkennedy/puppet-consul/issues/567) -- Drop EoL Ubuntu 16.04 support [\#566](https://github.com/solarkennedy/puppet-consul/issues/566) -- Drop EoL CentOS/RHEL 6 support [\#565](https://github.com/solarkennedy/puppet-consul/issues/565) -- consul user: set correct home [\#550](https://github.com/solarkennedy/puppet-consul/pull/550) ([bastelfreak](https://github.com/bastelfreak)) +- Drop support for EoL Puppet 5 [\#571](https://github.com/voxpupuli/puppet-consul/issues/571) +- Drop support for old SLES/SLED versions [\#570](https://github.com/voxpupuli/puppet-consul/issues/570) +- Drop EoL FreeBSD 10 support [\#569](https://github.com/voxpupuli/puppet-consul/issues/569) +- Drop EoL Fedora 25/26/27 support [\#568](https://github.com/voxpupuli/puppet-consul/issues/568) +- Drop EoL Amazon Linux support [\#567](https://github.com/voxpupuli/puppet-consul/issues/567) +- Drop EoL Ubuntu 16.04 support [\#566](https://github.com/voxpupuli/puppet-consul/issues/566) +- Drop EoL CentOS/RHEL 6 support [\#565](https://github.com/voxpupuli/puppet-consul/issues/565) +- consul user: set correct home [\#550](https://github.com/voxpupuli/puppet-consul/pull/550) ([bastelfreak](https://github.com/bastelfreak)) **Implemented enhancements:** -- Allow for alias\_service checks [\#520](https://github.com/solarkennedy/puppet-consul/pull/520) ([genebean](https://github.com/genebean)) +- Allow for alias\_service checks [\#520](https://github.com/voxpupuli/puppet-consul/pull/520) ([genebean](https://github.com/genebean)) **Fixed bugs:** -- sorted\_json should quote args for checks [\#548](https://github.com/solarkennedy/puppet-consul/pull/548) ([hdeheer](https://github.com/hdeheer)) +- sorted\_json should quote args for checks [\#548](https://github.com/voxpupuli/puppet-consul/pull/548) ([hdeheer](https://github.com/hdeheer)) **Closed issues:** -- Registering multiple services from same node/instance with same name [\#562](https://github.com/solarkennedy/puppet-consul/issues/562) -- HCL Config Support [\#557](https://github.com/solarkennedy/puppet-consul/issues/557) -- Can not download the archive. need to allow insecure access to download for archive [\#553](https://github.com/solarkennedy/puppet-consul/issues/553) -- Home directory not created for consul user [\#533](https://github.com/solarkennedy/puppet-consul/issues/533) -- Service port gets quoted with a puppet 6.10 catalog server and consul rejects it [\#526](https://github.com/solarkennedy/puppet-consul/issues/526) +- Registering multiple services from same node/instance with same name [\#562](https://github.com/voxpupuli/puppet-consul/issues/562) +- HCL Config Support [\#557](https://github.com/voxpupuli/puppet-consul/issues/557) +- Can not download the archive. need to allow insecure access to download for archive [\#553](https://github.com/voxpupuli/puppet-consul/issues/553) +- Home directory not created for consul user [\#533](https://github.com/voxpupuli/puppet-consul/issues/533) +- Service port gets quoted with a puppet 6.10 catalog server and consul rejects it [\#526](https://github.com/voxpupuli/puppet-consul/issues/526) **Merged pull requests:** -- List Debian 10 as supported [\#573](https://github.com/solarkennedy/puppet-consul/pull/573) ([genebean](https://github.com/genebean)) -- OS and Puppet versions update [\#564](https://github.com/solarkennedy/puppet-consul/pull/564) ([genebean](https://github.com/genebean)) -- PDK update, move CI to GH Actions [\#563](https://github.com/solarkennedy/puppet-consul/pull/563) ([genebean](https://github.com/genebean)) -- adding the option to setup the upstream HashiCorp repository [\#560](https://github.com/solarkennedy/puppet-consul/pull/560) ([attachmentgenie](https://github.com/attachmentgenie)) -- Add config\_name parameter to define the name of the consul config [\#558](https://github.com/solarkennedy/puppet-consul/pull/558) ([bogdankatishev](https://github.com/bogdankatishev)) -- Add description parameter for token [\#556](https://github.com/solarkennedy/puppet-consul/pull/556) ([Hexta](https://github.com/Hexta)) -- Add new check options [\#555](https://github.com/solarkennedy/puppet-consul/pull/555) ([Rekenn](https://github.com/Rekenn)) -- notify systemd when consul daemon is really started [\#552](https://github.com/solarkennedy/puppet-consul/pull/552) ([ymartin-ovh](https://github.com/ymartin-ovh)) -- Added stale bot to close super old issues [\#549](https://github.com/solarkennedy/puppet-consul/pull/549) ([solarkennedy](https://github.com/solarkennedy)) -- Make stringification a parameter of the sorted\_json helper functions [\#547](https://github.com/solarkennedy/puppet-consul/pull/547) ([rtkennedy](https://github.com/rtkennedy)) +- List Debian 10 as supported [\#573](https://github.com/voxpupuli/puppet-consul/pull/573) ([genebean](https://github.com/genebean)) +- OS and Puppet versions update [\#564](https://github.com/voxpupuli/puppet-consul/pull/564) ([genebean](https://github.com/genebean)) +- PDK update, move CI to GH Actions [\#563](https://github.com/voxpupuli/puppet-consul/pull/563) ([genebean](https://github.com/genebean)) +- adding the option to setup the upstream HashiCorp repository [\#560](https://github.com/voxpupuli/puppet-consul/pull/560) ([attachmentgenie](https://github.com/attachmentgenie)) +- Add config\_name parameter to define the name of the consul config [\#558](https://github.com/voxpupuli/puppet-consul/pull/558) ([bogdankatishev](https://github.com/bogdankatishev)) +- Add description parameter for token [\#556](https://github.com/voxpupuli/puppet-consul/pull/556) ([Hexta](https://github.com/Hexta)) +- Add new check options [\#555](https://github.com/voxpupuli/puppet-consul/pull/555) ([Rekenn](https://github.com/Rekenn)) +- notify systemd when consul daemon is really started [\#552](https://github.com/voxpupuli/puppet-consul/pull/552) ([ymartin-ovh](https://github.com/ymartin-ovh)) +- Added stale bot to close super old issues [\#549](https://github.com/voxpupuli/puppet-consul/pull/549) ([solarkennedy](https://github.com/solarkennedy)) +- Make stringification a parameter of the sorted\_json helper functions [\#547](https://github.com/voxpupuli/puppet-consul/pull/547) ([rtkennedy](https://github.com/rtkennedy)) -## [v6.1.0](https://github.com/solarkennedy/puppet-consul/tree/v6.1.0) (2020-08-18) +## [v6.1.0](https://github.com/voxpupuli/puppet-consul/tree/v6.1.0) (2020-08-18) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v6.0.1...v6.1.0) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v6.0.1...v6.1.0) **Fixed bugs:** -- Sysv init script: redirect stderr to logfile [\#545](https://github.com/solarkennedy/puppet-consul/pull/545) ([bastelfreak](https://github.com/bastelfreak)) +- Sysv init script: redirect stderr to logfile [\#545](https://github.com/voxpupuli/puppet-consul/pull/545) ([bastelfreak](https://github.com/bastelfreak)) **Closed issues:** -- No obvious support for setting headers for inline service checks [\#542](https://github.com/solarkennedy/puppet-consul/issues/542) -- Add support for Ingress Controllers using Configuration Entries [\#538](https://github.com/solarkennedy/puppet-consul/issues/538) -- Define service without including consul \#question [\#536](https://github.com/solarkennedy/puppet-consul/issues/536) -- What do I need to do to to get the nslcd service started before the Consul service [\#531](https://github.com/solarkennedy/puppet-consul/issues/531) -- Consul user not found in /etc/passwd issue [\#530](https://github.com/solarkennedy/puppet-consul/issues/530) -- Can't set consul watch from hiera [\#518](https://github.com/solarkennedy/puppet-consul/issues/518) -- Clarification - What is acl\_api\_token? [\#505](https://github.com/solarkennedy/puppet-consul/issues/505) -- consul\_token is not idempotent [\#490](https://github.com/solarkennedy/puppet-consul/issues/490) -- Support for External Services [\#252](https://github.com/solarkennedy/puppet-consul/issues/252) +- No obvious support for setting headers for inline service checks [\#542](https://github.com/voxpupuli/puppet-consul/issues/542) +- Add support for Ingress Controllers using Configuration Entries [\#538](https://github.com/voxpupuli/puppet-consul/issues/538) +- Define service without including consul \#question [\#536](https://github.com/voxpupuli/puppet-consul/issues/536) +- What do I need to do to to get the nslcd service started before the Consul service [\#531](https://github.com/voxpupuli/puppet-consul/issues/531) +- Consul user not found in /etc/passwd issue [\#530](https://github.com/voxpupuli/puppet-consul/issues/530) +- Can't set consul watch from hiera [\#518](https://github.com/voxpupuli/puppet-consul/issues/518) +- Clarification - What is acl\_api\_token? [\#505](https://github.com/voxpupuli/puppet-consul/issues/505) +- consul\_token is not idempotent [\#490](https://github.com/voxpupuli/puppet-consul/issues/490) +- Support for External Services [\#252](https://github.com/voxpupuli/puppet-consul/issues/252) **Merged pull requests:** -- release 6.1.0 [\#546](https://github.com/solarkennedy/puppet-consul/pull/546) ([bastelfreak](https://github.com/bastelfreak)) -- Add example http service, including a check that demonstrates how to pass headers [\#543](https://github.com/solarkennedy/puppet-consul/pull/543) ([chrisjohnson](https://github.com/chrisjohnson)) -- update to support raspberry pi arm arch with Hashicorp splitting out file names [\#540](https://github.com/solarkennedy/puppet-consul/pull/540) ([ikonia](https://github.com/ikonia)) -- Fix data\_dir\_mode override [\#534](https://github.com/solarkennedy/puppet-consul/pull/534) ([thias](https://github.com/thias)) -- Add acl\_api\_token to service\_reload class [\#532](https://github.com/solarkennedy/puppet-consul/pull/532) ([cmd-ntrf](https://github.com/cmd-ntrf)) -- Removing OpenSuSE from metadata.json to stop triggering broken tests [\#529](https://github.com/solarkennedy/puppet-consul/pull/529) ([rtkennedy](https://github.com/rtkennedy)) -- Use a filter instead of delete\_undef\_values\(\) [\#528](https://github.com/solarkennedy/puppet-consul/pull/528) ([rtkennedy](https://github.com/rtkennedy)) -- Add option to \(un\)manage the data\_dir [\#523](https://github.com/solarkennedy/puppet-consul/pull/523) ([b3n4kh](https://github.com/b3n4kh)) -- Fix rubocop LineLength \# see https://rubocop.readthedocs.io/en/latest… [\#521](https://github.com/solarkennedy/puppet-consul/pull/521) ([thomas-merz](https://github.com/thomas-merz)) -- fix\(reload\_service\): remove typo in reload\_options [\#516](https://github.com/solarkennedy/puppet-consul/pull/516) ([bmx0r](https://github.com/bmx0r)) +- Add example http service, including a check that demonstrates how to pass headers [\#543](https://github.com/voxpupuli/puppet-consul/pull/543) ([chrisjohnson](https://github.com/chrisjohnson)) +- update to support raspberry pi arm arch with Hashicorp splitting out file names [\#540](https://github.com/voxpupuli/puppet-consul/pull/540) ([ikonia](https://github.com/ikonia)) +- Fix data\_dir\_mode override [\#534](https://github.com/voxpupuli/puppet-consul/pull/534) ([thias](https://github.com/thias)) +- Add acl\_api\_token to service\_reload class [\#532](https://github.com/voxpupuli/puppet-consul/pull/532) ([cmd-ntrf](https://github.com/cmd-ntrf)) +- Removing OpenSuSE from metadata.json to stop triggering broken tests [\#529](https://github.com/voxpupuli/puppet-consul/pull/529) ([rtkennedy](https://github.com/rtkennedy)) +- Use a filter instead of delete\_undef\_values\(\) [\#528](https://github.com/voxpupuli/puppet-consul/pull/528) ([rtkennedy](https://github.com/rtkennedy)) +- Add option to \(un\)manage the data\_dir [\#523](https://github.com/voxpupuli/puppet-consul/pull/523) ([b3n4kh](https://github.com/b3n4kh)) +- Fix rubocop LineLength \# see https://rubocop.readthedocs.io/en/latest… [\#521](https://github.com/voxpupuli/puppet-consul/pull/521) ([thomas-merz](https://github.com/thomas-merz)) +- fix\(reload\_service\): remove typo in reload\_options [\#516](https://github.com/voxpupuli/puppet-consul/pull/516) ([bmx0r](https://github.com/bmx0r)) -## [v6.0.1](https://github.com/solarkennedy/puppet-consul/tree/v6.0.1) (2019-11-21) +## [v6.0.1](https://github.com/voxpupuli/puppet-consul/tree/v6.0.1) (2019-11-21) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v6.0.0...v6.0.1) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v6.0.0...v6.0.1) **Fixed bugs:** -- systemd: Start consul after network is really up [\#512](https://github.com/solarkennedy/puppet-consul/pull/512) ([bastelfreak](https://github.com/bastelfreak)) -- Add a sleep between tries of consul service reload [\#494](https://github.com/solarkennedy/puppet-consul/pull/494) ([cmd-ntrf](https://github.com/cmd-ntrf)) +- systemd: Start consul after network is really up [\#512](https://github.com/voxpupuli/puppet-consul/pull/512) ([bastelfreak](https://github.com/bastelfreak)) +- Add a sleep between tries of consul service reload [\#494](https://github.com/voxpupuli/puppet-consul/pull/494) ([cmd-ntrf](https://github.com/cmd-ntrf)) **Merged pull requests:** -- release 6.0.1 [\#513](https://github.com/solarkennedy/puppet-consul/pull/513) ([bastelfreak](https://github.com/bastelfreak)) +- release 6.0.1 [\#513](https://github.com/voxpupuli/puppet-consul/pull/513) ([bastelfreak](https://github.com/bastelfreak)) -## [v6.0.0](https://github.com/solarkennedy/puppet-consul/tree/v6.0.0) (2019-10-31) +## [v6.0.0](https://github.com/voxpupuli/puppet-consul/tree/v6.0.0) (2019-10-31) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v5.1.0...v6.0.0) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v5.1.0...v6.0.0) **Breaking changes:** -- drop EOL Debian 8 / Puppet 4 / Ubuntu 14.04 / CentOS 5 [\#508](https://github.com/solarkennedy/puppet-consul/pull/508) ([bastelfreak](https://github.com/bastelfreak)) +- drop EOL Debian 8 / Puppet 4 / Ubuntu 14.04 / CentOS 5 [\#508](https://github.com/voxpupuli/puppet-consul/pull/508) ([bastelfreak](https://github.com/bastelfreak)) **Fixed bugs:** -- Fix broken quoting in the config file [\#509](https://github.com/solarkennedy/puppet-consul/pull/509) ([maxadamo](https://github.com/maxadamo)) -- add support for reload over https [\#504](https://github.com/solarkennedy/puppet-consul/pull/504) ([BCarette](https://github.com/BCarette)) +- Fix broken quoting in the config file [\#509](https://github.com/voxpupuli/puppet-consul/pull/509) ([maxadamo](https://github.com/maxadamo)) +- add support for reload over https [\#504](https://github.com/voxpupuli/puppet-consul/pull/504) ([BCarette](https://github.com/BCarette)) **Closed issues:** -- Add support for CNI plugins [\#502](https://github.com/solarkennedy/puppet-consul/issues/502) -- Example of using ACL's in production? [\#486](https://github.com/solarkennedy/puppet-consul/issues/486) -- Puppetforge README and Github README are different [\#485](https://github.com/solarkennedy/puppet-consul/issues/485) +- Add support for CNI plugins [\#502](https://github.com/voxpupuli/puppet-consul/issues/502) +- Example of using ACL's in production? [\#486](https://github.com/voxpupuli/puppet-consul/issues/486) +- Puppetforge README and Github README are different [\#485](https://github.com/voxpupuli/puppet-consul/issues/485) **Merged pull requests:** -- release 6.0.0 [\#510](https://github.com/solarkennedy/puppet-consul/pull/510) ([bastelfreak](https://github.com/bastelfreak)) -- drop puppetlabs/powershell dependency [\#506](https://github.com/solarkennedy/puppet-consul/pull/506) ([bastelfreak](https://github.com/bastelfreak)) -- Bump stdlib & archive versions [\#501](https://github.com/solarkennedy/puppet-consul/pull/501) ([jay7x](https://github.com/jay7x)) -- remove failing tests on centos6 + puppet 6 [\#500](https://github.com/solarkennedy/puppet-consul/pull/500) ([solarkennedy](https://github.com/solarkennedy)) -- systemd template: mention it's managed by puppet [\#495](https://github.com/solarkennedy/puppet-consul/pull/495) ([bastelfreak](https://github.com/bastelfreak)) -- Fix typo [\#489](https://github.com/solarkennedy/puppet-consul/pull/489) ([spuder](https://github.com/spuder)) -- Clarify how to use the new acl system [\#487](https://github.com/solarkennedy/puppet-consul/pull/487) ([spuder](https://github.com/spuder)) +- release 6.0.0 [\#510](https://github.com/voxpupuli/puppet-consul/pull/510) ([bastelfreak](https://github.com/bastelfreak)) +- drop puppetlabs/powershell dependency [\#506](https://github.com/voxpupuli/puppet-consul/pull/506) ([bastelfreak](https://github.com/bastelfreak)) +- Bump stdlib & archive versions [\#501](https://github.com/voxpupuli/puppet-consul/pull/501) ([jay7x](https://github.com/jay7x)) +- remove failing tests on centos6 + puppet 6 [\#500](https://github.com/voxpupuli/puppet-consul/pull/500) ([solarkennedy](https://github.com/solarkennedy)) +- systemd template: mention it's managed by puppet [\#495](https://github.com/voxpupuli/puppet-consul/pull/495) ([bastelfreak](https://github.com/bastelfreak)) +- Fix typo [\#489](https://github.com/voxpupuli/puppet-consul/pull/489) ([spuder](https://github.com/spuder)) +- Clarify how to use the new acl system [\#487](https://github.com/voxpupuli/puppet-consul/pull/487) ([spuder](https://github.com/spuder)) -## [v5.1.0](https://github.com/solarkennedy/puppet-consul/tree/v5.1.0) (2019-07-24) +## [v5.1.0](https://github.com/voxpupuli/puppet-consul/tree/v5.1.0) (2019-07-24) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v5.0.4...v5.1.0) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v5.0.4...v5.1.0) **Implemented enhancements:** -- Lint, style, and parameter data types [\#476](https://github.com/solarkennedy/puppet-consul/pull/476) ([natemccurdy](https://github.com/natemccurdy)) -- Support for Consul 1.4.0+ ACL system [\#474](https://github.com/solarkennedy/puppet-consul/pull/474) ([marius-meissner](https://github.com/marius-meissner)) -- quote all values of tags, meta & node\_meta [\#473](https://github.com/solarkennedy/puppet-consul/pull/473) ([tmu-sprd](https://github.com/tmu-sprd)) +- Lint, style, and parameter data types [\#476](https://github.com/voxpupuli/puppet-consul/pull/476) ([natemccurdy](https://github.com/natemccurdy)) +- Support for Consul 1.4.0+ ACL system [\#474](https://github.com/voxpupuli/puppet-consul/pull/474) ([marius-meissner](https://github.com/marius-meissner)) +- quote all values of tags, meta & node\_meta [\#473](https://github.com/voxpupuli/puppet-consul/pull/473) ([tmu-sprd](https://github.com/tmu-sprd)) **Closed issues:** -- Feature Request: support special policies like `acl` and `operator` without segment option [\#482](https://github.com/solarkennedy/puppet-consul/issues/482) -- New 1.4+ ACL support is not idempotent [\#479](https://github.com/solarkennedy/puppet-consul/issues/479) -- option to strip binary [\#478](https://github.com/solarkennedy/puppet-consul/issues/478) -- \[Feature request\] Provide support for Consul 1.4.0+ ACL System [\#471](https://github.com/solarkennedy/puppet-consul/issues/471) -- Can we get a new release to forge soon? [\#469](https://github.com/solarkennedy/puppet-consul/issues/469) -- Can't use integer on meta hash on services [\#468](https://github.com/solarkennedy/puppet-consul/issues/468) -- Quoted integer \(string\) to integer is breaking tags [\#283](https://github.com/solarkennedy/puppet-consul/issues/283) +- Feature Request: support special policies like `acl` and `operator` without segment option [\#482](https://github.com/voxpupuli/puppet-consul/issues/482) +- New 1.4+ ACL support is not idempotent [\#479](https://github.com/voxpupuli/puppet-consul/issues/479) +- option to strip binary [\#478](https://github.com/voxpupuli/puppet-consul/issues/478) +- \[Feature request\] Provide support for Consul 1.4.0+ ACL System [\#471](https://github.com/voxpupuli/puppet-consul/issues/471) +- Can we get a new release to forge soon? [\#469](https://github.com/voxpupuli/puppet-consul/issues/469) +- Can't use integer on meta hash on services [\#468](https://github.com/voxpupuli/puppet-consul/issues/468) +- Quoted integer \(string\) to integer is breaking tags [\#283](https://github.com/voxpupuli/puppet-consul/issues/283) **Merged pull requests:** -- resources 'acl' and 'operator' don't have a segment [\#483](https://github.com/solarkennedy/puppet-consul/pull/483) ([tmu-sprd](https://github.com/tmu-sprd)) -- Fixing idempotence issues of new ACL system + improved handling of properties [\#480](https://github.com/solarkennedy/puppet-consul/pull/480) ([marius-meissner](https://github.com/marius-meissner)) -- Switch from anchor pattern to contain function [\#475](https://github.com/solarkennedy/puppet-consul/pull/475) ([natemccurdy](https://github.com/natemccurdy)) -- fix case where multiple http\_addr [\#470](https://github.com/solarkennedy/puppet-consul/pull/470) ([robmbrooks](https://github.com/robmbrooks)) +- resources 'acl' and 'operator' don't have a segment [\#483](https://github.com/voxpupuli/puppet-consul/pull/483) ([tmu-sprd](https://github.com/tmu-sprd)) +- Fixing idempotence issues of new ACL system + improved handling of properties [\#480](https://github.com/voxpupuli/puppet-consul/pull/480) ([marius-meissner](https://github.com/marius-meissner)) +- Switch from anchor pattern to contain function [\#475](https://github.com/voxpupuli/puppet-consul/pull/475) ([natemccurdy](https://github.com/natemccurdy)) +- fix case where multiple http\_addr [\#470](https://github.com/voxpupuli/puppet-consul/pull/470) ([robmbrooks](https://github.com/robmbrooks)) -## [v5.0.4](https://github.com/solarkennedy/puppet-consul/tree/v5.0.4) (2019-02-10) +## [v5.0.4](https://github.com/voxpupuli/puppet-consul/tree/v5.0.4) (2019-02-10) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v5.0.3...v5.0.4) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v5.0.3...v5.0.4) **Breaking changes:** -- Updated windows support [\#464](https://github.com/solarkennedy/puppet-consul/pull/464) ([krjensen](https://github.com/krjensen)) +- Updated windows support [\#464](https://github.com/voxpupuli/puppet-consul/pull/464) ([krjensen](https://github.com/krjensen)) **Implemented enhancements:** -- add optional service meta hash [\#466](https://github.com/solarkennedy/puppet-consul/pull/466) ([jardleex](https://github.com/jardleex)) -- Add service\_config\_hash to customize services [\#460](https://github.com/solarkennedy/puppet-consul/pull/460) ([dan-wittenberg](https://github.com/dan-wittenberg)) +- add optional service meta hash [\#466](https://github.com/voxpupuli/puppet-consul/pull/466) ([jardleex](https://github.com/jardleex)) +- Add service\_config\_hash to customize services [\#460](https://github.com/voxpupuli/puppet-consul/pull/460) ([dan-wittenberg](https://github.com/dan-wittenberg)) **Fixed bugs:** -- Don't write out meta parameter when unset [\#467](https://github.com/solarkennedy/puppet-consul/pull/467) ([jarro2783](https://github.com/jarro2783)) -- Change allow for spaces in the path, Add extra\_options to the win agent [\#459](https://github.com/solarkennedy/puppet-consul/pull/459) ([monkey670](https://github.com/monkey670)) +- Don't write out meta parameter when unset [\#467](https://github.com/voxpupuli/puppet-consul/pull/467) ([jarro2783](https://github.com/jarro2783)) +- Change allow for spaces in the path, Add extra\_options to the win agent [\#459](https://github.com/voxpupuli/puppet-consul/pull/459) ([monkey670](https://github.com/monkey670)) **Merged pull requests:** -- PDK convert, merged changes, pdk validate linter cleanup of pp files [\#463](https://github.com/solarkennedy/puppet-consul/pull/463) ([dan-wittenberg](https://github.com/dan-wittenberg)) +- PDK convert, merged changes, pdk validate linter cleanup of pp files [\#463](https://github.com/voxpupuli/puppet-consul/pull/463) ([dan-wittenberg](https://github.com/dan-wittenberg)) -## [v5.0.3](https://github.com/solarkennedy/puppet-consul/tree/v5.0.3) (2018-12-15) +## [v5.0.3](https://github.com/voxpupuli/puppet-consul/tree/v5.0.3) (2018-12-15) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v5.0.1...v5.0.3) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v5.0.1...v5.0.3) **Fixed bugs:** -- Don't monkey-patch the JSON module [\#456](https://github.com/solarkennedy/puppet-consul/pull/456) ([joshuaspence](https://github.com/joshuaspence)) +- Don't monkey-patch the JSON module [\#456](https://github.com/voxpupuli/puppet-consul/pull/456) ([joshuaspence](https://github.com/joshuaspence)) **Closed issues:** -- Systemd fails to start Consul [\#455](https://github.com/solarkennedy/puppet-consul/issues/455) -- Broken JSON module [\#452](https://github.com/solarkennedy/puppet-consul/issues/452) +- Systemd fails to start Consul [\#455](https://github.com/voxpupuli/puppet-consul/issues/455) +- Broken JSON module [\#452](https://github.com/voxpupuli/puppet-consul/issues/452) **Merged pull requests:** -- release 5.0.2 [\#457](https://github.com/solarkennedy/puppet-consul/pull/457) ([bastelfreak](https://github.com/bastelfreak)) +- release 5.0.2 [\#457](https://github.com/voxpupuli/puppet-consul/pull/457) ([bastelfreak](https://github.com/bastelfreak)) -## [v5.0.1](https://github.com/solarkennedy/puppet-consul/tree/v5.0.1) (2018-10-31) +## [v5.0.1](https://github.com/voxpupuli/puppet-consul/tree/v5.0.1) (2018-10-31) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v4.0.0...v5.0.1) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v4.0.0...v5.0.1) **Breaking changes:** -- Puppet 6 support [\#444](https://github.com/solarkennedy/puppet-consul/pull/444) ([l-lotz](https://github.com/l-lotz)) -- bump default consul version from 0.7.4 to 1.2.3 [\#443](https://github.com/solarkennedy/puppet-consul/pull/443) ([bastelfreak](https://github.com/bastelfreak)) +- Puppet 6 support [\#444](https://github.com/voxpupuli/puppet-consul/pull/444) ([l-lotz](https://github.com/l-lotz)) +- bump default consul version from 0.7.4 to 1.2.3 [\#443](https://github.com/voxpupuli/puppet-consul/pull/443) ([bastelfreak](https://github.com/bastelfreak)) **Fixed bugs:** -- undefined method `validate_checks` on puppet 5.5.7/6.0.3 [\#448](https://github.com/solarkennedy/puppet-consul/issues/448) -- Wrong init provider on Ubuntu 14.04 [\#438](https://github.com/solarkennedy/puppet-consul/issues/438) -- Change "enableTagOverride" to "enable\_tag\_override" in version 1.0.0 and … [\#447](https://github.com/solarkennedy/puppet-consul/pull/447) ([wenzhengjiang](https://github.com/wenzhengjiang)) +- undefined method `validate_checks` on puppet 5.5.7/6.0.3 [\#448](https://github.com/voxpupuli/puppet-consul/issues/448) +- Wrong init provider on Ubuntu 14.04 [\#438](https://github.com/voxpupuli/puppet-consul/issues/438) +- Change "enableTagOverride" to "enable\_tag\_override" in version 1.0.0 and … [\#447](https://github.com/voxpupuli/puppet-consul/pull/447) ([wenzhengjiang](https://github.com/wenzhengjiang)) **Closed issues:** -- Version 4.0.0 is missing in git [\#445](https://github.com/solarkennedy/puppet-consul/issues/445) -- Wrong dependencies in Puppet Forge [\#442](https://github.com/solarkennedy/puppet-consul/issues/442) +- Version 4.0.0 is missing in git [\#445](https://github.com/voxpupuli/puppet-consul/issues/445) +- Wrong dependencies in Puppet Forge [\#442](https://github.com/voxpupuli/puppet-consul/issues/442) **Merged pull requests:** -- release 5.0.0 [\#449](https://github.com/solarkennedy/puppet-consul/pull/449) ([bastelfreak](https://github.com/bastelfreak)) +- release 5.0.0 [\#449](https://github.com/voxpupuli/puppet-consul/pull/449) ([bastelfreak](https://github.com/bastelfreak)) -## [v4.0.0](https://github.com/solarkennedy/puppet-consul/tree/v4.0.0) (2018-10-05) +## [v4.0.0](https://github.com/voxpupuli/puppet-consul/tree/v4.0.0) (2018-10-05) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v3.4.2...v4.0.0) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v3.4.2...v4.0.0) -## [v3.4.2](https://github.com/solarkennedy/puppet-consul/tree/v3.4.2) (2018-10-03) +## [v3.4.2](https://github.com/voxpupuli/puppet-consul/tree/v3.4.2) (2018-10-03) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v3.4.1...v3.4.2) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v3.4.1...v3.4.2) -## [v3.4.1](https://github.com/solarkennedy/puppet-consul/tree/v3.4.1) (2018-10-03) +## [v3.4.1](https://github.com/voxpupuli/puppet-consul/tree/v3.4.1) (2018-10-03) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v3.4.0...v3.4.1) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v3.4.0...v3.4.1) **Closed issues:** -- Consul version upgrade to 1.2.0 [\#433](https://github.com/solarkennedy/puppet-consul/issues/433) -- Telemetry [\#431](https://github.com/solarkennedy/puppet-consul/issues/431) -- Release version 3.3.1 [\#428](https://github.com/solarkennedy/puppet-consul/issues/428) +- Consul version upgrade to 1.2.0 [\#433](https://github.com/voxpupuli/puppet-consul/issues/433) +- Telemetry [\#431](https://github.com/voxpupuli/puppet-consul/issues/431) +- Release version 3.3.1 [\#428](https://github.com/voxpupuli/puppet-consul/issues/428) **Merged pull requests:** -- Allow puppetlabs-stdlib v5.x [\#440](https://github.com/solarkennedy/puppet-consul/pull/440) ([hfm](https://github.com/hfm)) -- allow camptocamp/systemd 2.x [\#439](https://github.com/solarkennedy/puppet-consul/pull/439) ([l-lotz](https://github.com/l-lotz)) -- Fix broken testmatrix due to gem updates [\#437](https://github.com/solarkennedy/puppet-consul/pull/437) ([bastelfreak](https://github.com/bastelfreak)) -- Update Readme.md to Include Telemetry Settings [\#432](https://github.com/solarkennedy/puppet-consul/pull/432) ([ghost](https://github.com/ghost)) +- Allow puppetlabs-stdlib v5.x [\#440](https://github.com/voxpupuli/puppet-consul/pull/440) ([hfm](https://github.com/hfm)) +- allow camptocamp/systemd 2.x [\#439](https://github.com/voxpupuli/puppet-consul/pull/439) ([l-lotz](https://github.com/l-lotz)) +- Fix broken testmatrix due to gem updates [\#437](https://github.com/voxpupuli/puppet-consul/pull/437) ([bastelfreak](https://github.com/bastelfreak)) +- Update Readme.md to Include Telemetry Settings [\#432](https://github.com/voxpupuli/puppet-consul/pull/432) ([ghost](https://github.com/ghost)) -## [v3.4.0](https://github.com/solarkennedy/puppet-consul/tree/v3.4.0) (2018-07-05) +## [v3.4.0](https://github.com/voxpupuli/puppet-consul/tree/v3.4.0) (2018-07-05) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v3.3.1...v3.4.0) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v3.3.1...v3.4.0) **Implemented enhancements:** -- Add tests for raft\_multiplier [\#429](https://github.com/solarkennedy/puppet-consul/pull/429) ([bastelfreak](https://github.com/bastelfreak)) -- allow management of CAP\_NET\_BIND\_SERVICE via systemd [\#427](https://github.com/solarkennedy/puppet-consul/pull/427) ([bastelfreak](https://github.com/bastelfreak)) -- add support for the beta UI [\#417](https://github.com/solarkennedy/puppet-consul/pull/417) ([bastelfreak](https://github.com/bastelfreak)) -- Add AArch64 \(arm64\) support [\#409](https://github.com/solarkennedy/puppet-consul/pull/409) ([ajungren](https://github.com/ajungren)) -- Add new parameters to configure consul permissions in the binary [\#408](https://github.com/solarkennedy/puppet-consul/pull/408) ([cristianjuve](https://github.com/cristianjuve)) -- Support space-separated list in addresses [\#406](https://github.com/solarkennedy/puppet-consul/pull/406) ([sw0x2A](https://github.com/sw0x2A)) -- Add `args` parameter to `consul::watch` [\#404](https://github.com/solarkennedy/puppet-consul/pull/404) ([scottybrisbane](https://github.com/scottybrisbane)) +- Add tests for raft\_multiplier [\#429](https://github.com/voxpupuli/puppet-consul/pull/429) ([bastelfreak](https://github.com/bastelfreak)) +- allow management of CAP\_NET\_BIND\_SERVICE via systemd [\#427](https://github.com/voxpupuli/puppet-consul/pull/427) ([bastelfreak](https://github.com/bastelfreak)) +- add support for the beta UI [\#417](https://github.com/voxpupuli/puppet-consul/pull/417) ([bastelfreak](https://github.com/bastelfreak)) +- Add AArch64 \(arm64\) support [\#409](https://github.com/voxpupuli/puppet-consul/pull/409) ([ajungren](https://github.com/ajungren)) +- Add new parameters to configure consul permissions in the binary [\#408](https://github.com/voxpupuli/puppet-consul/pull/408) ([cristianjuve](https://github.com/cristianjuve)) +- Support space-separated list in addresses [\#406](https://github.com/voxpupuli/puppet-consul/pull/406) ([sw0x2A](https://github.com/sw0x2A)) +- Add `args` parameter to `consul::watch` [\#404](https://github.com/voxpupuli/puppet-consul/pull/404) ([scottybrisbane](https://github.com/scottybrisbane)) **Fixed bugs:** -- protocol should be a param not property. [\#329](https://github.com/solarkennedy/puppet-consul/pull/329) ([chris-bmj](https://github.com/chris-bmj)) +- protocol should be a param not property. [\#329](https://github.com/voxpupuli/puppet-consul/pull/329) ([chris-bmj](https://github.com/chris-bmj)) **Closed issues:** -- Performance Raft Multiplier [\#426](https://github.com/solarkennedy/puppet-consul/issues/426) -- Consul 1.1.0 uses a new key for enableTagOverride [\#420](https://github.com/solarkennedy/puppet-consul/issues/420) -- Allow for different consul and consul-ui versions. [\#384](https://github.com/solarkennedy/puppet-consul/issues/384) -- uid/gid [\#353](https://github.com/solarkennedy/puppet-consul/issues/353) -- Run configtest before reloading service [\#338](https://github.com/solarkennedy/puppet-consul/issues/338) -- New prepared queries provider not accepting integers [\#291](https://github.com/solarkennedy/puppet-consul/issues/291) -- Consul binary not found when puppet agent is daemonized [\#290](https://github.com/solarkennedy/puppet-consul/issues/290) -- systemd Client Nodes Not Properly Leaving Cluster on Shutdown [\#282](https://github.com/solarkennedy/puppet-consul/issues/282) -- Add Support for Windows [\#195](https://github.com/solarkennedy/puppet-consul/issues/195) +- Performance Raft Multiplier [\#426](https://github.com/voxpupuli/puppet-consul/issues/426) +- Consul 1.1.0 uses a new key for enableTagOverride [\#420](https://github.com/voxpupuli/puppet-consul/issues/420) +- Allow for different consul and consul-ui versions. [\#384](https://github.com/voxpupuli/puppet-consul/issues/384) +- uid/gid [\#353](https://github.com/voxpupuli/puppet-consul/issues/353) +- Run configtest before reloading service [\#338](https://github.com/voxpupuli/puppet-consul/issues/338) +- New prepared queries provider not accepting integers [\#291](https://github.com/voxpupuli/puppet-consul/issues/291) +- Consul binary not found when puppet agent is daemonized [\#290](https://github.com/voxpupuli/puppet-consul/issues/290) +- systemd Client Nodes Not Properly Leaving Cluster on Shutdown [\#282](https://github.com/voxpupuli/puppet-consul/issues/282) +- Add Support for Windows [\#195](https://github.com/voxpupuli/puppet-consul/issues/195) **Merged pull requests:** -- Release 3.4.0 [\#430](https://github.com/solarkennedy/puppet-consul/pull/430) ([bastelfreak](https://github.com/bastelfreak)) -- Add CentOS 6/7 acceptance tests [\#425](https://github.com/solarkennedy/puppet-consul/pull/425) ([bastelfreak](https://github.com/bastelfreak)) -- Add Ubuntu 18.04 / 16.04 support [\#424](https://github.com/solarkennedy/puppet-consul/pull/424) ([bastelfreak](https://github.com/bastelfreak)) -- Bump archive dependency to allow 3.X releases [\#423](https://github.com/solarkennedy/puppet-consul/pull/423) ([bastelfreak](https://github.com/bastelfreak)) -- Use $consul::version instead of facter consul\_version \(Fix 09297fa\) [\#419](https://github.com/solarkennedy/puppet-consul/pull/419) ([hfm](https://github.com/hfm)) -- Change enableTagOverride to enable\_tag\_override in Consul 1.1.0 and later [\#418](https://github.com/solarkennedy/puppet-consul/pull/418) ([hfm](https://github.com/hfm)) -- enable acceptance tests on travis [\#416](https://github.com/solarkennedy/puppet-consul/pull/416) ([bastelfreak](https://github.com/bastelfreak)) +- Release 3.4.0 [\#430](https://github.com/voxpupuli/puppet-consul/pull/430) ([bastelfreak](https://github.com/bastelfreak)) +- Add CentOS 6/7 acceptance tests [\#425](https://github.com/voxpupuli/puppet-consul/pull/425) ([bastelfreak](https://github.com/bastelfreak)) +- Add Ubuntu 18.04 / 16.04 support [\#424](https://github.com/voxpupuli/puppet-consul/pull/424) ([bastelfreak](https://github.com/bastelfreak)) +- Bump archive dependency to allow 3.X releases [\#423](https://github.com/voxpupuli/puppet-consul/pull/423) ([bastelfreak](https://github.com/bastelfreak)) +- Use $consul::version instead of facter consul\_version \(Fix 09297fa\) [\#419](https://github.com/voxpupuli/puppet-consul/pull/419) ([hfm](https://github.com/hfm)) +- Change enableTagOverride to enable\_tag\_override in Consul 1.1.0 and later [\#418](https://github.com/voxpupuli/puppet-consul/pull/418) ([hfm](https://github.com/hfm)) +- enable acceptance tests on travis [\#416](https://github.com/voxpupuli/puppet-consul/pull/416) ([bastelfreak](https://github.com/bastelfreak)) -## [v3.3.1](https://github.com/solarkennedy/puppet-consul/tree/v3.3.1) (2018-01-27) +## [v3.3.1](https://github.com/voxpupuli/puppet-consul/tree/v3.3.1) (2018-01-27) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v3.2.4...v3.3.1) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v3.2.4...v3.3.1) **Closed issues:** -- module errors on posix systems without unzip [\#402](https://github.com/solarkennedy/puppet-consul/issues/402) -- Support for Amazon 2 OS [\#396](https://github.com/solarkennedy/puppet-consul/issues/396) -- Latest version doesn't work with Puppet 3.x \(breaking change?\) [\#394](https://github.com/solarkennedy/puppet-consul/issues/394) -- Changing Consul kv values doesn't seem to have an effect [\#374](https://github.com/solarkennedy/puppet-consul/issues/374) -- Clean out fixtures prior to uploading to forge [\#349](https://github.com/solarkennedy/puppet-consul/issues/349) +- module errors on posix systems without unzip [\#402](https://github.com/voxpupuli/puppet-consul/issues/402) +- Support for Amazon 2 OS [\#396](https://github.com/voxpupuli/puppet-consul/issues/396) +- Latest version doesn't work with Puppet 3.x \(breaking change?\) [\#394](https://github.com/voxpupuli/puppet-consul/issues/394) +- Changing Consul kv values doesn't seem to have an effect [\#374](https://github.com/voxpupuli/puppet-consul/issues/374) +- Clean out fixtures prior to uploading to forge [\#349](https://github.com/voxpupuli/puppet-consul/issues/349) **Merged pull requests:** -- Added experimental Windows support [\#403](https://github.com/solarkennedy/puppet-consul/pull/403) ([iwagnerclgx](https://github.com/iwagnerclgx)) -- Removed command substitution in init script [\#401](https://github.com/solarkennedy/puppet-consul/pull/401) ([tooooots](https://github.com/tooooots)) -- Add `args` parameter to `consul::check` [\#400](https://github.com/solarkennedy/puppet-consul/pull/400) ([joshuaspence](https://github.com/joshuaspence)) -- Added the ui parameter and removed ui\_\* ones [\#398](https://github.com/solarkennedy/puppet-consul/pull/398) ([rawleto](https://github.com/rawleto)) -- support Amazon Linux 2 [\#397](https://github.com/solarkennedy/puppet-consul/pull/397) ([vchan2002](https://github.com/vchan2002)) +- Added experimental Windows support [\#403](https://github.com/voxpupuli/puppet-consul/pull/403) ([iwagnerclgx](https://github.com/iwagnerclgx)) +- Removed command substitution in init script [\#401](https://github.com/voxpupuli/puppet-consul/pull/401) ([tooooots](https://github.com/tooooots)) +- Add `args` parameter to `consul::check` [\#400](https://github.com/voxpupuli/puppet-consul/pull/400) ([joshuaspence](https://github.com/joshuaspence)) +- Added the ui parameter and removed ui\_\* ones [\#398](https://github.com/voxpupuli/puppet-consul/pull/398) ([rawleto](https://github.com/rawleto)) +- support Amazon Linux 2 [\#397](https://github.com/voxpupuli/puppet-consul/pull/397) ([vchan2002](https://github.com/vchan2002)) -## [v3.2.4](https://github.com/solarkennedy/puppet-consul/tree/v3.2.4) (2017-12-05) +## [v3.2.4](https://github.com/voxpupuli/puppet-consul/tree/v3.2.4) (2017-12-05) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v3.2.3...v3.2.4) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v3.2.3...v3.2.4) **Merged pull requests:** -- set correct namespace for systemd dependency [\#393](https://github.com/solarkennedy/puppet-consul/pull/393) ([bastelfreak](https://github.com/bastelfreak)) +- set correct namespace for systemd dependency [\#393](https://github.com/voxpupuli/puppet-consul/pull/393) ([bastelfreak](https://github.com/bastelfreak)) -## [v3.2.3](https://github.com/solarkennedy/puppet-consul/tree/v3.2.3) (2017-12-05) +## [v3.2.3](https://github.com/voxpupuli/puppet-consul/tree/v3.2.3) (2017-12-05) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v3.2.2...v3.2.3) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v3.2.2...v3.2.3) -## [v3.2.2](https://github.com/solarkennedy/puppet-consul/tree/v3.2.2) (2017-12-05) +## [v3.2.2](https://github.com/voxpupuli/puppet-consul/tree/v3.2.2) (2017-12-05) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v3.2.0...v3.2.2) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v3.2.0...v3.2.2) **Closed issues:** -- consul\_sorted\_json for octal notation of file modes [\#389](https://github.com/solarkennedy/puppet-consul/issues/389) -- Add hiera wrapper for ACL entries. [\#385](https://github.com/solarkennedy/puppet-consul/issues/385) -- Config validation failed [\#383](https://github.com/solarkennedy/puppet-consul/issues/383) -- default config\_dir broken on FreeBSD [\#360](https://github.com/solarkennedy/puppet-consul/issues/360) -- Consul 0.8.0 is out! and it breaks a few things... [\#331](https://github.com/solarkennedy/puppet-consul/issues/331) +- consul\_sorted\_json for octal notation of file modes [\#389](https://github.com/voxpupuli/puppet-consul/issues/389) +- Add hiera wrapper for ACL entries. [\#385](https://github.com/voxpupuli/puppet-consul/issues/385) +- Config validation failed [\#383](https://github.com/voxpupuli/puppet-consul/issues/383) +- default config\_dir broken on FreeBSD [\#360](https://github.com/voxpupuli/puppet-consul/issues/360) +- Consul 0.8.0 is out! and it breaks a few things... [\#331](https://github.com/voxpupuli/puppet-consul/issues/331) **Merged pull requests:** -- simplify systemd setup by using camptocamp/systemd [\#392](https://github.com/solarkennedy/puppet-consul/pull/392) ([bastelfreak](https://github.com/bastelfreak)) -- Do not unquote integers with a leading zero [\#391](https://github.com/solarkennedy/puppet-consul/pull/391) ([phaer](https://github.com/phaer)) -- replace fedora versions with current supported ones [\#390](https://github.com/solarkennedy/puppet-consul/pull/390) ([bastelfreak](https://github.com/bastelfreak)) -- set sane default shell for consul user [\#388](https://github.com/solarkennedy/puppet-consul/pull/388) ([bastelfreak](https://github.com/bastelfreak)) -- fix typo in check timeout [\#387](https://github.com/solarkennedy/puppet-consul/pull/387) ([lobeck](https://github.com/lobeck)) -- Fixes \#360 by setting config\_dir under FreeBSD [\#386](https://github.com/solarkennedy/puppet-consul/pull/386) ([madelaney](https://github.com/madelaney)) -- allow "args" and "script" for consul check config [\#382](https://github.com/solarkennedy/puppet-consul/pull/382) ([zg](https://github.com/zg)) -- Breaking: Update Puppet version to 4.7.1 and add data types [\#381](https://github.com/solarkennedy/puppet-consul/pull/381) ([wyardley](https://github.com/wyardley)) -- Handle consul\_acl connection refused as a retry-able error [\#336](https://github.com/solarkennedy/puppet-consul/pull/336) ([kpaulisse](https://github.com/kpaulisse)) +- simplify systemd setup by using camptocamp/systemd [\#392](https://github.com/voxpupuli/puppet-consul/pull/392) ([bastelfreak](https://github.com/bastelfreak)) +- Do not unquote integers with a leading zero [\#391](https://github.com/voxpupuli/puppet-consul/pull/391) ([phaer](https://github.com/phaer)) +- replace fedora versions with current supported ones [\#390](https://github.com/voxpupuli/puppet-consul/pull/390) ([bastelfreak](https://github.com/bastelfreak)) +- set sane default shell for consul user [\#388](https://github.com/voxpupuli/puppet-consul/pull/388) ([bastelfreak](https://github.com/bastelfreak)) +- fix typo in check timeout [\#387](https://github.com/voxpupuli/puppet-consul/pull/387) ([lobeck](https://github.com/lobeck)) +- Fixes \#360 by setting config\_dir under FreeBSD [\#386](https://github.com/voxpupuli/puppet-consul/pull/386) ([madelaney](https://github.com/madelaney)) +- allow "args" and "script" for consul check config [\#382](https://github.com/voxpupuli/puppet-consul/pull/382) ([zg](https://github.com/zg)) +- Breaking: Update Puppet version to 4.7.1 and add data types [\#381](https://github.com/voxpupuli/puppet-consul/pull/381) ([wyardley](https://github.com/wyardley)) +- Handle consul\_acl connection refused as a retry-able error [\#336](https://github.com/voxpupuli/puppet-consul/pull/336) ([kpaulisse](https://github.com/kpaulisse)) -## [v3.2.0](https://github.com/solarkennedy/puppet-consul/tree/v3.2.0) (2017-11-20) +## [v3.2.0](https://github.com/voxpupuli/puppet-consul/tree/v3.2.0) (2017-11-20) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v3.1.2...v3.2.0) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v3.1.2...v3.2.0) **Closed issues:** -- Validate command for config files doesn't work [\#376](https://github.com/solarkennedy/puppet-consul/issues/376) +- Validate command for config files doesn't work [\#376](https://github.com/voxpupuli/puppet-consul/issues/376) **Merged pull requests:** -- Removing the consul config check [\#380](https://github.com/solarkennedy/puppet-consul/pull/380) ([Faffnir](https://github.com/Faffnir)) -- \[issue/376\] [\#379](https://github.com/solarkennedy/puppet-consul/pull/379) ([khdevel](https://github.com/khdevel)) -- Fix updating of Consul KV store [\#378](https://github.com/solarkennedy/puppet-consul/pull/378) ([dannytrigo](https://github.com/dannytrigo)) -- Fix validate command for config files in consul 1.0.0 [\#377](https://github.com/solarkennedy/puppet-consul/pull/377) ([Faffnir](https://github.com/Faffnir)) +- Removing the consul config check [\#380](https://github.com/voxpupuli/puppet-consul/pull/380) ([Faffnir](https://github.com/Faffnir)) +- \[issue/376\] [\#379](https://github.com/voxpupuli/puppet-consul/pull/379) ([khdevel](https://github.com/khdevel)) +- Fix updating of Consul KV store [\#378](https://github.com/voxpupuli/puppet-consul/pull/378) ([dannytrigo](https://github.com/dannytrigo)) +- Fix validate command for config files in consul 1.0.0 [\#377](https://github.com/voxpupuli/puppet-consul/pull/377) ([Faffnir](https://github.com/Faffnir)) -## [v3.1.2](https://github.com/solarkennedy/puppet-consul/tree/v3.1.2) (2017-10-26) +## [v3.1.2](https://github.com/voxpupuli/puppet-consul/tree/v3.1.2) (2017-10-26) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v3.1.1...v3.1.2) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v3.1.1...v3.1.2) -## [v3.1.1](https://github.com/solarkennedy/puppet-consul/tree/v3.1.1) (2017-10-24) +## [v3.1.1](https://github.com/voxpupuli/puppet-consul/tree/v3.1.1) (2017-10-24) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v3.0.0...v3.1.1) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v3.0.0...v3.1.1) **Closed issues:** -- what ACL rights required for consul\_acl part to run? [\#373](https://github.com/solarkennedy/puppet-consul/issues/373) -- Consul k/v does not update to new value [\#363](https://github.com/solarkennedy/puppet-consul/issues/363) -- How do you ensure unzip is installed? [\#356](https://github.com/solarkennedy/puppet-consul/issues/356) -- changes to systemd template [\#354](https://github.com/solarkennedy/puppet-consul/issues/354) -- Support for cloud -join switches [\#350](https://github.com/solarkennedy/puppet-consul/issues/350) -- Switch from `%{linenumber}` to `%{line}` in v2 branch [\#346](https://github.com/solarkennedy/puppet-consul/issues/346) -- 3.0.0 not tagged? [\#343](https://github.com/solarkennedy/puppet-consul/issues/343) +- what ACL rights required for consul\_acl part to run? [\#373](https://github.com/voxpupuli/puppet-consul/issues/373) +- Consul k/v does not update to new value [\#363](https://github.com/voxpupuli/puppet-consul/issues/363) +- How do you ensure unzip is installed? [\#356](https://github.com/voxpupuli/puppet-consul/issues/356) +- changes to systemd template [\#354](https://github.com/voxpupuli/puppet-consul/issues/354) +- Support for cloud -join switches [\#350](https://github.com/voxpupuli/puppet-consul/issues/350) +- Switch from `%{linenumber}` to `%{line}` in v2 branch [\#346](https://github.com/voxpupuli/puppet-consul/issues/346) +- 3.0.0 not tagged? [\#343](https://github.com/voxpupuli/puppet-consul/issues/343) **Merged pull requests:** -- Validate config file before deploying [\#372](https://github.com/solarkennedy/puppet-consul/pull/372) ([kasimon](https://github.com/kasimon)) -- use proper systemd custom .service directory [\#366](https://github.com/solarkennedy/puppet-consul/pull/366) ([foxxx0](https://github.com/foxxx0)) -- \(\#359\) Datacenter support to consul\_key\_value [\#365](https://github.com/solarkennedy/puppet-consul/pull/365) ([houtmanj](https://github.com/houtmanj)) -- Don't pin so hard on ruby versions on travis [\#362](https://github.com/solarkennedy/puppet-consul/pull/362) ([solarkennedy](https://github.com/solarkennedy)) -- Fix issue with init script [\#361](https://github.com/solarkennedy/puppet-consul/pull/361) ([brandonrdn](https://github.com/brandonrdn)) -- added docker support [\#357](https://github.com/solarkennedy/puppet-consul/pull/357) ([Justin-DynamicD](https://github.com/Justin-DynamicD)) -- allow to specify a proxy server for package downloads [\#351](https://github.com/solarkennedy/puppet-consul/pull/351) ([xavvo](https://github.com/xavvo)) -- Support "Near" parameter in prepared queries [\#348](https://github.com/solarkennedy/puppet-consul/pull/348) ([tlevi](https://github.com/tlevi)) -- support other unspecified RedHat variants [\#341](https://github.com/solarkennedy/puppet-consul/pull/341) ([cspargo](https://github.com/cspargo)) -- Notify the service when package is updated [\#340](https://github.com/solarkennedy/puppet-consul/pull/340) ([jaxxstorm](https://github.com/jaxxstorm)) -- Test changes for property [\#334](https://github.com/solarkennedy/puppet-consul/pull/334) ([jk2l](https://github.com/jk2l)) -- Ensure /usr/local/bin is in the path for consul binary [\#313](https://github.com/solarkennedy/puppet-consul/pull/313) ([mspaulding06](https://github.com/mspaulding06)) +- Validate config file before deploying [\#372](https://github.com/voxpupuli/puppet-consul/pull/372) ([kasimon](https://github.com/kasimon)) +- use proper systemd custom .service directory [\#366](https://github.com/voxpupuli/puppet-consul/pull/366) ([foxxx0](https://github.com/foxxx0)) +- \(\#359\) Datacenter support to consul\_key\_value [\#365](https://github.com/voxpupuli/puppet-consul/pull/365) ([houtmanj](https://github.com/houtmanj)) +- Don't pin so hard on ruby versions on travis [\#362](https://github.com/voxpupuli/puppet-consul/pull/362) ([solarkennedy](https://github.com/solarkennedy)) +- Fix issue with init script [\#361](https://github.com/voxpupuli/puppet-consul/pull/361) ([brandonrdn](https://github.com/brandonrdn)) +- added docker support [\#357](https://github.com/voxpupuli/puppet-consul/pull/357) ([Justin-DynamicD](https://github.com/Justin-DynamicD)) +- allow to specify a proxy server for package downloads [\#351](https://github.com/voxpupuli/puppet-consul/pull/351) ([xavvo](https://github.com/xavvo)) +- Support "Near" parameter in prepared queries [\#348](https://github.com/voxpupuli/puppet-consul/pull/348) ([tlevi](https://github.com/tlevi)) +- support other unspecified RedHat variants [\#341](https://github.com/voxpupuli/puppet-consul/pull/341) ([cspargo](https://github.com/cspargo)) +- Notify the service when package is updated [\#340](https://github.com/voxpupuli/puppet-consul/pull/340) ([jaxxstorm](https://github.com/jaxxstorm)) +- Test changes for property [\#334](https://github.com/voxpupuli/puppet-consul/pull/334) ([jk2l](https://github.com/jk2l)) +- Ensure /usr/local/bin is in the path for consul binary [\#313](https://github.com/voxpupuli/puppet-consul/pull/313) ([mspaulding06](https://github.com/mspaulding06)) -## [v3.0.0](https://github.com/solarkennedy/puppet-consul/tree/v3.0.0) (2017-04-19) +## [v3.0.0](https://github.com/voxpupuli/puppet-consul/tree/v3.0.0) (2017-04-19) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v2.1.1...v3.0.0) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v2.1.1...v3.0.0) **Closed issues:** -- Execution of 'unzip -o /var/lib/consul/archives/consul-0.7.4.zip' returned 1: [\#332](https://github.com/solarkennedy/puppet-consul/issues/332) -- please specify json module version minimum [\#328](https://github.com/solarkennedy/puppet-consul/issues/328) -- Could not look up qualified variable '$::consul\_version' [\#327](https://github.com/solarkennedy/puppet-consul/issues/327) +- Execution of 'unzip -o /var/lib/consul/archives/consul-0.7.4.zip' returned 1: [\#332](https://github.com/voxpupuli/puppet-consul/issues/332) +- please specify json module version minimum [\#328](https://github.com/voxpupuli/puppet-consul/issues/328) +- Could not look up qualified variable '$::consul\_version' [\#327](https://github.com/voxpupuli/puppet-consul/issues/327) **Merged pull requests:** -- BREAKING - Consul 0.8.0 fixes [\#337](https://github.com/solarkennedy/puppet-consul/pull/337) ([lobeck](https://github.com/lobeck)) +- BREAKING - Consul 0.8.0 fixes [\#337](https://github.com/voxpupuli/puppet-consul/pull/337) ([lobeck](https://github.com/lobeck)) -## [v2.1.1](https://github.com/solarkennedy/puppet-consul/tree/v2.1.1) (2017-03-16) +## [v2.1.1](https://github.com/voxpupuli/puppet-consul/tree/v2.1.1) (2017-03-16) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v2.1.0...v2.1.1) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v2.1.0...v2.1.1) **Closed issues:** -- Curl return code 35 when fetching the consul binary. [\#320](https://github.com/solarkennedy/puppet-consul/issues/320) -- Consul - Error: Invalid parameter temp\_dir\(:temp\_dir\) [\#317](https://github.com/solarkennedy/puppet-consul/issues/317) -- Error: Cannot create /opt/consul/archives; parent directory /opt/consul does not exist [\#311](https://github.com/solarkennedy/puppet-consul/issues/311) -- consul\_acl created on every puppet run [\#211](https://github.com/solarkennedy/puppet-consul/issues/211) +- Curl return code 35 when fetching the consul binary. [\#320](https://github.com/voxpupuli/puppet-consul/issues/320) +- Consul - Error: Invalid parameter temp\_dir\(:temp\_dir\) [\#317](https://github.com/voxpupuli/puppet-consul/issues/317) +- Error: Cannot create /opt/consul/archives; parent directory /opt/consul does not exist [\#311](https://github.com/voxpupuli/puppet-consul/issues/311) +- consul\_acl created on every puppet run [\#211](https://github.com/voxpupuli/puppet-consul/issues/211) **Merged pull requests:** -- Try pinning more things in fixtures [\#326](https://github.com/solarkennedy/puppet-consul/pull/326) ([solarkennedy](https://github.com/solarkennedy)) -- Remove unnecessary .gitkeep files in lib/ [\#325](https://github.com/solarkennedy/puppet-consul/pull/325) ([cosmopetrich](https://github.com/cosmopetrich)) -- Fix idempotent issue within key\_value runs. [\#323](https://github.com/solarkennedy/puppet-consul/pull/323) ([jrasell](https://github.com/jrasell)) -- Reduce travis matrix [\#322](https://github.com/solarkennedy/puppet-consul/pull/322) ([solarkennedy](https://github.com/solarkennedy)) -- Bump default consul version. Improve FreeBSD support [\#319](https://github.com/solarkennedy/puppet-consul/pull/319) ([olevole](https://github.com/olevole)) -- fix ::consul\_version fact lookup during installation [\#316](https://github.com/solarkennedy/puppet-consul/pull/316) ([wstiern](https://github.com/wstiern)) +- Try pinning more things in fixtures [\#326](https://github.com/voxpupuli/puppet-consul/pull/326) ([solarkennedy](https://github.com/solarkennedy)) +- Remove unnecessary .gitkeep files in lib/ [\#325](https://github.com/voxpupuli/puppet-consul/pull/325) ([cosmopetrich](https://github.com/cosmopetrich)) +- Fix idempotent issue within key\_value runs. [\#323](https://github.com/voxpupuli/puppet-consul/pull/323) ([jrasell](https://github.com/jrasell)) +- Reduce travis matrix [\#322](https://github.com/voxpupuli/puppet-consul/pull/322) ([solarkennedy](https://github.com/solarkennedy)) +- Bump default consul version. Improve FreeBSD support [\#319](https://github.com/voxpupuli/puppet-consul/pull/319) ([olevole](https://github.com/olevole)) +- fix ::consul\_version fact lookup during installation [\#316](https://github.com/voxpupuli/puppet-consul/pull/316) ([wstiern](https://github.com/wstiern)) -## [v2.1.0](https://github.com/solarkennedy/puppet-consul/tree/v2.1.0) (2017-01-12) +## [v2.1.0](https://github.com/voxpupuli/puppet-consul/tree/v2.1.0) (2017-01-12) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v2.0.0...v2.1.0) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v2.0.0...v2.1.0) **Closed issues:** -- Annoying "defined 'protocol' as 'http' " for every consul\_acl resource [\#310](https://github.com/solarkennedy/puppet-consul/issues/310) -- Issues with default data-dir post-\#292 [\#307](https://github.com/solarkennedy/puppet-consul/issues/307) +- Annoying "defined 'protocol' as 'http' " for every consul\_acl resource [\#310](https://github.com/voxpupuli/puppet-consul/issues/310) +- Issues with default data-dir post-\#292 [\#307](https://github.com/voxpupuli/puppet-consul/issues/307) **Merged pull requests:** -- Actually fix the changes every run problem [\#315](https://github.com/solarkennedy/puppet-consul/pull/315) ([mrwulf](https://github.com/mrwulf)) -- Changes every run [\#312](https://github.com/solarkennedy/puppet-consul/pull/312) ([mrwulf](https://github.com/mrwulf)) -- Better acl rules message [\#309](https://github.com/solarkennedy/puppet-consul/pull/309) ([mrwulf](https://github.com/mrwulf)) -- Use data\_dir as a the root of the archive path. Fixes \#307 [\#308](https://github.com/solarkennedy/puppet-consul/pull/308) ([solarkennedy](https://github.com/solarkennedy)) +- Actually fix the changes every run problem [\#315](https://github.com/voxpupuli/puppet-consul/pull/315) ([mrwulf](https://github.com/mrwulf)) +- Changes every run [\#312](https://github.com/voxpupuli/puppet-consul/pull/312) ([mrwulf](https://github.com/mrwulf)) +- Better acl rules message [\#309](https://github.com/voxpupuli/puppet-consul/pull/309) ([mrwulf](https://github.com/mrwulf)) +- Use data\_dir as a the root of the archive path. Fixes \#307 [\#308](https://github.com/voxpupuli/puppet-consul/pull/308) ([solarkennedy](https://github.com/solarkennedy)) -## [v2.0.0](https://github.com/solarkennedy/puppet-consul/tree/v2.0.0) (2016-12-29) +## [v2.0.0](https://github.com/voxpupuli/puppet-consul/tree/v2.0.0) (2016-12-29) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v1.1.0...v2.0.0) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v1.1.0...v2.0.0) **Implemented enhancements:** -- Support for prepared queries [\#239](https://github.com/solarkennedy/puppet-consul/issues/239) +- Support for prepared queries [\#239](https://github.com/voxpupuli/puppet-consul/issues/239) **Closed issues:** -- cant use latest consul version as parameter [\#305](https://github.com/solarkennedy/puppet-consul/issues/305) -- EC2 Join Support [\#302](https://github.com/solarkennedy/puppet-consul/issues/302) -- Consul user is created with login shell [\#293](https://github.com/solarkennedy/puppet-consul/issues/293) -- Validate and document all params that could be passed to ::consul [\#170](https://github.com/solarkennedy/puppet-consul/issues/170) +- cant use latest consul version as parameter [\#305](https://github.com/voxpupuli/puppet-consul/issues/305) +- EC2 Join Support [\#302](https://github.com/voxpupuli/puppet-consul/issues/302) +- Consul user is created with login shell [\#293](https://github.com/voxpupuli/puppet-consul/issues/293) +- Validate and document all params that could be passed to ::consul [\#170](https://github.com/voxpupuli/puppet-consul/issues/170) **Merged pull requests:** -- Add support of custom log\_file in sles and upstart init scripts [\#306](https://github.com/solarkennedy/puppet-consul/pull/306) ([AlexLov](https://github.com/AlexLov)) -- More Systemd unit file improvements [\#304](https://github.com/solarkennedy/puppet-consul/pull/304) ([amiryal](https://github.com/amiryal)) -- Check $::consul\_version more correctly [\#303](https://github.com/solarkennedy/puppet-consul/pull/303) ([logic](https://github.com/logic)) -- Cleanup Systemd unit file [\#301](https://github.com/solarkennedy/puppet-consul/pull/301) ([amiryal](https://github.com/amiryal)) -- Fixing init service start/stop messages and locks [\#300](https://github.com/solarkennedy/puppet-consul/pull/300) ([mrwulf](https://github.com/mrwulf)) -- Initial support for FreeBSD platform [\#299](https://github.com/solarkennedy/puppet-consul/pull/299) ([olevole](https://github.com/olevole)) -- Revert "Set login shell for consul user to /sbin/nologin" [\#298](https://github.com/solarkennedy/puppet-consul/pull/298) ([solarkennedy](https://github.com/solarkennedy)) -- Set login shell for consul user to /sbin/nologin [\#297](https://github.com/solarkennedy/puppet-consul/pull/297) ([madAndroid](https://github.com/madAndroid)) -- add support for prepared query templates [\#296](https://github.com/solarkennedy/puppet-consul/pull/296) ([adamcstephens](https://github.com/adamcstephens)) -- KV Provider / Prepared Query Bugfixes [\#294](https://github.com/solarkennedy/puppet-consul/pull/294) ([djtaylor](https://github.com/djtaylor)) -- BREAKING: Change the default 'archive\_path' to '/opt/consul/archives'. [\#292](https://github.com/solarkennedy/puppet-consul/pull/292) ([jmkeyes](https://github.com/jmkeyes)) -- ADD parameter "log\_file" for custom log location [\#289](https://github.com/solarkennedy/puppet-consul/pull/289) ([miso231](https://github.com/miso231)) -- Prepared Queries [\#288](https://github.com/solarkennedy/puppet-consul/pull/288) ([djtaylor](https://github.com/djtaylor)) -- Catch :undef when pretty-printing in consul\_sorted\_json.rb [\#287](https://github.com/solarkennedy/puppet-consul/pull/287) ([tdevelioglu](https://github.com/tdevelioglu)) -- Reduce the travis matrix even more [\#286](https://github.com/solarkennedy/puppet-consul/pull/286) ([solarkennedy](https://github.com/solarkennedy)) -- Remove puppet error when ACLs cannot be retrieved [\#285](https://github.com/solarkennedy/puppet-consul/pull/285) ([thejandroman](https://github.com/thejandroman)) -- Drop pinning for 1.8.7 as there are no tests for it anymore. [\#281](https://github.com/solarkennedy/puppet-consul/pull/281) ([tdevelioglu](https://github.com/tdevelioglu)) +- Add support of custom log\_file in sles and upstart init scripts [\#306](https://github.com/voxpupuli/puppet-consul/pull/306) ([AlexLov](https://github.com/AlexLov)) +- More Systemd unit file improvements [\#304](https://github.com/voxpupuli/puppet-consul/pull/304) ([amiryal](https://github.com/amiryal)) +- Check $::consul\_version more correctly [\#303](https://github.com/voxpupuli/puppet-consul/pull/303) ([logic](https://github.com/logic)) +- Cleanup Systemd unit file [\#301](https://github.com/voxpupuli/puppet-consul/pull/301) ([amiryal](https://github.com/amiryal)) +- Fixing init service start/stop messages and locks [\#300](https://github.com/voxpupuli/puppet-consul/pull/300) ([mrwulf](https://github.com/mrwulf)) +- Initial support for FreeBSD platform [\#299](https://github.com/voxpupuli/puppet-consul/pull/299) ([olevole](https://github.com/olevole)) +- Revert "Set login shell for consul user to /sbin/nologin" [\#298](https://github.com/voxpupuli/puppet-consul/pull/298) ([solarkennedy](https://github.com/solarkennedy)) +- Set login shell for consul user to /sbin/nologin [\#297](https://github.com/voxpupuli/puppet-consul/pull/297) ([madAndroid](https://github.com/madAndroid)) +- add support for prepared query templates [\#296](https://github.com/voxpupuli/puppet-consul/pull/296) ([adamcstephens](https://github.com/adamcstephens)) +- KV Provider / Prepared Query Bugfixes [\#294](https://github.com/voxpupuli/puppet-consul/pull/294) ([djtaylor](https://github.com/djtaylor)) +- BREAKING: Change the default 'archive\_path' to '/opt/consul/archives'. [\#292](https://github.com/voxpupuli/puppet-consul/pull/292) ([jmkeyes](https://github.com/jmkeyes)) +- ADD parameter "log\_file" for custom log location [\#289](https://github.com/voxpupuli/puppet-consul/pull/289) ([miso231](https://github.com/miso231)) +- Prepared Queries [\#288](https://github.com/voxpupuli/puppet-consul/pull/288) ([djtaylor](https://github.com/djtaylor)) +- Catch :undef when pretty-printing in consul\_sorted\_json.rb [\#287](https://github.com/voxpupuli/puppet-consul/pull/287) ([tdevelioglu](https://github.com/tdevelioglu)) +- Reduce the travis matrix even more [\#286](https://github.com/voxpupuli/puppet-consul/pull/286) ([solarkennedy](https://github.com/solarkennedy)) +- Remove puppet error when ACLs cannot be retrieved [\#285](https://github.com/voxpupuli/puppet-consul/pull/285) ([thejandroman](https://github.com/thejandroman)) +- Drop pinning for 1.8.7 as there are no tests for it anymore. [\#281](https://github.com/voxpupuli/puppet-consul/pull/281) ([tdevelioglu](https://github.com/tdevelioglu)) -## [v1.1.0](https://github.com/solarkennedy/puppet-consul/tree/v1.1.0) (2016-09-23) +## [v1.1.0](https://github.com/voxpupuli/puppet-consul/tree/v1.1.0) (2016-09-23) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v1.0.12...v1.1.0) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v1.0.12...v1.1.0) **Merged pull requests:** -- Update downloaded version to latest stable \(0.7.0\) [\#280](https://github.com/solarkennedy/puppet-consul/pull/280) ([tdevelioglu](https://github.com/tdevelioglu)) +- Update downloaded version to latest stable \(0.7.0\) [\#280](https://github.com/voxpupuli/puppet-consul/pull/280) ([tdevelioglu](https://github.com/tdevelioglu)) -## [v1.0.12](https://github.com/solarkennedy/puppet-consul/tree/v1.0.12) (2016-09-23) +## [v1.0.12](https://github.com/voxpupuli/puppet-consul/tree/v1.0.12) (2016-09-23) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v1.0.10...v1.0.12) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v1.0.10...v1.0.12) **Closed issues:** -- Support for puppet-archive \>=1.0.0 [\#275](https://github.com/solarkennedy/puppet-consul/issues/275) -- Consul service is not starting up [\#273](https://github.com/solarkennedy/puppet-consul/issues/273) -- Question: URL method downloads the zip file every run? [\#270](https://github.com/solarkennedy/puppet-consul/issues/270) -- Add proxy support [\#269](https://github.com/solarkennedy/puppet-consul/issues/269) -- Changelog on Puppetforge not updated for 1.0.9 [\#268](https://github.com/solarkennedy/puppet-consul/issues/268) -- Support talking to Consul over https for ACL operations [\#217](https://github.com/solarkennedy/puppet-consul/issues/217) -- consul\_acl makes api call before ACL api is available [\#193](https://github.com/solarkennedy/puppet-consul/issues/193) +- Support for puppet-archive \>=1.0.0 [\#275](https://github.com/voxpupuli/puppet-consul/issues/275) +- Consul service is not starting up [\#273](https://github.com/voxpupuli/puppet-consul/issues/273) +- Question: URL method downloads the zip file every run? [\#270](https://github.com/voxpupuli/puppet-consul/issues/270) +- Add proxy support [\#269](https://github.com/voxpupuli/puppet-consul/issues/269) +- Changelog on Puppetforge not updated for 1.0.9 [\#268](https://github.com/voxpupuli/puppet-consul/issues/268) +- Support talking to Consul over https for ACL operations [\#217](https://github.com/voxpupuli/puppet-consul/issues/217) +- consul\_acl makes api call before ACL api is available [\#193](https://github.com/voxpupuli/puppet-consul/issues/193) **Merged pull requests:** -- Decouple service from init system [\#279](https://github.com/solarkennedy/puppet-consul/pull/279) ([tdevelioglu](https://github.com/tdevelioglu)) -- Polish [\#278](https://github.com/solarkennedy/puppet-consul/pull/278) ([tdevelioglu](https://github.com/tdevelioglu)) -- Require a new version of puppet-archive [\#277](https://github.com/solarkennedy/puppet-consul/pull/277) ([solarkennedy](https://github.com/solarkennedy)) -- Allow for stable versions of puppet/archive [\#276](https://github.com/solarkennedy/puppet-consul/pull/276) ([ghoneycutt](https://github.com/ghoneycutt)) -- add retry logic when contacting the REST API for listing ACL resources [\#274](https://github.com/solarkennedy/puppet-consul/pull/274) ([cjdaniel](https://github.com/cjdaniel)) -- Rebase \#218 [\#271](https://github.com/solarkennedy/puppet-consul/pull/271) ([solarkennedy](https://github.com/solarkennedy)) +- Decouple service from init system [\#279](https://github.com/voxpupuli/puppet-consul/pull/279) ([tdevelioglu](https://github.com/tdevelioglu)) +- Polish [\#278](https://github.com/voxpupuli/puppet-consul/pull/278) ([tdevelioglu](https://github.com/tdevelioglu)) +- Require a new version of puppet-archive [\#277](https://github.com/voxpupuli/puppet-consul/pull/277) ([solarkennedy](https://github.com/solarkennedy)) +- Allow for stable versions of puppet/archive [\#276](https://github.com/voxpupuli/puppet-consul/pull/276) ([ghoneycutt](https://github.com/ghoneycutt)) +- add retry logic when contacting the REST API for listing ACL resources [\#274](https://github.com/voxpupuli/puppet-consul/pull/274) ([cjdaniel](https://github.com/cjdaniel)) +- Rebase \#218 [\#271](https://github.com/voxpupuli/puppet-consul/pull/271) ([solarkennedy](https://github.com/solarkennedy)) -## [v1.0.10](https://github.com/solarkennedy/puppet-consul/tree/v1.0.10) (2016-06-23) +## [v1.0.10](https://github.com/voxpupuli/puppet-consul/tree/v1.0.10) (2016-06-23) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v1.0.9...v1.0.10) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v1.0.9...v1.0.10) -## [v1.0.9](https://github.com/solarkennedy/puppet-consul/tree/v1.0.9) (2016-06-20) +## [v1.0.9](https://github.com/voxpupuli/puppet-consul/tree/v1.0.9) (2016-06-20) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v1.0.8...v1.0.9) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v1.0.8...v1.0.9) **Closed issues:** -- enableTagOverride value being written as a quoted string, need to be unquote boolean. [\#261](https://github.com/solarkennedy/puppet-consul/issues/261) -- /opt/consul/serf/local.keyring is not replaced when changing encryption keys [\#256](https://github.com/solarkennedy/puppet-consul/issues/256) -- Error depencie archive [\#253](https://github.com/solarkennedy/puppet-consul/issues/253) -- nanliu-staging dependency [\#250](https://github.com/solarkennedy/puppet-consul/issues/250) -- chkconfig init files are not setup for consul on CentOS 6 [\#249](https://github.com/solarkennedy/puppet-consul/issues/249) -- Failed to start Raft: permission denied [\#237](https://github.com/solarkennedy/puppet-consul/issues/237) -- Question : Atlas join [\#228](https://github.com/solarkennedy/puppet-consul/issues/228) -- InitV startup script doesn't deamonize proprely [\#210](https://github.com/solarkennedy/puppet-consul/issues/210) -- Consul 0.6 support [\#204](https://github.com/solarkennedy/puppet-consul/issues/204) -- Why is ACL ID read-only? [\#192](https://github.com/solarkennedy/puppet-consul/issues/192) +- enableTagOverride value being written as a quoted string, need to be unquote boolean. [\#261](https://github.com/voxpupuli/puppet-consul/issues/261) +- /opt/consul/serf/local.keyring is not replaced when changing encryption keys [\#256](https://github.com/voxpupuli/puppet-consul/issues/256) +- Error depencie archive [\#253](https://github.com/voxpupuli/puppet-consul/issues/253) +- nanliu-staging dependency [\#250](https://github.com/voxpupuli/puppet-consul/issues/250) +- chkconfig init files are not setup for consul on CentOS 6 [\#249](https://github.com/voxpupuli/puppet-consul/issues/249) +- Failed to start Raft: permission denied [\#237](https://github.com/voxpupuli/puppet-consul/issues/237) +- Question : Atlas join [\#228](https://github.com/voxpupuli/puppet-consul/issues/228) +- InitV startup script doesn't deamonize proprely [\#210](https://github.com/voxpupuli/puppet-consul/issues/210) +- Consul 0.6 support [\#204](https://github.com/voxpupuli/puppet-consul/issues/204) +- Why is ACL ID read-only? [\#192](https://github.com/voxpupuli/puppet-consul/issues/192) **Merged pull requests:** -- Configure log file for upstart. [\#265](https://github.com/solarkennedy/puppet-consul/pull/265) ([jdavisp3](https://github.com/jdavisp3)) -- Handle nested :undef in consul\_sorted\_json [\#263](https://github.com/solarkennedy/puppet-consul/pull/263) ([mcasper](https://github.com/mcasper)) -- drop bool2str as we need a unquoted true|false [\#262](https://github.com/solarkennedy/puppet-consul/pull/262) ([sjoeboo](https://github.com/sjoeboo)) -- Added a parameter to allow users to change $install\_path [\#260](https://github.com/solarkennedy/puppet-consul/pull/260) ([tfhartmann](https://github.com/tfhartmann)) -- Drop ruby 1.8 support again now that puppet-archive doesn't support it [\#259](https://github.com/solarkennedy/puppet-consul/pull/259) ([solarkennedy](https://github.com/solarkennedy)) -- service EnableTagOverride [\#258](https://github.com/solarkennedy/puppet-consul/pull/258) ([cliles](https://github.com/cliles)) -- adding ability to define the inital status of consul checks [\#257](https://github.com/solarkennedy/puppet-consul/pull/257) ([asgolding](https://github.com/asgolding)) -- Puppet archive install directory will fail if default umask changed [\#255](https://github.com/solarkennedy/puppet-consul/pull/255) ([lynxman](https://github.com/lynxman)) -- in dynamic environment consul-agent should be init [\#254](https://github.com/solarkennedy/puppet-consul/pull/254) ([mcortinas](https://github.com/mcortinas)) -- fix tests [\#251](https://github.com/solarkennedy/puppet-consul/pull/251) ([solarkennedy](https://github.com/solarkennedy)) +- Configure log file for upstart. [\#265](https://github.com/voxpupuli/puppet-consul/pull/265) ([jdavisp3](https://github.com/jdavisp3)) +- Handle nested :undef in consul\_sorted\_json [\#263](https://github.com/voxpupuli/puppet-consul/pull/263) ([mcasper](https://github.com/mcasper)) +- drop bool2str as we need a unquoted true|false [\#262](https://github.com/voxpupuli/puppet-consul/pull/262) ([sjoeboo](https://github.com/sjoeboo)) +- Added a parameter to allow users to change $install\_path [\#260](https://github.com/voxpupuli/puppet-consul/pull/260) ([tfhartmann](https://github.com/tfhartmann)) +- Drop ruby 1.8 support again now that puppet-archive doesn't support it [\#259](https://github.com/voxpupuli/puppet-consul/pull/259) ([solarkennedy](https://github.com/solarkennedy)) +- service EnableTagOverride [\#258](https://github.com/voxpupuli/puppet-consul/pull/258) ([cliles](https://github.com/cliles)) +- adding ability to define the inital status of consul checks [\#257](https://github.com/voxpupuli/puppet-consul/pull/257) ([asgolding](https://github.com/asgolding)) +- Puppet archive install directory will fail if default umask changed [\#255](https://github.com/voxpupuli/puppet-consul/pull/255) ([lynxman](https://github.com/lynxman)) +- in dynamic environment consul-agent should be init [\#254](https://github.com/voxpupuli/puppet-consul/pull/254) ([mcortinas](https://github.com/mcortinas)) +- fix tests [\#251](https://github.com/voxpupuli/puppet-consul/pull/251) ([solarkennedy](https://github.com/solarkennedy)) -## [v1.0.8](https://github.com/solarkennedy/puppet-consul/tree/v1.0.8) (2016-04-13) +## [v1.0.8](https://github.com/voxpupuli/puppet-consul/tree/v1.0.8) (2016-04-13) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v1.0.6...v1.0.8) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v1.0.6...v1.0.8) **Closed issues:** -- Switch from using staging module to archive [\#242](https://github.com/solarkennedy/puppet-consul/issues/242) -- Service start is broken on Debian \> 8.0 [\#232](https://github.com/solarkennedy/puppet-consul/issues/232) -- Services variable not working with hiera hash. Expects an array of hashes it seems. [\#230](https://github.com/solarkennedy/puppet-consul/issues/230) -- ensure\_packages unzip with 'before' breaks interoperability [\#187](https://github.com/solarkennedy/puppet-consul/issues/187) -- Setting consul::version in hiera does not change the download\_url [\#129](https://github.com/solarkennedy/puppet-consul/issues/129) -- add maintenance mode option to init scripts [\#124](https://github.com/solarkennedy/puppet-consul/issues/124) -- Watches key in config\_hash should expect an array of hashes? [\#83](https://github.com/solarkennedy/puppet-consul/issues/83) +- Switch from using staging module to archive [\#242](https://github.com/voxpupuli/puppet-consul/issues/242) +- Service start is broken on Debian \> 8.0 [\#232](https://github.com/voxpupuli/puppet-consul/issues/232) +- Services variable not working with hiera hash. Expects an array of hashes it seems. [\#230](https://github.com/voxpupuli/puppet-consul/issues/230) +- ensure\_packages unzip with 'before' breaks interoperability [\#187](https://github.com/voxpupuli/puppet-consul/issues/187) +- Setting consul::version in hiera does not change the download\_url [\#129](https://github.com/voxpupuli/puppet-consul/issues/129) +- add maintenance mode option to init scripts [\#124](https://github.com/voxpupuli/puppet-consul/issues/124) +- Watches key in config\_hash should expect an array of hashes? [\#83](https://github.com/voxpupuli/puppet-consul/issues/83) -## [v1.0.6](https://github.com/solarkennedy/puppet-consul/tree/v1.0.6) (2016-03-24) +## [v1.0.6](https://github.com/voxpupuli/puppet-consul/tree/v1.0.6) (2016-03-24) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v1.0.5...v1.0.6) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v1.0.5...v1.0.6) **Closed issues:** -- Master broken on EL6 due to "Invalid service provider 'sysv'" [\#240](https://github.com/solarkennedy/puppet-consul/issues/240) -- Service reload too quick [\#231](https://github.com/solarkennedy/puppet-consul/issues/231) -- Systemd limits issue [\#225](https://github.com/solarkennedy/puppet-consul/issues/225) -- Encryption [\#224](https://github.com/solarkennedy/puppet-consul/issues/224) -- Duplicate declaration: Class\[Staging\] with puppet/mysql mysqltuner [\#223](https://github.com/solarkennedy/puppet-consul/issues/223) -- Consul reload fails when rpc\_addr is 0.0.0.0 [\#220](https://github.com/solarkennedy/puppet-consul/issues/220) -- Support creating ACLs while talking to a hostname other than localhost [\#216](https://github.com/solarkennedy/puppet-consul/issues/216) -- Release version 1.0.5 [\#215](https://github.com/solarkennedy/puppet-consul/issues/215) +- Master broken on EL6 due to "Invalid service provider 'sysv'" [\#240](https://github.com/voxpupuli/puppet-consul/issues/240) +- Service reload too quick [\#231](https://github.com/voxpupuli/puppet-consul/issues/231) +- Systemd limits issue [\#225](https://github.com/voxpupuli/puppet-consul/issues/225) +- Encryption [\#224](https://github.com/voxpupuli/puppet-consul/issues/224) +- Duplicate declaration: Class\[Staging\] with puppet/mysql mysqltuner [\#223](https://github.com/voxpupuli/puppet-consul/issues/223) +- Consul reload fails when rpc\_addr is 0.0.0.0 [\#220](https://github.com/voxpupuli/puppet-consul/issues/220) +- Support creating ACLs while talking to a hostname other than localhost [\#216](https://github.com/voxpupuli/puppet-consul/issues/216) +- Release version 1.0.5 [\#215](https://github.com/voxpupuli/puppet-consul/issues/215) **Merged pull requests:** -- Switching from staging to archive module [\#243](https://github.com/solarkennedy/puppet-consul/pull/243) ([hopperd](https://github.com/hopperd)) -- EL \< 7 uses init service provider, not sysv. [\#241](https://github.com/solarkennedy/puppet-consul/pull/241) ([fatmcgav](https://github.com/fatmcgav)) -- Update reload\_service.pp [\#235](https://github.com/solarkennedy/puppet-consul/pull/235) ([nvtkaszpir](https://github.com/nvtkaszpir)) -- add support for arm \(Raspberry pi's ARM here\) architecture [\#234](https://github.com/solarkennedy/puppet-consul/pull/234) ([gibre](https://github.com/gibre)) -- Added custom init style "custom" [\#233](https://github.com/solarkennedy/puppet-consul/pull/233) ([sy-bee](https://github.com/sy-bee)) -- lazily return nil when consul client isn't installed [\#227](https://github.com/solarkennedy/puppet-consul/pull/227) ([roobert](https://github.com/roobert)) -- add NOFILE limit to systemd template [\#226](https://github.com/solarkennedy/puppet-consul/pull/226) ([eliranbz](https://github.com/eliranbz)) -- Debian init script should depend on networking, resolution and syslog [\#222](https://github.com/solarkennedy/puppet-consul/pull/222) ([chrisboulton](https://github.com/chrisboulton)) -- When reloading consul, use 127.0.0.1 as rpc\_addr when rpc\_addr was set to 0.0.0.0 [\#221](https://github.com/solarkennedy/puppet-consul/pull/221) ([danielbenzvi](https://github.com/danielbenzvi)) -- Add hostname proprety for ACL operations, defaults to localhost, like before [\#219](https://github.com/solarkennedy/puppet-consul/pull/219) ([gozer](https://github.com/gozer)) -- Consul Version Fact [\#209](https://github.com/solarkennedy/puppet-consul/pull/209) ([robrankin](https://github.com/robrankin)) -- Set provider on consul service [\#125](https://github.com/solarkennedy/puppet-consul/pull/125) ([albustax](https://github.com/albustax)) +- Switching from staging to archive module [\#243](https://github.com/voxpupuli/puppet-consul/pull/243) ([hopperd](https://github.com/hopperd)) +- EL \< 7 uses init service provider, not sysv. [\#241](https://github.com/voxpupuli/puppet-consul/pull/241) ([fatmcgav](https://github.com/fatmcgav)) +- Update reload\_service.pp [\#235](https://github.com/voxpupuli/puppet-consul/pull/235) ([nvtkaszpir](https://github.com/nvtkaszpir)) +- add support for arm \(Raspberry pi's ARM here\) architecture [\#234](https://github.com/voxpupuli/puppet-consul/pull/234) ([gibre](https://github.com/gibre)) +- Added custom init style "custom" [\#233](https://github.com/voxpupuli/puppet-consul/pull/233) ([sy-bee](https://github.com/sy-bee)) +- lazily return nil when consul client isn't installed [\#227](https://github.com/voxpupuli/puppet-consul/pull/227) ([roobert](https://github.com/roobert)) +- add NOFILE limit to systemd template [\#226](https://github.com/voxpupuli/puppet-consul/pull/226) ([eliranbz](https://github.com/eliranbz)) +- Debian init script should depend on networking, resolution and syslog [\#222](https://github.com/voxpupuli/puppet-consul/pull/222) ([chrisboulton](https://github.com/chrisboulton)) +- When reloading consul, use 127.0.0.1 as rpc\_addr when rpc\_addr was set to 0.0.0.0 [\#221](https://github.com/voxpupuli/puppet-consul/pull/221) ([danielbenzvi](https://github.com/danielbenzvi)) +- Add hostname proprety for ACL operations, defaults to localhost, like before [\#219](https://github.com/voxpupuli/puppet-consul/pull/219) ([gozer](https://github.com/gozer)) +- Consul Version Fact [\#209](https://github.com/voxpupuli/puppet-consul/pull/209) ([robrankin](https://github.com/robrankin)) +- Set provider on consul service [\#125](https://github.com/voxpupuli/puppet-consul/pull/125) ([albustax](https://github.com/albustax)) -## [v1.0.5](https://github.com/solarkennedy/puppet-consul/tree/v1.0.5) (2016-01-08) +## [v1.0.5](https://github.com/voxpupuli/puppet-consul/tree/v1.0.5) (2016-01-08) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v1.0.4...v1.0.5) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v1.0.4...v1.0.5) **Fixed bugs:** -- umask feature breaks CentOS init scripts [\#107](https://github.com/solarkennedy/puppet-consul/issues/107) +- umask feature breaks CentOS init scripts [\#107](https://github.com/voxpupuli/puppet-consul/issues/107) **Closed issues:** -- If $install\_method = 'url', won't upgrade consul [\#103](https://github.com/solarkennedy/puppet-consul/issues/103) +- If $install\_method = 'url', won't upgrade consul [\#103](https://github.com/voxpupuli/puppet-consul/issues/103) **Merged pull requests:** -- ACL fixes - idempotentcy and port bug. [\#214](https://github.com/solarkennedy/puppet-consul/pull/214) ([sigerber](https://github.com/sigerber)) -- Fix port property [\#213](https://github.com/solarkennedy/puppet-consul/pull/213) ([afterwords](https://github.com/afterwords)) -- Add support of OpenSuSE and SLED [\#212](https://github.com/solarkennedy/puppet-consul/pull/212) ([kscherer](https://github.com/kscherer)) -- Fix web\_ui installation on Consul 0.6.0 and greater [\#208](https://github.com/solarkennedy/puppet-consul/pull/208) ([dbeckham](https://github.com/dbeckham)) -- mitigate .to\_json segfaults on Ruby 1.8.7 [\#205](https://github.com/solarkennedy/puppet-consul/pull/205) ([duritong](https://github.com/duritong)) +- ACL fixes - idempotentcy and port bug. [\#214](https://github.com/voxpupuli/puppet-consul/pull/214) ([sigerber](https://github.com/sigerber)) +- Fix port property [\#213](https://github.com/voxpupuli/puppet-consul/pull/213) ([afterwords](https://github.com/afterwords)) +- Add support of OpenSuSE and SLED [\#212](https://github.com/voxpupuli/puppet-consul/pull/212) ([kscherer](https://github.com/kscherer)) +- Fix web\_ui installation on Consul 0.6.0 and greater [\#208](https://github.com/voxpupuli/puppet-consul/pull/208) ([dbeckham](https://github.com/dbeckham)) +- mitigate .to\_json segfaults on Ruby 1.8.7 [\#205](https://github.com/voxpupuli/puppet-consul/pull/205) ([duritong](https://github.com/duritong)) -## [v1.0.4](https://github.com/solarkennedy/puppet-consul/tree/v1.0.4) (2015-12-15) +## [v1.0.4](https://github.com/voxpupuli/puppet-consul/tree/v1.0.4) (2015-12-15) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v1.0.3...v1.0.4) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v1.0.3...v1.0.4) **Merged pull requests:** -- Added support for TCP checks \(available in Consul 0.6.x\) [\#206](https://github.com/solarkennedy/puppet-consul/pull/206) ([hopperd](https://github.com/hopperd)) +- Added support for TCP checks \(available in Consul 0.6.x\) [\#206](https://github.com/voxpupuli/puppet-consul/pull/206) ([hopperd](https://github.com/hopperd)) -## [v1.0.3](https://github.com/solarkennedy/puppet-consul/tree/v1.0.3) (2015-12-10) +## [v1.0.3](https://github.com/voxpupuli/puppet-consul/tree/v1.0.3) (2015-12-10) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v1.0.2...v1.0.3) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v1.0.2...v1.0.3) **Closed issues:** -- Default mode on config.json and service files is too permissive [\#199](https://github.com/solarkennedy/puppet-consul/issues/199) -- Wrong number of arguments given [\#194](https://github.com/solarkennedy/puppet-consul/issues/194) -- metadata.json - needs at least 4.6.0 of stdlib [\#190](https://github.com/solarkennedy/puppet-consul/issues/190) -- Strange \(probably unnecessary\) behavior in sysv stop script [\#174](https://github.com/solarkennedy/puppet-consul/issues/174) +- Default mode on config.json and service files is too permissive [\#199](https://github.com/voxpupuli/puppet-consul/issues/199) +- Wrong number of arguments given [\#194](https://github.com/voxpupuli/puppet-consul/issues/194) +- metadata.json - needs at least 4.6.0 of stdlib [\#190](https://github.com/voxpupuli/puppet-consul/issues/190) +- Strange \(probably unnecessary\) behavior in sysv stop script [\#174](https://github.com/voxpupuli/puppet-consul/issues/174) **Merged pull requests:** -- Updating staging file download to use the version and symlink [\#202](https://github.com/solarkennedy/puppet-consul/pull/202) ([hopperd](https://github.com/hopperd)) -- Updated download\_urls used to be the new releases.hashicorp.com location [\#201](https://github.com/solarkennedy/puppet-consul/pull/201) ([hopperd](https://github.com/hopperd)) -- parameterize config file mode [\#200](https://github.com/solarkennedy/puppet-consul/pull/200) ([aj-jester](https://github.com/aj-jester)) -- Add parameter for setting port to custom acl type [\#197](https://github.com/solarkennedy/puppet-consul/pull/197) ([afterwords](https://github.com/afterwords)) -- Allow ACL ID to be writeable [\#196](https://github.com/solarkennedy/puppet-consul/pull/196) ([robrankin](https://github.com/robrankin)) -- need at least 4.6.0 of puppetlabs/stdlib [\#191](https://github.com/solarkennedy/puppet-consul/pull/191) ([gdhbashton](https://github.com/gdhbashton)) -- Remove management of unzip package [\#189](https://github.com/solarkennedy/puppet-consul/pull/189) ([danieldreier](https://github.com/danieldreier)) -- consul init sysv: lower stop priority [\#188](https://github.com/solarkennedy/puppet-consul/pull/188) ([koendc](https://github.com/koendc)) -- actually we want to escape / globally for filenames [\#186](https://github.com/solarkennedy/puppet-consul/pull/186) ([duritong](https://github.com/duritong)) -- Fixed chuid / consul executed as root [\#183](https://github.com/solarkennedy/puppet-consul/pull/183) ([sw0x2A](https://github.com/sw0x2A)) -- Rework sysv stop script to fix issues [\#181](https://github.com/solarkennedy/puppet-consul/pull/181) ([pforman](https://github.com/pforman)) -- explicitly define ownership of config directory, installation breaks for hardened Linux boxes with default umask of 0077 - this fixes the problem [\#168](https://github.com/solarkennedy/puppet-consul/pull/168) ([proletaryo](https://github.com/proletaryo)) +- Updating staging file download to use the version and symlink [\#202](https://github.com/voxpupuli/puppet-consul/pull/202) ([hopperd](https://github.com/hopperd)) +- Updated download\_urls used to be the new releases.hashicorp.com location [\#201](https://github.com/voxpupuli/puppet-consul/pull/201) ([hopperd](https://github.com/hopperd)) +- parameterize config file mode [\#200](https://github.com/voxpupuli/puppet-consul/pull/200) ([aj-jester](https://github.com/aj-jester)) +- Add parameter for setting port to custom acl type [\#197](https://github.com/voxpupuli/puppet-consul/pull/197) ([afterwords](https://github.com/afterwords)) +- Allow ACL ID to be writeable [\#196](https://github.com/voxpupuli/puppet-consul/pull/196) ([robrankin](https://github.com/robrankin)) +- need at least 4.6.0 of puppetlabs/stdlib [\#191](https://github.com/voxpupuli/puppet-consul/pull/191) ([gdhbashton](https://github.com/gdhbashton)) +- Remove management of unzip package [\#189](https://github.com/voxpupuli/puppet-consul/pull/189) ([danieldreier](https://github.com/danieldreier)) +- consul init sysv: lower stop priority [\#188](https://github.com/voxpupuli/puppet-consul/pull/188) ([koendc](https://github.com/koendc)) +- actually we want to escape / globally for filenames [\#186](https://github.com/voxpupuli/puppet-consul/pull/186) ([duritong](https://github.com/duritong)) +- Fixed chuid / consul executed as root [\#183](https://github.com/voxpupuli/puppet-consul/pull/183) ([sw0x2A](https://github.com/sw0x2A)) +- Rework sysv stop script to fix issues [\#181](https://github.com/voxpupuli/puppet-consul/pull/181) ([pforman](https://github.com/pforman)) +- explicitly define ownership of config directory, installation breaks for hardened Linux boxes with default umask of 0077 - this fixes the problem [\#168](https://github.com/voxpupuli/puppet-consul/pull/168) ([proletaryo](https://github.com/proletaryo)) -## [v1.0.2](https://github.com/solarkennedy/puppet-consul/tree/v1.0.2) (2015-09-05) +## [v1.0.2](https://github.com/voxpupuli/puppet-consul/tree/v1.0.2) (2015-09-05) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v1.0.0...v1.0.2) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v1.0.0...v1.0.2) **Closed issues:** -- Log rotation? [\#182](https://github.com/solarkennedy/puppet-consul/issues/182) -- Staging missing dependency on `Package['unzip']` [\#164](https://github.com/solarkennedy/puppet-consul/issues/164) -- Documentation [\#161](https://github.com/solarkennedy/puppet-consul/issues/161) -- Ruby 1.8 support [\#148](https://github.com/solarkennedy/puppet-consul/issues/148) -- GOMAXPROCS discarded by upstart init due to sudo's env\_reset option [\#126](https://github.com/solarkennedy/puppet-consul/issues/126) -- Module should have a CHANGELOG [\#122](https://github.com/solarkennedy/puppet-consul/issues/122) -- Debian: /var/run/consul/consul.pid user affinity inconsistent [\#120](https://github.com/solarkennedy/puppet-consul/issues/120) -- config\_hash converts strings to integers =\> breaks port mappings [\#119](https://github.com/solarkennedy/puppet-consul/issues/119) -- Invalid resource type staging::file [\#117](https://github.com/solarkennedy/puppet-consul/issues/117) -- Need to add -data-dir option to startup scripts. [\#115](https://github.com/solarkennedy/puppet-consul/issues/115) -- Meta stuff Not up to snuff [\#76](https://github.com/solarkennedy/puppet-consul/issues/76) -- Send SIGHUP to consul agent when new checks/services are detected [\#43](https://github.com/solarkennedy/puppet-consul/issues/43) -- Support consul-template [\#36](https://github.com/solarkennedy/puppet-consul/issues/36) - -**Merged pull requests:** - -- Update beaker tests + travis integration [\#180](https://github.com/solarkennedy/puppet-consul/pull/180) ([solarkennedy](https://github.com/solarkennedy)) -- fix 'consul reload' on custom rpc port [\#179](https://github.com/solarkennedy/puppet-consul/pull/179) ([mdelagrange](https://github.com/mdelagrange)) -- More rpc port support for debian/upstart [\#177](https://github.com/solarkennedy/puppet-consul/pull/177) ([solarkennedy](https://github.com/solarkennedy)) -- Archlinux support [\#176](https://github.com/solarkennedy/puppet-consul/pull/176) ([vdloo](https://github.com/vdloo)) -- pretty config \(that properly sorts\) [\#175](https://github.com/solarkennedy/puppet-consul/pull/175) ([aj-jester](https://github.com/aj-jester)) -- prevent unnecessary consul restarts on puppet runs [\#173](https://github.com/solarkennedy/puppet-consul/pull/173) ([mdelagrange](https://github.com/mdelagrange)) -- Add a check for $service\_ensure in reload\_service [\#172](https://github.com/solarkennedy/puppet-consul/pull/172) ([pforman](https://github.com/pforman)) -- deep\_merge to support nested objects [\#171](https://github.com/solarkennedy/puppet-consul/pull/171) ([aj-jester](https://github.com/aj-jester)) -- parameterize restart on change for the main config [\#169](https://github.com/solarkennedy/puppet-consul/pull/169) ([aj-jester](https://github.com/aj-jester)) -- unzip depedency for staging [\#166](https://github.com/solarkennedy/puppet-consul/pull/166) ([aj-jester](https://github.com/aj-jester)) -- Adding support for Ubuntu 15.04 [\#163](https://github.com/solarkennedy/puppet-consul/pull/163) ([asasfu](https://github.com/asasfu)) -- Ensure all network interfaces are up before starting in upstart config [\#162](https://github.com/solarkennedy/puppet-consul/pull/162) ([jbarbuto](https://github.com/jbarbuto)) -- UI dir symlink should depend on the dist existing [\#158](https://github.com/solarkennedy/puppet-consul/pull/158) ([jsok](https://github.com/jsok)) -- remove string casting to int [\#157](https://github.com/solarkennedy/puppet-consul/pull/157) ([aj-jester](https://github.com/aj-jester)) -- convert quoted integers to int object [\#156](https://github.com/solarkennedy/puppet-consul/pull/156) ([aj-jester](https://github.com/aj-jester)) -- Update the gemfile, hopefully to something beaker and puppet-rspec can tolerate [\#154](https://github.com/solarkennedy/puppet-consul/pull/154) ([solarkennedy](https://github.com/solarkennedy)) -- travis update [\#153](https://github.com/solarkennedy/puppet-consul/pull/153) ([jlambert121](https://github.com/jlambert121)) -- reload on service, checks and watch changes [\#152](https://github.com/solarkennedy/puppet-consul/pull/152) ([aj-jester](https://github.com/aj-jester)) -- acl token support for services and checks [\#151](https://github.com/solarkennedy/puppet-consul/pull/151) ([aj-jester](https://github.com/aj-jester)) -- Modify consul\_validate\_checks to work with ruby 1.8 [\#149](https://github.com/solarkennedy/puppet-consul/pull/149) ([solarnz](https://github.com/solarnz)) -- Adding groups parameter to user definition [\#147](https://github.com/solarkennedy/puppet-consul/pull/147) ([robrankin](https://github.com/robrankin)) -- upstart: Agents should gracefully leave cluster on stop [\#146](https://github.com/solarkennedy/puppet-consul/pull/146) ([jsok](https://github.com/jsok)) -- explicitly set depedencies for package install [\#145](https://github.com/solarkennedy/puppet-consul/pull/145) ([jlambert121](https://github.com/jlambert121)) -- Use strict vars all the time, and future parser for later versions [\#144](https://github.com/solarkennedy/puppet-consul/pull/144) ([solarkennedy](https://github.com/solarkennedy)) -- add puppet 4 testing to travis [\#143](https://github.com/solarkennedy/puppet-consul/pull/143) ([jlambert121](https://github.com/jlambert121)) -- create user/group as system accounts [\#142](https://github.com/solarkennedy/puppet-consul/pull/142) ([jlambert121](https://github.com/jlambert121)) -- correct links for consul template [\#140](https://github.com/solarkennedy/puppet-consul/pull/140) ([jlambert121](https://github.com/jlambert121)) -- compatibiliy fix: ensure variables are defined [\#139](https://github.com/solarkennedy/puppet-consul/pull/139) ([mklette](https://github.com/mklette)) -- Pass ensure to service definition file [\#138](https://github.com/solarkennedy/puppet-consul/pull/138) ([mklette](https://github.com/mklette)) -- Fix debian init [\#137](https://github.com/solarkennedy/puppet-consul/pull/137) ([dizzythinks](https://github.com/dizzythinks)) -- update default consul version [\#136](https://github.com/solarkennedy/puppet-consul/pull/136) ([jlambert121](https://github.com/jlambert121)) -- Make consul::install optional [\#135](https://github.com/solarkennedy/puppet-consul/pull/135) ([potto007](https://github.com/potto007)) -- Add an exec to daemon-reload systemctl when the unit-file changes [\#134](https://github.com/solarkennedy/puppet-consul/pull/134) ([robrankin](https://github.com/robrankin)) -- Fix issue \#129 - https://github.com/solarkennedy/puppet-consul/issues/129 [\#133](https://github.com/solarkennedy/puppet-consul/pull/133) ([potto007](https://github.com/potto007)) -- Escape the ID & make fixtures useable more widely [\#132](https://github.com/solarkennedy/puppet-consul/pull/132) ([duritong](https://github.com/duritong)) -- Change name of File\['config.json'\] to File\['consul config.json'\] [\#131](https://github.com/solarkennedy/puppet-consul/pull/131) ([EvanKrall](https://github.com/EvanKrall)) -- Switch to using start-stop-daemon for consul upstart init script [\#130](https://github.com/solarkennedy/puppet-consul/pull/130) ([bdellegrazie](https://github.com/bdellegrazie)) -- Supply optional token for ACL changes [\#128](https://github.com/solarkennedy/puppet-consul/pull/128) ([mdelagrange](https://github.com/mdelagrange)) -- Fix pidfile handling on Debian [\#121](https://github.com/solarkennedy/puppet-consul/pull/121) ([weitzj](https://github.com/weitzj)) - -## [v1.0.0](https://github.com/solarkennedy/puppet-consul/tree/v1.0.0) (2015-04-30) - -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v0.4.6...v1.0.0) +- Log rotation? [\#182](https://github.com/voxpupuli/puppet-consul/issues/182) +- Staging missing dependency on `Package['unzip']` [\#164](https://github.com/voxpupuli/puppet-consul/issues/164) +- Documentation [\#161](https://github.com/voxpupuli/puppet-consul/issues/161) +- Ruby 1.8 support [\#148](https://github.com/voxpupuli/puppet-consul/issues/148) +- GOMAXPROCS discarded by upstart init due to sudo's env\_reset option [\#126](https://github.com/voxpupuli/puppet-consul/issues/126) +- Module should have a CHANGELOG [\#122](https://github.com/voxpupuli/puppet-consul/issues/122) +- Debian: /var/run/consul/consul.pid user affinity inconsistent [\#120](https://github.com/voxpupuli/puppet-consul/issues/120) +- config\_hash converts strings to integers =\> breaks port mappings [\#119](https://github.com/voxpupuli/puppet-consul/issues/119) +- Invalid resource type staging::file [\#117](https://github.com/voxpupuli/puppet-consul/issues/117) +- Need to add -data-dir option to startup scripts. [\#115](https://github.com/voxpupuli/puppet-consul/issues/115) +- Meta stuff Not up to snuff [\#76](https://github.com/voxpupuli/puppet-consul/issues/76) +- Send SIGHUP to consul agent when new checks/services are detected [\#43](https://github.com/voxpupuli/puppet-consul/issues/43) +- Support consul-template [\#36](https://github.com/voxpupuli/puppet-consul/issues/36) + +**Merged pull requests:** + +- Update beaker tests + travis integration [\#180](https://github.com/voxpupuli/puppet-consul/pull/180) ([solarkennedy](https://github.com/solarkennedy)) +- fix 'consul reload' on custom rpc port [\#179](https://github.com/voxpupuli/puppet-consul/pull/179) ([mdelagrange](https://github.com/mdelagrange)) +- More rpc port support for debian/upstart [\#177](https://github.com/voxpupuli/puppet-consul/pull/177) ([solarkennedy](https://github.com/solarkennedy)) +- Archlinux support [\#176](https://github.com/voxpupuli/puppet-consul/pull/176) ([vdloo](https://github.com/vdloo)) +- pretty config \(that properly sorts\) [\#175](https://github.com/voxpupuli/puppet-consul/pull/175) ([aj-jester](https://github.com/aj-jester)) +- prevent unnecessary consul restarts on puppet runs [\#173](https://github.com/voxpupuli/puppet-consul/pull/173) ([mdelagrange](https://github.com/mdelagrange)) +- Add a check for $service\_ensure in reload\_service [\#172](https://github.com/voxpupuli/puppet-consul/pull/172) ([pforman](https://github.com/pforman)) +- deep\_merge to support nested objects [\#171](https://github.com/voxpupuli/puppet-consul/pull/171) ([aj-jester](https://github.com/aj-jester)) +- parameterize restart on change for the main config [\#169](https://github.com/voxpupuli/puppet-consul/pull/169) ([aj-jester](https://github.com/aj-jester)) +- unzip depedency for staging [\#166](https://github.com/voxpupuli/puppet-consul/pull/166) ([aj-jester](https://github.com/aj-jester)) +- Adding support for Ubuntu 15.04 [\#163](https://github.com/voxpupuli/puppet-consul/pull/163) ([asasfu](https://github.com/asasfu)) +- Ensure all network interfaces are up before starting in upstart config [\#162](https://github.com/voxpupuli/puppet-consul/pull/162) ([jbarbuto](https://github.com/jbarbuto)) +- UI dir symlink should depend on the dist existing [\#158](https://github.com/voxpupuli/puppet-consul/pull/158) ([jsok](https://github.com/jsok)) +- remove string casting to int [\#157](https://github.com/voxpupuli/puppet-consul/pull/157) ([aj-jester](https://github.com/aj-jester)) +- convert quoted integers to int object [\#156](https://github.com/voxpupuli/puppet-consul/pull/156) ([aj-jester](https://github.com/aj-jester)) +- Update the gemfile, hopefully to something beaker and puppet-rspec can tolerate [\#154](https://github.com/voxpupuli/puppet-consul/pull/154) ([solarkennedy](https://github.com/solarkennedy)) +- travis update [\#153](https://github.com/voxpupuli/puppet-consul/pull/153) ([jlambert121](https://github.com/jlambert121)) +- reload on service, checks and watch changes [\#152](https://github.com/voxpupuli/puppet-consul/pull/152) ([aj-jester](https://github.com/aj-jester)) +- acl token support for services and checks [\#151](https://github.com/voxpupuli/puppet-consul/pull/151) ([aj-jester](https://github.com/aj-jester)) +- Modify consul\_validate\_checks to work with ruby 1.8 [\#149](https://github.com/voxpupuli/puppet-consul/pull/149) ([solarnz](https://github.com/solarnz)) +- Adding groups parameter to user definition [\#147](https://github.com/voxpupuli/puppet-consul/pull/147) ([robrankin](https://github.com/robrankin)) +- upstart: Agents should gracefully leave cluster on stop [\#146](https://github.com/voxpupuli/puppet-consul/pull/146) ([jsok](https://github.com/jsok)) +- explicitly set depedencies for package install [\#145](https://github.com/voxpupuli/puppet-consul/pull/145) ([jlambert121](https://github.com/jlambert121)) +- Use strict vars all the time, and future parser for later versions [\#144](https://github.com/voxpupuli/puppet-consul/pull/144) ([solarkennedy](https://github.com/solarkennedy)) +- add puppet 4 testing to travis [\#143](https://github.com/voxpupuli/puppet-consul/pull/143) ([jlambert121](https://github.com/jlambert121)) +- create user/group as system accounts [\#142](https://github.com/voxpupuli/puppet-consul/pull/142) ([jlambert121](https://github.com/jlambert121)) +- correct links for consul template [\#140](https://github.com/voxpupuli/puppet-consul/pull/140) ([jlambert121](https://github.com/jlambert121)) +- compatibiliy fix: ensure variables are defined [\#139](https://github.com/voxpupuli/puppet-consul/pull/139) ([mklette](https://github.com/mklette)) +- Pass ensure to service definition file [\#138](https://github.com/voxpupuli/puppet-consul/pull/138) ([mklette](https://github.com/mklette)) +- Fix debian init [\#137](https://github.com/voxpupuli/puppet-consul/pull/137) ([dizzythinks](https://github.com/dizzythinks)) +- update default consul version [\#136](https://github.com/voxpupuli/puppet-consul/pull/136) ([jlambert121](https://github.com/jlambert121)) +- Make consul::install optional [\#135](https://github.com/voxpupuli/puppet-consul/pull/135) ([potto007](https://github.com/potto007)) +- Add an exec to daemon-reload systemctl when the unit-file changes [\#134](https://github.com/voxpupuli/puppet-consul/pull/134) ([robrankin](https://github.com/robrankin)) +- Fix issue \#129 - https://github.com/solarkennedy/puppet-consul/issues/129 [\#133](https://github.com/voxpupuli/puppet-consul/pull/133) ([potto007](https://github.com/potto007)) +- Escape the ID & make fixtures useable more widely [\#132](https://github.com/voxpupuli/puppet-consul/pull/132) ([duritong](https://github.com/duritong)) +- Change name of File\['config.json'\] to File\['consul config.json'\] [\#131](https://github.com/voxpupuli/puppet-consul/pull/131) ([EvanKrall](https://github.com/EvanKrall)) +- Switch to using start-stop-daemon for consul upstart init script [\#130](https://github.com/voxpupuli/puppet-consul/pull/130) ([bdellegrazie](https://github.com/bdellegrazie)) +- Supply optional token for ACL changes [\#128](https://github.com/voxpupuli/puppet-consul/pull/128) ([mdelagrange](https://github.com/mdelagrange)) +- Fix pidfile handling on Debian [\#121](https://github.com/voxpupuli/puppet-consul/pull/121) ([weitzj](https://github.com/weitzj)) + +## [v1.0.0](https://github.com/voxpupuli/puppet-consul/tree/v1.0.0) (2015-04-30) + +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v0.4.6...v1.0.0) **Closed issues:** -- README for consul::service is out of date [\#110](https://github.com/solarkennedy/puppet-consul/issues/110) -- delete\_undef\_values required stdlib 4.2.0, dependency not set properly [\#109](https://github.com/solarkennedy/puppet-consul/issues/109) -- init script doesn't have data-dir \(0.5.0\) [\#100](https://github.com/solarkennedy/puppet-consul/issues/100) -- passingonly needs to be a boolean for watch type [\#97](https://github.com/solarkennedy/puppet-consul/issues/97) -- Dependency cycle using consul::services [\#90](https://github.com/solarkennedy/puppet-consul/issues/90) -- consul should not 'leave' for init script 'stop' action [\#85](https://github.com/solarkennedy/puppet-consul/issues/85) -- Cycling dependancy in Hiera-based config [\#81](https://github.com/solarkennedy/puppet-consul/issues/81) -- Support for Consul 0.5.0 and multiple check configuration [\#73](https://github.com/solarkennedy/puppet-consul/issues/73) -- Path to /home/kyle is hard coded, somewhere [\#65](https://github.com/solarkennedy/puppet-consul/issues/65) - -**Merged pull requests:** - -- Debian 8.0+ uses systemd [\#113](https://github.com/solarkennedy/puppet-consul/pull/113) ([CyBeRoni](https://github.com/CyBeRoni)) -- Update README, ensure passingonly is a bool [\#112](https://github.com/solarkennedy/puppet-consul/pull/112) ([zxjinn](https://github.com/zxjinn)) -- Update puppetlabs-stdlib dependency to 4.2.0 for the delete\_undef\_values function [\#111](https://github.com/solarkennedy/puppet-consul/pull/111) ([zxjinn](https://github.com/zxjinn)) -- Revert "Allow setting of the umask for the consul daemon." [\#108](https://github.com/solarkennedy/puppet-consul/pull/108) ([sjoeboo](https://github.com/sjoeboo)) -- Allow setting of the umask for the consul daemon. [\#106](https://github.com/solarkennedy/puppet-consul/pull/106) ([EvanKrall](https://github.com/EvanKrall)) -- Respect user and group in launchd. [\#105](https://github.com/solarkennedy/puppet-consul/pull/105) ([EvanKrall](https://github.com/EvanKrall)) -- Anchor the consul install/config/run\_service classes [\#102](https://github.com/solarkennedy/puppet-consul/pull/102) ([koendc](https://github.com/koendc)) -- Added support for consul 0.5.0 features: [\#99](https://github.com/solarkennedy/puppet-consul/pull/99) ([hopperd](https://github.com/hopperd)) -- make module work with future parser [\#92](https://github.com/solarkennedy/puppet-consul/pull/92) ([duritong](https://github.com/duritong)) -- Add consul\_acl type and provider [\#91](https://github.com/solarkennedy/puppet-consul/pull/91) ([michaeltchapman](https://github.com/michaeltchapman)) -- Consul expects prefix rather than keyprefix in watch config [\#89](https://github.com/solarkennedy/puppet-consul/pull/89) ([codesplicer](https://github.com/codesplicer)) -- Expose id parameter for service definitions [\#88](https://github.com/solarkennedy/puppet-consul/pull/88) ([codesplicer](https://github.com/codesplicer)) -- sysv & debian init updates to kill or leave [\#87](https://github.com/solarkennedy/puppet-consul/pull/87) ([runswithd6s](https://github.com/runswithd6s)) -- Updated the params for OracleLinux Support [\#84](https://github.com/solarkennedy/puppet-consul/pull/84) ([MarsuperMammal](https://github.com/MarsuperMammal)) -- Fixes \#81 bugfix cycle dependency when specifying a service [\#82](https://github.com/solarkennedy/puppet-consul/pull/82) ([tayzlor](https://github.com/tayzlor)) -- Added compatibility for Scientific Linux [\#78](https://github.com/solarkennedy/puppet-consul/pull/78) ([tracyde](https://github.com/tracyde)) -- More lint fixes [\#77](https://github.com/solarkennedy/puppet-consul/pull/77) ([solarkennedy](https://github.com/solarkennedy)) -- Support for Amazon OS [\#68](https://github.com/solarkennedy/puppet-consul/pull/68) ([dcoxall](https://github.com/dcoxall)) - -## [v0.4.6](https://github.com/solarkennedy/puppet-consul/tree/v0.4.6) (2015-01-23) - -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v0.4.5...v0.4.6) +- README for consul::service is out of date [\#110](https://github.com/voxpupuli/puppet-consul/issues/110) +- delete\_undef\_values required stdlib 4.2.0, dependency not set properly [\#109](https://github.com/voxpupuli/puppet-consul/issues/109) +- init script doesn't have data-dir \(0.5.0\) [\#100](https://github.com/voxpupuli/puppet-consul/issues/100) +- passingonly needs to be a boolean for watch type [\#97](https://github.com/voxpupuli/puppet-consul/issues/97) +- Dependency cycle using consul::services [\#90](https://github.com/voxpupuli/puppet-consul/issues/90) +- consul should not 'leave' for init script 'stop' action [\#85](https://github.com/voxpupuli/puppet-consul/issues/85) +- Cycling dependancy in Hiera-based config [\#81](https://github.com/voxpupuli/puppet-consul/issues/81) +- Support for Consul 0.5.0 and multiple check configuration [\#73](https://github.com/voxpupuli/puppet-consul/issues/73) +- Path to /home/kyle is hard coded, somewhere [\#65](https://github.com/voxpupuli/puppet-consul/issues/65) + +**Merged pull requests:** + +- Debian 8.0+ uses systemd [\#113](https://github.com/voxpupuli/puppet-consul/pull/113) ([CyBeRoni](https://github.com/CyBeRoni)) +- Update README, ensure passingonly is a bool [\#112](https://github.com/voxpupuli/puppet-consul/pull/112) ([zxjinn](https://github.com/zxjinn)) +- Update puppetlabs-stdlib dependency to 4.2.0 for the delete\_undef\_values function [\#111](https://github.com/voxpupuli/puppet-consul/pull/111) ([zxjinn](https://github.com/zxjinn)) +- Revert "Allow setting of the umask for the consul daemon." [\#108](https://github.com/voxpupuli/puppet-consul/pull/108) ([sjoeboo](https://github.com/sjoeboo)) +- Allow setting of the umask for the consul daemon. [\#106](https://github.com/voxpupuli/puppet-consul/pull/106) ([EvanKrall](https://github.com/EvanKrall)) +- Respect user and group in launchd. [\#105](https://github.com/voxpupuli/puppet-consul/pull/105) ([EvanKrall](https://github.com/EvanKrall)) +- Anchor the consul install/config/run\_service classes [\#102](https://github.com/voxpupuli/puppet-consul/pull/102) ([koendc](https://github.com/koendc)) +- Added support for consul 0.5.0 features: [\#99](https://github.com/voxpupuli/puppet-consul/pull/99) ([hopperd](https://github.com/hopperd)) +- make module work with future parser [\#92](https://github.com/voxpupuli/puppet-consul/pull/92) ([duritong](https://github.com/duritong)) +- Add consul\_acl type and provider [\#91](https://github.com/voxpupuli/puppet-consul/pull/91) ([michaeltchapman](https://github.com/michaeltchapman)) +- Consul expects prefix rather than keyprefix in watch config [\#89](https://github.com/voxpupuli/puppet-consul/pull/89) ([codesplicer](https://github.com/codesplicer)) +- Expose id parameter for service definitions [\#88](https://github.com/voxpupuli/puppet-consul/pull/88) ([codesplicer](https://github.com/codesplicer)) +- sysv & debian init updates to kill or leave [\#87](https://github.com/voxpupuli/puppet-consul/pull/87) ([runswithd6s](https://github.com/runswithd6s)) +- Updated the params for OracleLinux Support [\#84](https://github.com/voxpupuli/puppet-consul/pull/84) ([MarsuperMammal](https://github.com/MarsuperMammal)) +- Fixes \#81 bugfix cycle dependency when specifying a service [\#82](https://github.com/voxpupuli/puppet-consul/pull/82) ([tayzlor](https://github.com/tayzlor)) +- Added compatibility for Scientific Linux [\#78](https://github.com/voxpupuli/puppet-consul/pull/78) ([tracyde](https://github.com/tracyde)) +- More lint fixes [\#77](https://github.com/voxpupuli/puppet-consul/pull/77) ([solarkennedy](https://github.com/solarkennedy)) +- Support for Amazon OS [\#68](https://github.com/voxpupuli/puppet-consul/pull/68) ([dcoxall](https://github.com/dcoxall)) + +## [v0.4.6](https://github.com/voxpupuli/puppet-consul/tree/v0.4.6) (2015-01-23) + +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v0.4.5...v0.4.6) **Closed issues:** -- Consul init scripts sometimes not installed in the correct order [\#74](https://github.com/solarkennedy/puppet-consul/issues/74) +- Consul init scripts sometimes not installed in the correct order [\#74](https://github.com/voxpupuli/puppet-consul/issues/74) **Merged pull requests:** -- Move init script to config.pp to ensure it gets set AFTER the package gets installed [\#75](https://github.com/solarkennedy/puppet-consul/pull/75) ([tayzlor](https://github.com/tayzlor)) -- Add support for providing watches/checks/services via hiera [\#72](https://github.com/solarkennedy/puppet-consul/pull/72) ([tayzlor](https://github.com/tayzlor)) -- Fix Puppet 3.7.3 giving evaluation error in run\_service.pp [\#71](https://github.com/solarkennedy/puppet-consul/pull/71) ([tayzlor](https://github.com/tayzlor)) -- Update install.pp [\#69](https://github.com/solarkennedy/puppet-consul/pull/69) ([ianlunam](https://github.com/ianlunam)) -- Adding ability to disable managing of the service [\#67](https://github.com/solarkennedy/puppet-consul/pull/67) ([sedan07](https://github.com/sedan07)) -- Some linting fixes and resolves joining wan not actually joining the wan [\#66](https://github.com/solarkennedy/puppet-consul/pull/66) ([justicel](https://github.com/justicel)) -- Better OS support for init\_style [\#63](https://github.com/solarkennedy/puppet-consul/pull/63) ([nukemberg](https://github.com/nukemberg)) +- Move init script to config.pp to ensure it gets set AFTER the package gets installed [\#75](https://github.com/voxpupuli/puppet-consul/pull/75) ([tayzlor](https://github.com/tayzlor)) +- Add support for providing watches/checks/services via hiera [\#72](https://github.com/voxpupuli/puppet-consul/pull/72) ([tayzlor](https://github.com/tayzlor)) +- Fix Puppet 3.7.3 giving evaluation error in run\_service.pp [\#71](https://github.com/voxpupuli/puppet-consul/pull/71) ([tayzlor](https://github.com/tayzlor)) +- Update install.pp [\#69](https://github.com/voxpupuli/puppet-consul/pull/69) ([ianlunam](https://github.com/ianlunam)) +- Adding ability to disable managing of the service [\#67](https://github.com/voxpupuli/puppet-consul/pull/67) ([sedan07](https://github.com/sedan07)) +- Some linting fixes and resolves joining wan not actually joining the wan [\#66](https://github.com/voxpupuli/puppet-consul/pull/66) ([justicel](https://github.com/justicel)) +- Better OS support for init\_style [\#63](https://github.com/voxpupuli/puppet-consul/pull/63) ([nukemberg](https://github.com/nukemberg)) -## [v0.4.5](https://github.com/solarkennedy/puppet-consul/tree/v0.4.5) (2015-01-16) +## [v0.4.5](https://github.com/voxpupuli/puppet-consul/tree/v0.4.5) (2015-01-16) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v0.4.4...v0.4.5) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v0.4.4...v0.4.5) **Merged pull requests:** -- Adding "status" to the debian init script [\#64](https://github.com/solarkennedy/puppet-consul/pull/64) ([paulhamby](https://github.com/paulhamby)) +- Adding "status" to the debian init script [\#64](https://github.com/voxpupuli/puppet-consul/pull/64) ([paulhamby](https://github.com/paulhamby)) -## [v0.4.4](https://github.com/solarkennedy/puppet-consul/tree/v0.4.4) (2015-01-16) +## [v0.4.4](https://github.com/voxpupuli/puppet-consul/tree/v0.4.4) (2015-01-16) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v0.4.2...v0.4.4) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v0.4.2...v0.4.4) **Closed issues:** -- Allow Consul clients to join cluster [\#61](https://github.com/solarkennedy/puppet-consul/issues/61) -- new function sorted\_json does not work if keys are set to undef [\#59](https://github.com/solarkennedy/puppet-consul/issues/59) -- Bump to hashicorp/consul GitHub version e9615c50e6 [\#58](https://github.com/solarkennedy/puppet-consul/issues/58) -- cannot generate right retry\_join string [\#57](https://github.com/solarkennedy/puppet-consul/issues/57) -- join\_cluster not working on agents [\#56](https://github.com/solarkennedy/puppet-consul/issues/56) -- Multiple consul::service with same name causes ArgumentError [\#46](https://github.com/solarkennedy/puppet-consul/issues/46) -- service definition file will be changed frequently [\#45](https://github.com/solarkennedy/puppet-consul/issues/45) -- cut a new release? [\#41](https://github.com/solarkennedy/puppet-consul/issues/41) -- join\_cluster doesn't seem to work in some cases [\#31](https://github.com/solarkennedy/puppet-consul/issues/31) -- Tests need ruby \>= 1.9.2 [\#7](https://github.com/solarkennedy/puppet-consul/issues/7) +- Allow Consul clients to join cluster [\#61](https://github.com/voxpupuli/puppet-consul/issues/61) +- new function sorted\_json does not work if keys are set to undef [\#59](https://github.com/voxpupuli/puppet-consul/issues/59) +- Bump to hashicorp/consul GitHub version e9615c50e6 [\#58](https://github.com/voxpupuli/puppet-consul/issues/58) +- cannot generate right retry\_join string [\#57](https://github.com/voxpupuli/puppet-consul/issues/57) +- join\_cluster not working on agents [\#56](https://github.com/voxpupuli/puppet-consul/issues/56) +- Multiple consul::service with same name causes ArgumentError [\#46](https://github.com/voxpupuli/puppet-consul/issues/46) +- service definition file will be changed frequently [\#45](https://github.com/voxpupuli/puppet-consul/issues/45) +- cut a new release? [\#41](https://github.com/voxpupuli/puppet-consul/issues/41) +- join\_cluster doesn't seem to work in some cases [\#31](https://github.com/voxpupuli/puppet-consul/issues/31) +- Tests need ruby \>= 1.9.2 [\#7](https://github.com/voxpupuli/puppet-consul/issues/7) **Merged pull requests:** -- Allow hash keys to be set to undef [\#60](https://github.com/solarkennedy/puppet-consul/pull/60) ([bodepd](https://github.com/bodepd)) -- Add config\_defaults hash parameter [\#54](https://github.com/solarkennedy/puppet-consul/pull/54) ([michaeltchapman](https://github.com/michaeltchapman)) -- Make init\_style can be disabled [\#53](https://github.com/solarkennedy/puppet-consul/pull/53) ([tiewei](https://github.com/tiewei)) -- Make rake spec running [\#52](https://github.com/solarkennedy/puppet-consul/pull/52) ([tiewei](https://github.com/tiewei)) -- use versioncmp to compare versions [\#49](https://github.com/solarkennedy/puppet-consul/pull/49) ([jfroche](https://github.com/jfroche)) -- Allow overriding a service's name [\#47](https://github.com/solarkennedy/puppet-consul/pull/47) ([jsok](https://github.com/jsok)) -- Make puppet-consul install on OS X [\#44](https://github.com/solarkennedy/puppet-consul/pull/44) ([EvanKrall](https://github.com/EvanKrall)) +- Allow hash keys to be set to undef [\#60](https://github.com/voxpupuli/puppet-consul/pull/60) ([bodepd](https://github.com/bodepd)) +- Add config\_defaults hash parameter [\#54](https://github.com/voxpupuli/puppet-consul/pull/54) ([michaeltchapman](https://github.com/michaeltchapman)) +- Make init\_style can be disabled [\#53](https://github.com/voxpupuli/puppet-consul/pull/53) ([tiewei](https://github.com/tiewei)) +- Make rake spec running [\#52](https://github.com/voxpupuli/puppet-consul/pull/52) ([tiewei](https://github.com/tiewei)) +- use versioncmp to compare versions [\#49](https://github.com/voxpupuli/puppet-consul/pull/49) ([jfroche](https://github.com/jfroche)) +- Allow overriding a service's name [\#47](https://github.com/voxpupuli/puppet-consul/pull/47) ([jsok](https://github.com/jsok)) +- Make puppet-consul install on OS X [\#44](https://github.com/voxpupuli/puppet-consul/pull/44) ([EvanKrall](https://github.com/EvanKrall)) -## [v0.4.2](https://github.com/solarkennedy/puppet-consul/tree/v0.4.2) (2014-10-28) +## [v0.4.2](https://github.com/voxpupuli/puppet-consul/tree/v0.4.2) (2014-10-28) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v0.4.1...v0.4.2) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v0.4.1...v0.4.2) -## [v0.4.1](https://github.com/solarkennedy/puppet-consul/tree/v0.4.1) (2014-10-28) +## [v0.4.1](https://github.com/voxpupuli/puppet-consul/tree/v0.4.1) (2014-10-28) -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/v0.3.0...v0.4.1) +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/v0.3.0...v0.4.1) **Closed issues:** -- Add support for joining multiple datacenters [\#34](https://github.com/solarkennedy/puppet-consul/issues/34) -- Configuring consul client nodes [\#26](https://github.com/solarkennedy/puppet-consul/issues/26) -- Add support for the new "watch" resource exposed in Consul 0.4.0 [\#23](https://github.com/solarkennedy/puppet-consul/issues/23) -- Install ui broken ? [\#19](https://github.com/solarkennedy/puppet-consul/issues/19) - -**Merged pull requests:** - -- Set default of GOMAXPROCS=2 for SLES [\#40](https://github.com/solarkennedy/puppet-consul/pull/40) ([tehranian](https://github.com/tehranian)) -- Fix the GOMAXPROCS warning for Upstart-based systems [\#39](https://github.com/solarkennedy/puppet-consul/pull/39) ([tehranian](https://github.com/tehranian)) -- bump to version 0.4.1 [\#38](https://github.com/solarkennedy/puppet-consul/pull/38) ([kennyg](https://github.com/kennyg)) -- Add sysconfig support for sysv [\#37](https://github.com/solarkennedy/puppet-consul/pull/37) ([dblessing](https://github.com/dblessing)) -- Add join\_wan feature [\#35](https://github.com/solarkennedy/puppet-consul/pull/35) ([dblessing](https://github.com/dblessing)) -- Version bump; Download Consul 0.4.0 [\#33](https://github.com/solarkennedy/puppet-consul/pull/33) ([tehranian](https://github.com/tehranian)) -- Add support for SLES [\#32](https://github.com/solarkennedy/puppet-consul/pull/32) ([tehranian](https://github.com/tehranian)) -- Add option to purge config dir [\#30](https://github.com/solarkennedy/puppet-consul/pull/30) ([sorenisanerd](https://github.com/sorenisanerd)) -- Changed cluster join code [\#29](https://github.com/solarkennedy/puppet-consul/pull/29) ([hkumarmk](https://github.com/hkumarmk)) -- \(retry\) Service Definition documentation and fix [\#28](https://github.com/solarkennedy/puppet-consul/pull/28) ([benschw](https://github.com/benschw)) -- Adding in explicit support for "watches" [\#24](https://github.com/solarkennedy/puppet-consul/pull/24) ([jrnt30](https://github.com/jrnt30)) -- Added join\_cluster param to have consul join a cluster after \(re\)starting service [\#21](https://github.com/solarkennedy/puppet-consul/pull/21) ([tylerwalts](https://github.com/tylerwalts)) -- Fixing gui\_package install [\#20](https://github.com/solarkennedy/puppet-consul/pull/20) ([KrisBuytaert](https://github.com/KrisBuytaert)) -- Added upstart link for old init.d functionality on upstart jobs [\#18](https://github.com/solarkennedy/puppet-consul/pull/18) ([lynxman](https://github.com/lynxman)) -- bump to version 0.3.1 [\#17](https://github.com/solarkennedy/puppet-consul/pull/17) ([kennyg](https://github.com/kennyg)) -- Install the consul web ui [\#15](https://github.com/solarkennedy/puppet-consul/pull/15) ([croomes](https://github.com/croomes)) -- Adds systemd support [\#14](https://github.com/solarkennedy/puppet-consul/pull/14) ([croomes](https://github.com/croomes)) -- Update CONTRIBUTORS [\#12](https://github.com/solarkennedy/puppet-consul/pull/12) ([kennyg](https://github.com/kennyg)) -- bumped to version 0.3.0 [\#11](https://github.com/solarkennedy/puppet-consul/pull/11) ([kennyg](https://github.com/kennyg)) - -## [v0.3.0](https://github.com/solarkennedy/puppet-consul/tree/v0.3.0) (2014-06-20) - -[Full Changelog](https://github.com/solarkennedy/puppet-consul/compare/31fcf01beb754dfa7884ff34eea1313f71593b26...v0.3.0) +- Add support for joining multiple datacenters [\#34](https://github.com/voxpupuli/puppet-consul/issues/34) +- Configuring consul client nodes [\#26](https://github.com/voxpupuli/puppet-consul/issues/26) +- Add support for the new "watch" resource exposed in Consul 0.4.0 [\#23](https://github.com/voxpupuli/puppet-consul/issues/23) +- Install ui broken ? [\#19](https://github.com/voxpupuli/puppet-consul/issues/19) + +**Merged pull requests:** + +- Set default of GOMAXPROCS=2 for SLES [\#40](https://github.com/voxpupuli/puppet-consul/pull/40) ([tehranian](https://github.com/tehranian)) +- Fix the GOMAXPROCS warning for Upstart-based systems [\#39](https://github.com/voxpupuli/puppet-consul/pull/39) ([tehranian](https://github.com/tehranian)) +- bump to version 0.4.1 [\#38](https://github.com/voxpupuli/puppet-consul/pull/38) ([kennyg](https://github.com/kennyg)) +- Add sysconfig support for sysv [\#37](https://github.com/voxpupuli/puppet-consul/pull/37) ([dblessing](https://github.com/dblessing)) +- Add join\_wan feature [\#35](https://github.com/voxpupuli/puppet-consul/pull/35) ([dblessing](https://github.com/dblessing)) +- Version bump; Download Consul 0.4.0 [\#33](https://github.com/voxpupuli/puppet-consul/pull/33) ([tehranian](https://github.com/tehranian)) +- Add support for SLES [\#32](https://github.com/voxpupuli/puppet-consul/pull/32) ([tehranian](https://github.com/tehranian)) +- Add option to purge config dir [\#30](https://github.com/voxpupuli/puppet-consul/pull/30) ([sorenisanerd](https://github.com/sorenisanerd)) +- Changed cluster join code [\#29](https://github.com/voxpupuli/puppet-consul/pull/29) ([hkumarmk](https://github.com/hkumarmk)) +- \(retry\) Service Definition documentation and fix [\#28](https://github.com/voxpupuli/puppet-consul/pull/28) ([benschw](https://github.com/benschw)) +- Adding in explicit support for "watches" [\#24](https://github.com/voxpupuli/puppet-consul/pull/24) ([jrnt30](https://github.com/jrnt30)) +- Added join\_cluster param to have consul join a cluster after \(re\)starting service [\#21](https://github.com/voxpupuli/puppet-consul/pull/21) ([tylerwalts](https://github.com/tylerwalts)) +- Fixing gui\_package install [\#20](https://github.com/voxpupuli/puppet-consul/pull/20) ([KrisBuytaert](https://github.com/KrisBuytaert)) +- Added upstart link for old init.d functionality on upstart jobs [\#18](https://github.com/voxpupuli/puppet-consul/pull/18) ([lynxman](https://github.com/lynxman)) +- bump to version 0.3.1 [\#17](https://github.com/voxpupuli/puppet-consul/pull/17) ([kennyg](https://github.com/kennyg)) +- Install the consul web ui [\#15](https://github.com/voxpupuli/puppet-consul/pull/15) ([croomes](https://github.com/croomes)) +- Adds systemd support [\#14](https://github.com/voxpupuli/puppet-consul/pull/14) ([croomes](https://github.com/croomes)) +- Update CONTRIBUTORS [\#12](https://github.com/voxpupuli/puppet-consul/pull/12) ([kennyg](https://github.com/kennyg)) +- bumped to version 0.3.0 [\#11](https://github.com/voxpupuli/puppet-consul/pull/11) ([kennyg](https://github.com/kennyg)) + +## [v0.3.0](https://github.com/voxpupuli/puppet-consul/tree/v0.3.0) (2014-06-20) + +[Full Changelog](https://github.com/voxpupuli/puppet-consul/compare/31fcf01beb754dfa7884ff34eea1313f71593b26...v0.3.0) **Closed issues:** -- Upstart script does not work on Lucid [\#5](https://github.com/solarkennedy/puppet-consul/issues/5) -- Debian support [\#1](https://github.com/solarkennedy/puppet-consul/issues/1) +- Upstart script does not work on Lucid [\#5](https://github.com/voxpupuli/puppet-consul/issues/5) +- Debian support [\#1](https://github.com/voxpupuli/puppet-consul/issues/1) **Merged pull requests:** -- Add extra\_options parameter, to allow extra arguments to the consul agent [\#9](https://github.com/solarkennedy/puppet-consul/pull/9) ([EvanKrall](https://github.com/EvanKrall)) -- Define consul::service and consul::check types [\#8](https://github.com/solarkennedy/puppet-consul/pull/8) ([EvanKrall](https://github.com/EvanKrall)) -- Convert from setuid/setgid to sudo for Lucid support. Allow for group management. [\#6](https://github.com/solarkennedy/puppet-consul/pull/6) ([EvanKrall](https://github.com/EvanKrall)) -- Make download actually work [\#3](https://github.com/solarkennedy/puppet-consul/pull/3) ([nberlee](https://github.com/nberlee)) -- Make example config parseable [\#2](https://github.com/solarkennedy/puppet-consul/pull/2) ([nberlee](https://github.com/nberlee)) +- Add extra\_options parameter, to allow extra arguments to the consul agent [\#9](https://github.com/voxpupuli/puppet-consul/pull/9) ([EvanKrall](https://github.com/EvanKrall)) +- Define consul::service and consul::check types [\#8](https://github.com/voxpupuli/puppet-consul/pull/8) ([EvanKrall](https://github.com/EvanKrall)) +- Convert from setuid/setgid to sudo for Lucid support. Allow for group management. [\#6](https://github.com/voxpupuli/puppet-consul/pull/6) ([EvanKrall](https://github.com/EvanKrall)) +- Make download actually work [\#3](https://github.com/voxpupuli/puppet-consul/pull/3) ([nberlee](https://github.com/nberlee)) +- Make example config parseable [\#2](https://github.com/voxpupuli/puppet-consul/pull/2) ([nberlee](https://github.com/nberlee)) diff --git a/metadata.json b/metadata.json index 0529746a..5c31fb55 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-consul", - "version": "7.0.2", + "version": "7.1.0", "author": "Vox Pupuli", "summary": "Configures Consul by Hashicorp", "license": "Apache-2.0", From af70770bdfc5f3c674aa7ce0527e701bf68b6408 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 20 Apr 2022 16:44:02 +0200 Subject: [PATCH 16/19] [blacksmith] Bump version to 7.1.1-rc0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 5c31fb55..3eb18c33 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-consul", - "version": "7.1.0", + "version": "7.1.1-rc0", "author": "Vox Pupuli", "summary": "Configures Consul by Hashicorp", "license": "Apache-2.0", From 5b4de2bf567dc54bd147c92197fad91e7c698e50 Mon Sep 17 00:00:00 2001 From: Robert Hecht Date: Wed, 4 May 2022 12:58:47 +0200 Subject: [PATCH 17/19] support NodeMeta and ServiceMeta filters on Prepared Queries --- README.md | 2 ++ .../provider/consul_prepared_query/default.rb | 4 ++++ lib/puppet/type/consul_prepared_query.rb | 14 ++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/README.md b/README.md index fc159458..e3405016 100644 --- a/README.md +++ b/README.md @@ -349,6 +349,7 @@ consul_prepared_query { 'consul': service_failover_dcs => [ 'dc1', 'dc2' ], service_only_passing => true, service_tags => [ 'tag1', 'tag2' ], + service_meta => { 'version' => '1.2.3' }, ttl => 10, } ``` @@ -364,6 +365,7 @@ consul_prepared_query { 'consul': service_failover_dcs => [ 'dc1', 'dc2' ], service_only_passing => true, service_tags => [ '${match(2)}' ], # lint:ignore:single_quote_string_with_variables + node_meta => { 'is_virtual' => 'false' }, template => true, template_regexp => '^consul-(.*)-(.*)$', template_type => 'name_prefix_match', diff --git a/lib/puppet/provider/consul_prepared_query/default.rb b/lib/puppet/provider/consul_prepared_query/default.rb index 81945c0e..9164553b 100644 --- a/lib/puppet/provider/consul_prepared_query/default.rb +++ b/lib/puppet/provider/consul_prepared_query/default.rb @@ -146,6 +146,8 @@ def flush service_failover_dcs = @resource[:service_failover_dcs] service_only_passing = @resource[:service_only_passing] service_tags = @resource[:service_tags] + node_meta = @resource[:node_meta] + service_meta = @resource[:service_meta] ttl = @resource[:ttl] port = @resource[:port] hostname = @resource[:hostname] @@ -167,6 +169,8 @@ def flush }, 'OnlyPassing' => service_only_passing, 'Tags' => service_tags, + 'NodeMeta' => node_meta, + 'ServiceMeta' => service_meta }, 'DNS' => { 'TTL' => "#{ttl}s" diff --git a/lib/puppet/type/consul_prepared_query.rb b/lib/puppet/type/consul_prepared_query.rb index 7aeb495c..b6012833 100644 --- a/lib/puppet/type/consul_prepared_query.rb +++ b/lib/puppet/type/consul_prepared_query.rb @@ -138,4 +138,18 @@ raise ArgumentError, 'The template type must be a string' unless value.is_a?(String) end end + + newparam(:node_meta) do + desc 'List of user-defined key/value pairs to filter on NodeMeta' + validate do |value| + raise ArgumentError, 'NodeMeta type must be a hash' unless value.is_a?(Hash) + end + end + + newparam(:service_meta) do + desc 'List of user-defined key/value pairs to filter on ServiceMeta' + validate do |value| + raise ArgumentError, 'ServiceMeta type must be a hash' unless value.is_a?(Hash) + end + end end From 8ad3eb9aa128db3eedeec12d45d622a2e268e58b Mon Sep 17 00:00:00 2001 From: Tino Mueller Date: Tue, 3 May 2022 17:38:27 +0200 Subject: [PATCH 18/19] add unit tests for service_meta and node_meta --- .../puppet/type/consul_prepared_query_spec.rb | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/spec/unit/puppet/type/consul_prepared_query_spec.rb b/spec/unit/puppet/type/consul_prepared_query_spec.rb index 525b4bcf..f51d4973 100644 --- a/spec/unit/puppet/type/consul_prepared_query_spec.rb +++ b/spec/unit/puppet/type/consul_prepared_query_spec.rb @@ -7,6 +7,24 @@ end.to raise_error(Puppet::Error, %r{Title or name must be provided}) end + it 'fails if node_meta is not a hash' do + expect do + Puppet::Type.type(:consul_prepared_query).new( + name: 'testing', + node_meta: 'test' + ) + end.to raise_error(Puppet::Error, %r{NodeMeta type must be a hash}) + end + + it 'fails if service_meta is not a hash' do + expect do + Puppet::Type.type(:consul_prepared_query).new( + name: 'testing', + service_meta: 'test' + ) + end.to raise_error(Puppet::Error, %r{ServiceMeta type must be a hash}) + end + context 'with query parameters provided' do before do @prepared_query = Puppet::Type.type(:consul_prepared_query).new( @@ -17,7 +35,9 @@ service_failover_dcs: %w[dc1 dc2], service_tags: %w[tag1 tag2], service_only_passing: true, - ttl: 10 + ttl: 10, + node_meta: { 'is_virtual' => 'false' }, + service_meta: { 'version' => '1.2.3' } ) end @@ -28,5 +48,13 @@ it 'defaults to http' do expect(@prepared_query[:protocol]).to eq(:http) end + + it 'returns node_meta hash' do + expect(@prepared_query[:node_meta]).to eq({ 'is_virtual' => 'false' }) + end + + it 'returns service_meta hash' do + expect(@prepared_query[:service_meta]).to eq({ 'version' => '1.2.3' }) + end end end From b5c69022079e4d03667034c5cebbe418466b009e Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 22 Aug 2022 09:53:51 +0200 Subject: [PATCH 19/19] modulesync 5.3.0 --- .msync.yml | 2 +- .rubocop.yml | 3 +-- Gemfile | 2 +- spec/spec_helper.rb | 4 +++- spec/spec_helper_local.rb | 1 + 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.msync.yml b/.msync.yml index 968a9367..02353859 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '5.2.0' +modulesync_config_version: '5.3.0' diff --git a/.rubocop.yml b/.rubocop.yml index ea22bff8..fded90cf 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,8 +1,7 @@ --- -inherit_from: .rubocop_todo.yml - # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ +inherit_from: .rubocop_todo.yml inherit_gem: voxpupuli-test: rubocop.yml diff --git a/Gemfile b/Gemfile index 7ef4da21..b4fab0ad 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 5.0', :require => false + gem 'voxpupuli-test', '~> 5.4', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false gem 'puppet_metadata', '~> 1.0', :require => false diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d28a15c2..0c667ff9 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -8,7 +8,9 @@ ENV['COVERAGE'] ||= 'yes' if Dir.exist?(File.expand_path('../lib', __dir__)) require 'voxpupuli/test/spec_helper' -require 'webmock' + +add_mocked_facts! + if File.exist?(File.join(__dir__, 'default_module_facts.yml')) facts = YAML.safe_load(File.read(File.join(__dir__, 'default_module_facts.yml'))) facts&.each do |name, value| diff --git a/spec/spec_helper_local.rb b/spec/spec_helper_local.rb index 1c992bb4..d6dc0086 100644 --- a/spec/spec_helper_local.rb +++ b/spec/spec_helper_local.rb @@ -1,2 +1,3 @@ +require 'webmock' require 'webmock/rspec' WebMock.disable_net_connect!