Update rabbitmq module
authorJulien Cristau <jcristau@debian.org>
Tue, 20 Nov 2018 22:08:19 +0000 (23:08 +0100)
committerJulien Cristau <jcristau@debian.org>
Tue, 20 Nov 2018 22:08:19 +0000 (23:08 +0100)
155 files changed:
3rdparty/Puppetfile
3rdparty/modules/rabbitmq/CHANGELOG.md
3rdparty/modules/rabbitmq/CONTRIBUTING.md [deleted file]
3rdparty/modules/rabbitmq/Gemfile
3rdparty/modules/rabbitmq/HISTORY.md [new file with mode: 0644]
3rdparty/modules/rabbitmq/LICENSE
3rdparty/modules/rabbitmq/MAINTAINERS.md [new file with mode: 0644]
3rdparty/modules/rabbitmq/NOTICE [new file with mode: 0644]
3rdparty/modules/rabbitmq/README.md
3rdparty/modules/rabbitmq/Rakefile
3rdparty/modules/rabbitmq/TODO [deleted file]
3rdparty/modules/rabbitmq/checksums.json
3rdparty/modules/rabbitmq/examples/erlang_deps.pp [new file with mode: 0644]
3rdparty/modules/rabbitmq/examples/full.pp [new file with mode: 0644]
3rdparty/modules/rabbitmq/examples/permissions/add.pp [new file with mode: 0644]
3rdparty/modules/rabbitmq/examples/plugin.pp [new file with mode: 0644]
3rdparty/modules/rabbitmq/examples/repo/apt.pp [new file with mode: 0644]
3rdparty/modules/rabbitmq/examples/server.pp [new file with mode: 0644]
3rdparty/modules/rabbitmq/examples/service.pp [new file with mode: 0644]
3rdparty/modules/rabbitmq/examples/site.pp [new file with mode: 0644]
3rdparty/modules/rabbitmq/examples/user/add.pp [new file with mode: 0644]
3rdparty/modules/rabbitmq/examples/vhosts/add.pp [new file with mode: 0644]
3rdparty/modules/rabbitmq/lib/facter/erl_ssl_path.rb [new file with mode: 0644]
3rdparty/modules/rabbitmq/lib/facter/rabbitmq_nodename.rb [new file with mode: 0644]
3rdparty/modules/rabbitmq/lib/facter/rabbitmq_version.rb [new file with mode: 0644]
3rdparty/modules/rabbitmq/lib/puppet/provider/rabbitmq_binding/rabbitmqadmin.rb
3rdparty/modules/rabbitmq/lib/puppet/provider/rabbitmq_erlang_cookie/ruby.rb
3rdparty/modules/rabbitmq/lib/puppet/provider/rabbitmq_exchange/rabbitmqadmin.rb
3rdparty/modules/rabbitmq/lib/puppet/provider/rabbitmq_parameter/rabbitmqctl.rb [new file with mode: 0644]
3rdparty/modules/rabbitmq/lib/puppet/provider/rabbitmq_plugin/rabbitmqplugins.rb
3rdparty/modules/rabbitmq/lib/puppet/provider/rabbitmq_policy/rabbitmqctl.rb
3rdparty/modules/rabbitmq/lib/puppet/provider/rabbitmq_queue/rabbitmqadmin.rb
3rdparty/modules/rabbitmq/lib/puppet/provider/rabbitmq_user/rabbitmqctl.rb
3rdparty/modules/rabbitmq/lib/puppet/provider/rabbitmq_user_permissions/rabbitmqctl.rb
3rdparty/modules/rabbitmq/lib/puppet/provider/rabbitmq_vhost/rabbitmqctl.rb
3rdparty/modules/rabbitmq/lib/puppet/provider/rabbitmqctl.rb
3rdparty/modules/rabbitmq/lib/puppet/type/rabbitmq_binding.rb
3rdparty/modules/rabbitmq/lib/puppet/type/rabbitmq_erlang_cookie.rb
3rdparty/modules/rabbitmq/lib/puppet/type/rabbitmq_exchange.rb
3rdparty/modules/rabbitmq/lib/puppet/type/rabbitmq_parameter.rb [new file with mode: 0644]
3rdparty/modules/rabbitmq/lib/puppet/type/rabbitmq_plugin.rb
3rdparty/modules/rabbitmq/lib/puppet/type/rabbitmq_policy.rb
3rdparty/modules/rabbitmq/lib/puppet/type/rabbitmq_queue.rb
3rdparty/modules/rabbitmq/lib/puppet/type/rabbitmq_user.rb
3rdparty/modules/rabbitmq/lib/puppet/type/rabbitmq_user_permissions.rb
3rdparty/modules/rabbitmq/lib/puppet/type/rabbitmq_vhost.rb
3rdparty/modules/rabbitmq/locales/config.yaml [new file with mode: 0644]
3rdparty/modules/rabbitmq/log/centos-6-x64-vcloud/2015-05-22_18_55_23/sut.log [deleted file]
3rdparty/modules/rabbitmq/log/centos-6-x64-vcloud/2015-05-22_18_57_07/sut.log [deleted file]
3rdparty/modules/rabbitmq/log/debian-7-x64-vcloud/2015-05-22_18_35_45/sut.log [deleted file]
3rdparty/modules/rabbitmq/log/debian-7-x64-vcloud/2015-05-22_18_49_58/sut.log [deleted file]
3rdparty/modules/rabbitmq/log/debian-7-x64-vcloud/2015-05-22_19_10_48/sut.log [deleted file]
3rdparty/modules/rabbitmq/log/debian-7-x64-vcloud/2015-05-22_19_11_31/sut.log [deleted file]
3rdparty/modules/rabbitmq/log/default/2015-05-22_18_35_28/sut.log [deleted file]
3rdparty/modules/rabbitmq/manifests/config.pp
3rdparty/modules/rabbitmq/manifests/init.pp
3rdparty/modules/rabbitmq/manifests/install.pp
3rdparty/modules/rabbitmq/manifests/install/rabbitmqadmin.pp
3rdparty/modules/rabbitmq/manifests/params.pp
3rdparty/modules/rabbitmq/manifests/repo/apt.pp
3rdparty/modules/rabbitmq/manifests/repo/rhel.pp
3rdparty/modules/rabbitmq/manifests/server.pp
3rdparty/modules/rabbitmq/manifests/service.pp
3rdparty/modules/rabbitmq/metadata.json
3rdparty/modules/rabbitmq/spec/acceptance/class_spec.rb
3rdparty/modules/rabbitmq/spec/acceptance/clustering_spec.rb
3rdparty/modules/rabbitmq/spec/acceptance/delete_guest_user_spec.rb
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/archlinux-2-x64.yml [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/centos-511-x64.yml [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/centos-59-x64.yml [deleted file]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/centos-6-x64-vcloud.yml [deleted file]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/centos-6-x64.yml [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/centos-64-x64-pe.yml [deleted file]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/centos-65-x64.yml [deleted file]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/centos-66-x64-pe.yml [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/centos-7-x64.yml [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/debian-7-x64-vcloud.yml [deleted file]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/debian-78-x64.yml [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/debian-8-x64.yml [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/debian-82-x64.yml [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/default.yml
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/docker/centos-5.yml [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/docker/centos-6.yml [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/docker/centos-7.yml [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/docker/debian-7.yml [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/docker/debian-8.yml [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/docker/debian-9.yml [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/docker/ubuntu-12.04.yml [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/docker/ubuntu-14.04.yml [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/docker/ubuntu-16.04.yml [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/ec2/image_templates.yaml [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/ec2/rhel-73-x64.yml [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/fedora-24-x64.yml [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/fedora-25-x64.yml [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/fedora-26-x64.yml [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/fedora-27-x64.yml [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml [deleted file]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml [deleted file]
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml
3rdparty/modules/rabbitmq/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/acceptance/parameter_spec.rb [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/acceptance/policy_spec.rb
3rdparty/modules/rabbitmq/spec/acceptance/queue_spec.rb
3rdparty/modules/rabbitmq/spec/acceptance/rabbitmqadmin_spec.rb
3rdparty/modules/rabbitmq/spec/acceptance/server_spec.rb
3rdparty/modules/rabbitmq/spec/acceptance/user_spec.rb
3rdparty/modules/rabbitmq/spec/acceptance/vhost_spec.rb
3rdparty/modules/rabbitmq/spec/acceptance/zz281_spec.rb [deleted file]
3rdparty/modules/rabbitmq/spec/classes/coverage_spec.rb [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/classes/rabbitmq_spec.rb
3rdparty/modules/rabbitmq/spec/default_facts.yml [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/spec.opts [deleted file]
3rdparty/modules/rabbitmq/spec/spec_helper.rb
3rdparty/modules/rabbitmq/spec/spec_helper_acceptance.rb
3rdparty/modules/rabbitmq/spec/spec_helper_local.rb [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/unit/facter/util/fact_erl_ssl_path_spec.rb [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/unit/facter/util/fact_rabbitmq_nodename_spec.rb [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/unit/facter/util/fact_rabbitmq_version_spec.rb [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/unit/puppet/provider/rabbitmq_binding/rabbitmqadmin_spec.rb
3rdparty/modules/rabbitmq/spec/unit/puppet/provider/rabbitmq_exchange/rabbitmqadmin_spec.rb
3rdparty/modules/rabbitmq/spec/unit/puppet/provider/rabbitmq_parameter/rabbitmqctl_spec.rb [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/unit/puppet/provider/rabbitmq_plugin/rabbitmqctl_spec.rb
3rdparty/modules/rabbitmq/spec/unit/puppet/provider/rabbitmq_policy/rabbitmqctl_spec.rb
3rdparty/modules/rabbitmq/spec/unit/puppet/provider/rabbitmq_queue/rabbitmqadmin_spec.rb
3rdparty/modules/rabbitmq/spec/unit/puppet/provider/rabbitmq_user/rabbitmqctl_spec.rb
3rdparty/modules/rabbitmq/spec/unit/puppet/provider/rabbitmq_user_permissions/rabbitmqctl_spec.rb
3rdparty/modules/rabbitmq/spec/unit/puppet/provider/rabbitmq_vhost/rabbitmqctl_spec.rb
3rdparty/modules/rabbitmq/spec/unit/puppet/type/rabbitmq_binding_spec.rb
3rdparty/modules/rabbitmq/spec/unit/puppet/type/rabbitmq_exchange_spec.rb
3rdparty/modules/rabbitmq/spec/unit/puppet/type/rabbitmq_parameter_spec.rb [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/unit/puppet/type/rabbitmq_plugin_spec.rb [new file with mode: 0644]
3rdparty/modules/rabbitmq/spec/unit/puppet/type/rabbitmq_policy_spec.rb
3rdparty/modules/rabbitmq/spec/unit/puppet/type/rabbitmq_queue_spec.rb
3rdparty/modules/rabbitmq/spec/unit/puppet/type/rabbitmq_user_permissions_spec.rb
3rdparty/modules/rabbitmq/spec/unit/puppet/type/rabbitmq_user_spec.rb
3rdparty/modules/rabbitmq/spec/unit/puppet/type/rabbitmq_vhost_spec.rb
3rdparty/modules/rabbitmq/templates/inetrc.erb [new file with mode: 0644]
3rdparty/modules/rabbitmq/templates/rabbitmq-env.conf.erb
3rdparty/modules/rabbitmq/templates/rabbitmq.config.erb
3rdparty/modules/rabbitmq/templates/rabbitmqadmin.conf.erb
3rdparty/modules/rabbitmq/tests/erlang_deps.pp [deleted file]
3rdparty/modules/rabbitmq/tests/full.pp [deleted file]
3rdparty/modules/rabbitmq/tests/permissions/add.pp [deleted file]
3rdparty/modules/rabbitmq/tests/plugin.pp [deleted file]
3rdparty/modules/rabbitmq/tests/repo/apt.pp [deleted file]
3rdparty/modules/rabbitmq/tests/server.pp [deleted file]
3rdparty/modules/rabbitmq/tests/service.pp [deleted file]
3rdparty/modules/rabbitmq/tests/site.pp [deleted file]
3rdparty/modules/rabbitmq/tests/user/add.pp [deleted file]
3rdparty/modules/rabbitmq/tests/vhosts/add.pp [deleted file]

index 2b2612e..53c9f9c 100644 (file)
@@ -2,10 +2,10 @@ forge "http://forge.puppetlabs.com"
 
 mod 'puppetlabs/stdlib', '4.19.0'
 mod 'puppetlabs/concat', '4.0.1'
-mod 'puppetlabs/rabbitmq', '5.2.1'
 mod 'puppetlabs-postgresql', '5.1.0'
 
 mod 'puppet/archive', '2.3.0'
+mod 'puppet/rabbitmq', '8.2.0'
 
 mod 'nanliu/staging', '1.0.3'
 
index 9800626..f325be1 100644 (file)
-## 2015-05-26 - Version 5.2.1
-###Summary
+# Changelog
+
+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.
+
+## [v8.2.0](https://github.com/voxpupuli/puppet-rabbitmq/tree/v8.2.0) (2018-03-24)
+
+[Full Changelog](https://github.com/voxpupuli/puppet-rabbitmq/compare/v8.1.0...v8.2.0)
+
+**Implemented enhancements:**
+
+- Add archive\_options parameter for Archive download of rabbitmqadmin [\#681](https://github.com/voxpupuli/puppet-rabbitmq/pull/681) ([paebersold](https://github.com/paebersold))
+
+**Fixed bugs:**
+
+- puppet package install error when running on SLES 12 [\#684](https://github.com/voxpupuli/puppet-rabbitmq/issues/684)
+- Allow dash as valid character for regex [\#687](https://github.com/voxpupuli/puppet-rabbitmq/pull/687) ([crazymind1337](https://github.com/crazymind1337))
+- Install package via title, not name \(\#684\) [\#686](https://github.com/voxpupuli/puppet-rabbitmq/pull/686) ([wyardley](https://github.com/wyardley))
+
+**Closed issues:**
+
+- Failure to install rabbitmq admin via curl when proxy set [\#663](https://github.com/voxpupuli/puppet-rabbitmq/issues/663)
+
+**Merged pull requests:**
+
+- Fixes for Archlinux and modulesync 1.8 [\#685](https://github.com/voxpupuli/puppet-rabbitmq/pull/685) ([bastelfreak](https://github.com/bastelfreak))
+
+## [v8.1.0](https://github.com/voxpupuli/puppet-rabbitmq/tree/v8.1.0) (2018-01-11)
+
+[Full Changelog](https://github.com/voxpupuli/puppet-rabbitmq/compare/v8.0.0...v8.1.0)
+
+**Implemented enhancements:**
+
+- Add options for ssl verify and 'fail\_if\_no\_peer\_cert' for the managem… [\#657](https://github.com/voxpupuli/puppet-rabbitmq/pull/657) ([paebersold](https://github.com/paebersold))
+- add ability to have array as package name [\#656](https://github.com/voxpupuli/puppet-rabbitmq/pull/656) ([tampakrap](https://github.com/tampakrap))
+
+**Fixed bugs:**
+
+- Support policy format change in v3.7.0 - \#671 \(Replaces \#674\) [\#676](https://github.com/voxpupuli/puppet-rabbitmq/pull/676) ([fatmcgav](https://github.com/fatmcgav))
+- Remove `archive require` in rabbitmqadmin class [\#669](https://github.com/voxpupuli/puppet-rabbitmq/pull/669) ([lzecca78](https://github.com/lzecca78))
+
+**Closed issues:**
+
+- Rabbitmq crashing with config\_ranch = true [\#668](https://github.com/voxpupuli/puppet-rabbitmq/issues/668)
+- puppet/rabbitmq 8.0.0 - /etc/apt/sources.list.d/rabbitmq.list not updated/created [\#662](https://github.com/voxpupuli/puppet-rabbitmq/issues/662)
+- rabbitmqadmin install has no way of continuing to use staging in environments using an incompatible archive module [\#659](https://github.com/voxpupuli/puppet-rabbitmq/issues/659)
+- RabbitMQ Admin Package should work with Puppet-Archive module, or explicitly depend on camptocamp's archive module [\#658](https://github.com/voxpupuli/puppet-rabbitmq/issues/658)
+
+**Merged pull requests:**
+
+- Do not use defaultfor to choose the only existing provider [\#672](https://github.com/voxpupuli/puppet-rabbitmq/pull/672) ([mbaldessari](https://github.com/mbaldessari))
+- regenerate puppet-strings docs [\#667](https://github.com/voxpupuli/puppet-rabbitmq/pull/667) ([bastelfreak](https://github.com/bastelfreak))
+- Remove EOL operatingsystems [\#666](https://github.com/voxpupuli/puppet-rabbitmq/pull/666) ([ekohl](https://github.com/ekohl))
+- Update README to specify voxpupuli/archive dependency vs. staging [\#660](https://github.com/voxpupuli/puppet-rabbitmq/pull/660) ([wyardley](https://github.com/wyardley))
+
+## [v8.0.0](https://github.com/voxpupuli/puppet-rabbitmq/tree/v8.0.0) (2017-10-18)
+
+[Full Changelog](https://github.com/voxpupuli/puppet-rabbitmq/compare/v7.1.0...v8.0.0)
+
+**Breaking changes:**
+
+- BREAKING: Remove deprecated manage\_repos parameter and disallow strings for integer parameters [\#649](https://github.com/voxpupuli/puppet-rabbitmq/pull/649) ([wyardley](https://github.com/wyardley))
+
+**Implemented enhancements:**
+
+- allow installation of rabbitmqadmin via package [\#654](https://github.com/voxpupuli/puppet-rabbitmq/pull/654) ([bastelfreak](https://github.com/bastelfreak))
+
+**Fixed bugs:**
+
+- Error on using puppet resource rabbitmq\_binding [\#650](https://github.com/voxpupuli/puppet-rabbitmq/issues/650)
+- use correct datatype for $package\_gpg\_key [\#653](https://github.com/voxpupuli/puppet-rabbitmq/pull/653) ([bastelfreak](https://github.com/bastelfreak))
+- Fix 'puppet resource rabbitmq\_binding' and add tests \(\#650\) [\#651](https://github.com/voxpupuli/puppet-rabbitmq/pull/651) ([wyardley](https://github.com/wyardley))
+
+**Closed issues:**
+
+- admin\_enable throws Server Error: no parameter named 'allow\_insecure' [\#646](https://github.com/voxpupuli/puppet-rabbitmq/issues/646)
+- Add variable to rabbitmq.config [\#644](https://github.com/voxpupuli/puppet-rabbitmq/issues/644)
+
+**Merged pull requests:**
+
+- use correct datatype for port param in README.md [\#652](https://github.com/voxpupuli/puppet-rabbitmq/pull/652) ([bastelfreak](https://github.com/bastelfreak))
+- Make ldap\_user\_dn\_pattern optional [\#645](https://github.com/voxpupuli/puppet-rabbitmq/pull/645) ([sfhardman](https://github.com/sfhardman))
+- Add tags to metadata [\#643](https://github.com/voxpupuli/puppet-rabbitmq/pull/643) ([wyardley](https://github.com/wyardley))
+
+## [v7.1.0](https://github.com/voxpupuli/puppet-rabbitmq/tree/v7.1.0) (2017-10-03)
+
+[Full Changelog](https://github.com/voxpupuli/puppet-rabbitmq/compare/v7.0.0...v7.1.0)
+
+**Implemented enhancements:**
+
+- Rework apt to use packagecloud repos as well \(\#640\) [\#641](https://github.com/voxpupuli/puppet-rabbitmq/pull/641) ([wyardley](https://github.com/wyardley))
+- Refactor rabbitmq\_user provider \(mpolenchuk\) [\#598](https://github.com/voxpupuli/puppet-rabbitmq/pull/598) ([wyardley](https://github.com/wyardley))
+
+**Closed issues:**
+
+- Please switch to Package Cloud apt repository; rabbitmq.com's one becomes read-only in a few months [\#640](https://github.com/voxpupuli/puppet-rabbitmq/issues/640)
+
+**Merged pull requests:**
+
+- Switch back to "include foo" \(without leading colons\) syntax [\#639](https://github.com/voxpupuli/puppet-rabbitmq/pull/639) ([wyardley](https://github.com/wyardley))
+- Lower required Puppet version from 4.8.0 to 4.7.1 [\#637](https://github.com/voxpupuli/puppet-rabbitmq/pull/637) ([wyardley](https://github.com/wyardley))
+
+## [v7.0.0](https://github.com/voxpupuli/puppet-rabbitmq/tree/v7.0.0) (2017-09-14)
+
+[Full Changelog](https://github.com/voxpupuli/puppet-rabbitmq/compare/v6.0.0...v7.0.0)
+
+**Breaking changes:**
+
+- BREAKING: Ensure python package \(adds manage\_python option\) [\#623](https://github.com/voxpupuli/puppet-rabbitmq/pull/623) ([wyardley](https://github.com/wyardley))
+- BREAKING: Adds config\_ranch parameter \(default: true\) to suppress config lines \(\#618\) [\#621](https://github.com/voxpupuli/puppet-rabbitmq/pull/621) ([wyardley](https://github.com/wyardley))
+
+**Implemented enhancements:**
+
+- Add additional SSL configuration options \(original PR from xepa\) [\#632](https://github.com/voxpupuli/puppet-rabbitmq/pull/632) ([wyardley](https://github.com/wyardley))
+- Add support for max-length-bytes as an integer \(\#557\), patch by zhianliu [\#628](https://github.com/voxpupuli/puppet-rabbitmq/pull/628) ([wyardley](https://github.com/wyardley))
+- Add official support for Ubuntu 16.04 [\#624](https://github.com/voxpupuli/puppet-rabbitmq/pull/624) ([wyardley](https://github.com/wyardley))
+- Move examples and params to puppet strings style docs [\#562](https://github.com/voxpupuli/puppet-rabbitmq/pull/562) ([wyardley](https://github.com/wyardley))
+
+**Fixed bugs:**
+
+- Extra newline in SSL section of rabbitmq.config [\#634](https://github.com/voxpupuli/puppet-rabbitmq/issues/634)
+- Idempotency problems with rabbitmq 3.6.5 and puppet 4.8.2 [\#618](https://github.com/voxpupuli/puppet-rabbitmq/issues/618)
+- Enabling new plugin fails [\#566](https://github.com/voxpupuli/puppet-rabbitmq/issues/566)
+- Rabbitmq\_user\_permissions parser fails for empty string [\#172](https://github.com/voxpupuli/puppet-rabbitmq/issues/172)
+- Error on using puppet resource rabbitmq\_user [\#147](https://github.com/voxpupuli/puppet-rabbitmq/issues/147)
+- Resolve issue with "puppet resource rabbitmq\_user" failing \(\#147\) [\#629](https://github.com/voxpupuli/puppet-rabbitmq/pull/629) ([wyardley](https://github.com/wyardley))
+- Switch back to using rabbitmq-plugins from system path \(\#566\) [\#570](https://github.com/voxpupuli/puppet-rabbitmq/pull/570) ([wyardley](https://github.com/wyardley))
+
+**Closed issues:**
+
+- Add support for max-length-bytes as a integer [\#557](https://github.com/voxpupuli/puppet-rabbitmq/issues/557)
+- 'provider rabbitmqplugins not functional on this host' [\#150](https://github.com/voxpupuli/puppet-rabbitmq/issues/150)
+- Doesn't require curl, fails when it isn't installed [\#145](https://github.com/voxpupuli/puppet-rabbitmq/issues/145)
+- EPEL RPM does not install /usr/sbin/rabbitmq-plugins [\#134](https://github.com/voxpupuli/puppet-rabbitmq/issues/134)
+- Parameter config\_mirrored\_queues has no effect [\#125](https://github.com/voxpupuli/puppet-rabbitmq/issues/125)
+
+**Merged pull requests:**
+
+- Switch string to symbol for erl\_ssl\_path fact definition [\#631](https://github.com/voxpupuli/puppet-rabbitmq/pull/631) ([wyardley](https://github.com/wyardley))
+- Fix test cases for \#623 \(manage\_python\) [\#626](https://github.com/voxpupuli/puppet-rabbitmq/pull/626) ([wyardley](https://github.com/wyardley))
+- Add back a few examples removed in \#562 [\#625](https://github.com/voxpupuli/puppet-rabbitmq/pull/625) ([wyardley](https://github.com/wyardley))
+- Update 'require' statements and mock types to fix spec tests [\#620](https://github.com/voxpupuli/puppet-rabbitmq/pull/620) ([wyardley](https://github.com/wyardley))
+- Update fixtures to voxpupuli/archive \(from puppet-community\) [\#619](https://github.com/voxpupuli/puppet-rabbitmq/pull/619) ([wyardley](https://github.com/wyardley))
+
+## [v6.0.0](https://github.com/voxpupuli/puppet-rabbitmq/tree/v6.0.0) (2017-09-07)
+
+[Full Changelog](https://github.com/voxpupuli/puppet-rabbitmq/compare/5.6.0...v6.0.0)
+
+**Breaking changes:**
+
+- BREAKING: Drop Ruby 1.8 support. Rubocop auto-fixes in preparation for modulesync [\#575](https://github.com/voxpupuli/puppet-rabbitmq/pull/575) ([wyardley](https://github.com/wyardley))
+- BREAKING: Switch from 'UNSET' to undef, rename management\_ip to management\_ip\_address [\#559](https://github.com/voxpupuli/puppet-rabbitmq/pull/559) ([wyardley](https://github.com/wyardley))
+- BREAKING: Drop Puppet 3 support. Replace validate\_\* with datatypes [\#536](https://github.com/voxpupuli/puppet-rabbitmq/pull/536) ([bastelfreak](https://github.com/bastelfreak))
+- Updated app.pp to address deprecation warnings [\#497](https://github.com/voxpupuli/puppet-rabbitmq/pull/497) ([ilium007](https://github.com/ilium007))
+- BREAKING: manage\_repos is now repos\_ensure \(default false\), version is now unused, switch to RabbitMQ's "packagecloud" repos [\#493](https://github.com/voxpupuli/puppet-rabbitmq/pull/493) ([wyardley](https://github.com/wyardley))
+
+**Implemented enhancements:**
+
+- Convert to use 'archive' instead of 'staging' for rabbitmqadmin install [\#604](https://github.com/voxpupuli/puppet-rabbitmq/pull/604) ([wyardley](https://github.com/wyardley))
+- Update dependencies, name, and required Puppet version [\#589](https://github.com/voxpupuli/puppet-rabbitmq/pull/589) ([wyardley](https://github.com/wyardley))
+- Add official archlinux support [\#583](https://github.com/voxpupuli/puppet-rabbitmq/pull/583) ([bastelfreak](https://github.com/bastelfreak))
+- Enable configuring SSL for Erlang distribution [\#574](https://github.com/voxpupuli/puppet-rabbitmq/pull/574) ([JAORMX](https://github.com/JAORMX))
+- Add FreeBSD support [\#567](https://github.com/voxpupuli/puppet-rabbitmq/pull/567) ([wyardley](https://github.com/wyardley))
+- Add options for IPv6 and inetrc [\#552](https://github.com/voxpupuli/puppet-rabbitmq/pull/552) ([jeckersb](https://github.com/jeckersb))
+- Extra ssl options to harden rabbitmq listener [\#547](https://github.com/voxpupuli/puppet-rabbitmq/pull/547) ([xepa](https://github.com/xepa))
+- \[MODULES-4555\] allow list values to ha-params when ha-mode=nodes [\#537](https://github.com/voxpupuli/puppet-rabbitmq/pull/537) ([eserte](https://github.com/eserte))
+- Add ssl\_depth and password params for configuration [\#530](https://github.com/voxpupuli/puppet-rabbitmq/pull/530) ([bostrowski13](https://github.com/bostrowski13))
+- Allow Configuring Management IP Binding [\#506](https://github.com/voxpupuli/puppet-rabbitmq/pull/506) ([naftulikay](https://github.com/naftulikay))
+- Support multiple routing keys for bindings using separate parameters [\#504](https://github.com/voxpupuli/puppet-rabbitmq/pull/504) ([wyardley](https://github.com/wyardley))
+
+**Fixed bugs:**
+
+- Look into "error while resolving custom fact" error [\#614](https://github.com/voxpupuli/puppet-rabbitmq/issues/614)
+- repos\_ensure and version on RHEL 7 [\#573](https://github.com/voxpupuli/puppet-rabbitmq/issues/573)
+- Avoid error when rabbitmqctl is not present\), update spec syntax \(\#614\) [\#615](https://github.com/voxpupuli/puppet-rabbitmq/pull/615) ([wyardley](https://github.com/wyardley))
+- fix a couple of problems with erl\_ssl\_path fact [\#609](https://github.com/voxpupuli/puppet-rabbitmq/pull/609) ([costela](https://github.com/costela))
+- Switch $releasevar to ${::os\[release\]\[major\]} [\#577](https://github.com/voxpupuli/puppet-rabbitmq/pull/577) ([wyardley](https://github.com/wyardley))
+- Fix regex double escaping of rabbitmqctl list\_policies [\#561](https://github.com/voxpupuli/puppet-rabbitmq/pull/561) ([wyardley](https://github.com/wyardley))
+- Update file / directory permissions [\#560](https://github.com/voxpupuli/puppet-rabbitmq/pull/560) ([wyardley](https://github.com/wyardley))
+- Update regexp for rabbitmq\_nodename fact [\#545](https://github.com/voxpupuli/puppet-rabbitmq/pull/545) ([SergK](https://github.com/SergK))
+- \[Bugfix\] convert $ssl\_depth from string to integer [\#539](https://github.com/voxpupuli/puppet-rabbitmq/pull/539) ([bastelfreak](https://github.com/bastelfreak))
+- Extend rabbitmqadmin config template with SSL options. [\#526](https://github.com/voxpupuli/puppet-rabbitmq/pull/526) ([justahero](https://github.com/justahero))
+- \[MODULES-4223\] don't set NODE\_PORT and NODE\_IP\_ADDRESS if ssl\_only [\#524](https://github.com/voxpupuli/puppet-rabbitmq/pull/524) ([JAORMX](https://github.com/JAORMX))
+- \[MODULES-3733\] rabbitmq provider env\_path does not locate ruby gem installed puppet binary [\#517](https://github.com/voxpupuli/puppet-rabbitmq/pull/517) ([nzverev](https://github.com/nzverev))
+
+**Closed issues:**
+
+- use of new 6.0.0 module on new installation fails [\#611](https://github.com/voxpupuli/puppet-rabbitmq/issues/611)
+- Problem with erl\_ssl\_path fact on RHEL 7.x, erlang 18.3 [\#610](https://github.com/voxpupuli/puppet-rabbitmq/issues/610)
+- Update to support puppet/staging 2 [\#587](https://github.com/voxpupuli/puppet-rabbitmq/issues/587)
+- Update to support puppetlabs/apt 3 or 4 [\#586](https://github.com/voxpupuli/puppet-rabbitmq/issues/586)
+- puppet resource rabbitmq\_exchange does not work [\#174](https://github.com/voxpupuli/puppet-rabbitmq/issues/174)
+- exchanges will be recreated in every puppet run if the vhost is not / [\#173](https://github.com/voxpupuli/puppet-rabbitmq/issues/173)
+- Illegal cluster node name [\#163](https://github.com/voxpupuli/puppet-rabbitmq/issues/163)
+- version parameter does not work [\#154](https://github.com/voxpupuli/puppet-rabbitmq/issues/154)
+- Error message when creating an exchange with rabbitmq\_exchange [\#137](https://github.com/voxpupuli/puppet-rabbitmq/issues/137)
+- rabbitmqadmin fails with puppet 2.7.21 with master  \(code from master branch\) [\#121](https://github.com/voxpupuli/puppet-rabbitmq/issues/121)
+- Add support for exchanges [\#51](https://github.com/voxpupuli/puppet-rabbitmq/issues/51)
+- invalid parameter provider [\#49](https://github.com/voxpupuli/puppet-rabbitmq/issues/49)
+
+**Merged pull requests:**
+
+- Replace 'anchor's with 'contain' in server.pp [\#616](https://github.com/voxpupuli/puppet-rabbitmq/pull/616) ([alexjfisher](https://github.com/alexjfisher))
+- Switch to 'contain' vs. anchor pattern, and use Class\['foo'\] vs Class\['::foo'\] [\#613](https://github.com/voxpupuli/puppet-rabbitmq/pull/613) ([wyardley](https://github.com/wyardley))
+- Fix typo \(.git =\> .github\) in README link [\#608](https://github.com/voxpupuli/puppet-rabbitmq/pull/608) ([wyardley](https://github.com/wyardley))
+- Update README, and remove old CONTRIBUTING.md [\#607](https://github.com/voxpupuli/puppet-rabbitmq/pull/607) ([wyardley](https://github.com/wyardley))
+- Ignore remaining multiple expectations warnings [\#602](https://github.com/voxpupuli/puppet-rabbitmq/pull/602) ([wyardley](https://github.com/wyardley))
+- Eliminate more "multiple expectations" warnings and remove some redundant specs [\#601](https://github.com/voxpupuli/puppet-rabbitmq/pull/601) ([wyardley](https://github.com/wyardley))
+- Migrate changelog [\#599](https://github.com/voxpupuli/puppet-rabbitmq/pull/599) ([alexjfisher](https://github.com/alexjfisher))
+- Move old CHANGELOG.md to HISTORY.md [\#597](https://github.com/voxpupuli/puppet-rabbitmq/pull/597) ([wyardley](https://github.com/wyardley))
+- update more lint warnings for relative classname inclusion in examples [\#595](https://github.com/voxpupuli/puppet-rabbitmq/pull/595) ([wyardley](https://github.com/wyardley))
+- Remove redundant specs, rework others to avoid multiple expectation warnings [\#594](https://github.com/voxpupuli/puppet-rabbitmq/pull/594) ([wyardley](https://github.com/wyardley))
+- move these tests to a context block, and use 'let\(:foo\)' syntax [\#593](https://github.com/voxpupuli/puppet-rabbitmq/pull/593) ([wyardley](https://github.com/wyardley))
+- Fix stdlib requirement [\#592](https://github.com/voxpupuli/puppet-rabbitmq/pull/592) ([alexjfisher](https://github.com/alexjfisher))
+- More Rubocop fixes and README.md badges [\#590](https://github.com/voxpupuli/puppet-rabbitmq/pull/590) ([alexjfisher](https://github.com/alexjfisher))
+- Typo in .fixtures.yml breaking unit tests [\#588](https://github.com/voxpupuli/puppet-rabbitmq/pull/588) ([TraGicCode](https://github.com/TraGicCode))
+- Rewrite the spec testing case [\#585](https://github.com/voxpupuli/puppet-rabbitmq/pull/585) ([ekohl](https://github.com/ekohl))
+- Fix namevar parameter documentation in types [\#584](https://github.com/voxpupuli/puppet-rabbitmq/pull/584) ([alexjfisher](https://github.com/alexjfisher))
+- Rubocop fixes: Update hash syntax and some formatting [\#582](https://github.com/voxpupuli/puppet-rabbitmq/pull/582) ([wyardley](https://github.com/wyardley))
+- Switch to rspec-puppet-facts [\#581](https://github.com/voxpupuli/puppet-rabbitmq/pull/581) ([ekohl](https://github.com/ekohl))
+- update various small warnings [\#580](https://github.com/voxpupuli/puppet-rabbitmq/pull/580) ([wyardley](https://github.com/wyardley))
+- switch to structured facts for os\* and rabbitmq\_version [\#579](https://github.com/voxpupuli/puppet-rabbitmq/pull/579) ([wyardley](https://github.com/wyardley))
+- move facter unit tests to the proper place [\#578](https://github.com/voxpupuli/puppet-rabbitmq/pull/578) ([wyardley](https://github.com/wyardley))
+- Switch to 'let\(:foo\)' syntax \(resolves rubocop warnings\) [\#576](https://github.com/voxpupuli/puppet-rabbitmq/pull/576) ([wyardley](https://github.com/wyardley))
+- removed package\_provider var from readme and added deprecation check â€¦ [\#571](https://github.com/voxpupuli/puppet-rabbitmq/pull/571) ([bostrowski13](https://github.com/bostrowski13))
+- don't "touch" hiera.yaml in spec\_helper\_acceptance [\#558](https://github.com/voxpupuli/puppet-rabbitmq/pull/558) ([wyardley](https://github.com/wyardley))
+- \(MODULES-5187\) mysnc puppet 5 and ruby 2.4 [\#554](https://github.com/voxpupuli/puppet-rabbitmq/pull/554) ([eputnam](https://github.com/eputnam))
+- \(MODULES-5144\) Prep for puppet 5 [\#553](https://github.com/voxpupuli/puppet-rabbitmq/pull/553) ([hunner](https://github.com/hunner))
+- Fix unit tests on \#535 [\#550](https://github.com/voxpupuli/puppet-rabbitmq/pull/550) ([hunner](https://github.com/hunner))
+- Fix error text in `rabbitmq\_vhost` provider [\#549](https://github.com/voxpupuli/puppet-rabbitmq/pull/549) ([hybby](https://github.com/hybby))
+- Improve distro fact handling in tests [\#548](https://github.com/voxpupuli/puppet-rabbitmq/pull/548) ([jeckersb](https://github.com/jeckersb))
+- Simplify "all\_vhosts" in rabbitmq\_queue provider [\#544](https://github.com/voxpupuli/puppet-rabbitmq/pull/544) ([KarolisL](https://github.com/KarolisL))
+- Upstream staging module released 2.2.0. Allow using it. [\#543](https://github.com/voxpupuli/puppet-rabbitmq/pull/543) ([vStone](https://github.com/vStone))
+- Scope config\_variables for Puppet 4 [\#541](https://github.com/voxpupuli/puppet-rabbitmq/pull/541) ([jarro2783](https://github.com/jarro2783))
+- \[msync\] 786266 Implement puppet-module-gems, a45803 Remove metadata.json from locales config [\#540](https://github.com/voxpupuli/puppet-rabbitmq/pull/540) ([wilson208](https://github.com/wilson208))
+- \[MODULES-4528\] Replace Puppet.version.to\_f version comparison from spec\_helper.rb [\#538](https://github.com/voxpupuli/puppet-rabbitmq/pull/538) ([wilson208](https://github.com/wilson208))
+- Systemd open files limit [\#535](https://github.com/voxpupuli/puppet-rabbitmq/pull/535) ([arteal](https://github.com/arteal))
+- \[MODULES-4450\] don't set ssl depth if undef [\#534](https://github.com/voxpupuli/puppet-rabbitmq/pull/534) ([JAORMX](https://github.com/JAORMX))
+- moved username:password to separate parameter [\#532](https://github.com/voxpupuli/puppet-rabbitmq/pull/532) ([vdmkenny](https://github.com/vdmkenny))
+- \(maint\) parallel\_spec maintenance: spec\_helper [\#531](https://github.com/voxpupuli/puppet-rabbitmq/pull/531) ([eputnam](https://github.com/eputnam))
+- \(MODULES-4098\) Sync the rest of the files [\#528](https://github.com/voxpupuli/puppet-rabbitmq/pull/528) ([hunner](https://github.com/hunner))
+- \(MODULES-4097\) Sync travis.yml [\#527](https://github.com/voxpupuli/puppet-rabbitmq/pull/527) ([hunner](https://github.com/hunner))
+- \(FM-5972\) gettext and spec.opts [\#525](https://github.com/voxpupuli/puppet-rabbitmq/pull/525) ([eputnam](https://github.com/eputnam))
+- \(FM-5939\) removes spec.opts [\#523](https://github.com/voxpupuli/puppet-rabbitmq/pull/523) ([eputnam](https://github.com/eputnam))
+- \(MODULES-3631\) msync Gemfile for 1.9 frozen strings [\#522](https://github.com/voxpupuli/puppet-rabbitmq/pull/522) ([hunner](https://github.com/hunner))
+- Designate former tests files as examples [\#521](https://github.com/voxpupuli/puppet-rabbitmq/pull/521) ([DavidS](https://github.com/DavidS))
+- Fixed lint on README.md snippets [\#520](https://github.com/voxpupuli/puppet-rabbitmq/pull/520) ([mvisonneau](https://github.com/mvisonneau))
+- \(MODULES-3704\) Update gemfile template to be identical [\#519](https://github.com/voxpupuli/puppet-rabbitmq/pull/519) ([hunner](https://github.com/hunner))
+- Fix sync [\#518](https://github.com/voxpupuli/puppet-rabbitmq/pull/518) ([hunner](https://github.com/hunner))
+- Allows deprecation errors [\#516](https://github.com/voxpupuli/puppet-rabbitmq/pull/516) ([pmcmaw](https://github.com/pmcmaw))
+- Bug fix for when queue names include spaces [\#512](https://github.com/voxpupuli/puppet-rabbitmq/pull/512) ([Bubbad](https://github.com/Bubbad))
+- Do not check cert when acquiring rabbitmqadmin with wget. [\#478](https://github.com/voxpupuli/puppet-rabbitmq/pull/478) ([modax](https://github.com/modax))
+- Cleanup void tcp options [\#464](https://github.com/voxpupuli/puppet-rabbitmq/pull/464) ([mpolenchuk](https://github.com/mpolenchuk))
+
+## [5.6.0](https://github.com/voxpupuli/puppet-rabbitmq/tree/5.6.0) (2016-10-25)
+
+[Full Changelog](https://github.com/voxpupuli/puppet-rabbitmq/compare/5.5.0...5.6.0)
+
+**Implemented enhancements:**
+
+- Allow ha-sync-batch-size for rabbitmq\_policy definition to be integer  [\#500](https://github.com/voxpupuli/puppet-rabbitmq/pull/500) ([mxftw](https://github.com/mxftw))
+- Ability to set management\_hostname in rabbitmqadmin.conf [\#498](https://github.com/voxpupuli/puppet-rabbitmq/pull/498) ([tampakrap](https://github.com/tampakrap))
+
+**Merged pull requests:**
+
+- \(MODULES-3983\) Update parallel\_tests for ruby 2.0.0 moduleSync [\#514](https://github.com/voxpupuli/puppet-rabbitmq/pull/514) ([pmcmaw](https://github.com/pmcmaw))
+- \[FM-5719\] Release prep for unsupported release 5.6.0 [\#513](https://github.com/voxpupuli/puppet-rabbitmq/pull/513) ([wilson208](https://github.com/wilson208))
+- set $real\_package\_source to undef instead of empty [\#507](https://github.com/voxpupuli/puppet-rabbitmq/pull/507) ([bastelfreak](https://github.com/bastelfreak))
+- Update modulesync\_config \[a3fe424\] [\#501](https://github.com/voxpupuli/puppet-rabbitmq/pull/501) ([DavidS](https://github.com/DavidS))
+- use unless instead of if, and empty? instead of !='' [\#491](https://github.com/voxpupuli/puppet-rabbitmq/pull/491) ([wyardley](https://github.com/wyardley))
+
+## 5.5.0 (2016-08-29)
+### Summary
+Adds some exciting new features (listed below) for a long awaited release!
+
+### Features
+- Updates GPG signing key
+- Now add additional config variables with the `config_additional_variable` parameter!
+- Configure your management plugin with the new `collect_statistics_interval` parameter!
+- Enjoy more robust tuning of your TCP configuration with:
+  - `tcp_backlog`
+  - `tcp_sndbuf`
+  - `tcp_recbuf`
+
+### Bugfixes
+- MODULES-3740 - RabbitMQ template missing important config parameter
+
+## 5.4.0 (2016-05-11)
+### Summary
+Adds several new parameters, features, and lots of bugfixes
+
+#### Features
+- Adds configuration for rabbitmq\_shovel plugin including static shovels
+- (MODULE-2040) Add configuration of `auth_backends`
+- Adds the `config_management_variables` parameter
+- Adds `heartbeat` parameter
+- Adds `rabbitmq_version` fact
+- Adds ipv6 support to `rabbitmqadmin`
+- MODULES-3148: Allow shards-per-node for rabbitmq\_policy definition to be integer
+- Adds `rabbitmq_nodename` fact
+- Allow passing architecture to `apt::source`
+
+#### Bugfixes
+- MODULES-2252 - fix "Command execution expired" issue
+- Fixes an issue with Puppet 4+ when run from a cron job
+- Updates RedHat to use yum instead of rpm
+- Fixes the `$file_limit` parameter to allow integers
+- MODULES-2252 - fix "Could not prefetch rabbitmq\_exchange provider 'rabbitmqadmin': 757: unexpected token at 'fanout'" issue
+- Improves error message when policy definition value is not a string
+- MODULES-2645 add apt::update requirement for Debian
+- Fixes pinning for apt on Debian based distros
+- Updates install.pp to ensure that mnesia\_base directory exists
+- Fixes rabbitmqadmin url
+- Updates default `$package_gpg_key` to https
+- Fixes `curl --noproxy` command to set host dynamically
+- Ignore system umask when generating enabled\_plugins file
+- Fix to skip federated queues in the output
+- Updates module dependencies to use `puppet-staging` instead of `nanliu-staging`
+- Fixes bug where `rabbitmq_management` block is created twice
+- Fixes `rabbitmq_parameter` type check for `add-forward-headers` to require boolean.
+- Fixes an issue when `$node_ip_address` is 'UNSET'
+- Fixes package installation on OpenBSD
+- Fixes bug that shows new user password changes on noop runs
+- (MODULES-3295) Allow ssl => false without warning
+
+## 5.3.1 (2015-10-07)
+### Summary
+Adds a new resource type and a few ssl management parameters
+
+#### Features
+- Add rabbitmq\_parameter type
+- Add management\_ssl parameter to rabbitmq class
+- Add stomp\_ssl\_only parameter to rabbitmq class
+
+#### Bugfixes
+- file\_limit validation and el7 management
+- Fix mnesia dir not getting wiped
+- Fix message-ttl and max-length integer conversion in rabbitmq\_policy
+- Allow managing erlang cookie without config\_cluster
+
+## 5.3.0 (2015-05-26) [YANKED]
+### Summary
+This is a deleted release. It did not follow semver.
+
+## 5.2.3 (2015-06-23)
+### Summary
+This is a patch release that updates the dependency requirements in the metadata.
+
+## 5.2.2 (2015-06-09)
+### Summary
+This is a bugfix to allow the rabbitmq\_exchange type's internal/durable/auto\_delete attributes work when they are not explicitly passed.
+
+### Bugfixes
+- Fix rabbitmq\_exchange create when internal/durable/auto\_delete are not specified
+- Start unit testing on puppet 4
+- Add default value to tcp\_listen\_options
+
+## 5.2.1 (2015-05-26)
+### Summary
 This release includes a fix for idempotency between puppet runs, as well as Readme updates
 
-####Features
+#### Features
 - Readme updates
 - Testing updates
 
-####Bugfixes
+#### Bugfixes
 - Ensure idempotency between Puppet runs
 
-## 2015-04-28 - Version 5.2.0
-###Summary
+## 5.2.0 (2015-04-28)
+### Summary
 This release adds several new features for expanded configuration, support for SSL Ciphers, several bugfixes, and improved tests.
 
-####Features
+#### Features
 - New parameters to class `rabbitmq`
   - `ssl_ciphers`
 - New parameters to class `rabbitmq::config`
@@ -27,7 +385,7 @@ This release adds several new features for expanded configuration, support for S
 - Adds support for SSL Ciphers
 - Adds `file_limit` support for RedHat platforms
 
-####Bugfixes
+#### Bugfixes
 - Will not create `rabbitmqadmin.conf` if admin is disabled
 - Fixes `check_password`
 - Fix to allow bindings and queues to be created when non-default management port is being used by rabbitmq. (MODULES-1856)
@@ -35,14 +393,14 @@ This release adds several new features for expanded configuration, support for S
 - Updates apt key for full fingerprint compliance.
 - Adds a missing `routing_key` param to rabbitmqadmin absent binding call.
 
-## 2015-03-10 - Version 5.1.0
-###Summary
+## 5.1.0 (2015-03-10)
+### Summary
 This release adds several features for greater flexibility in configuration of rabbitmq, includes a number of bug fixes, and bumps the minimum required version of puppetlabs-stdlib to 3.0.0.
 
-####Changes to defaults
+#### Changes to defaults
 - The default environment variables in `rabbitmq::config` have been renamed from `RABBITMQ_NODE_PORT` and `RABBITMQ_NODE_IP_ADDRESS` to `NODE_PORT` and `NODE_IP_ADDRESS` (MODULES-1673)
 
-####Features
+#### Features
 - New parameters to class `rabbitmq`
   - `file_limit`
   - `interface`
@@ -56,7 +414,7 @@ This release adds several features for greater flexibility in configuration of r
 - Add `rabbitmq_queue` and `rabbitmq_binding` types
 - Update the providers to be able to retry commands
 
-####Bugfixes
+#### Bugfixes
 - Cleans up the formatting for rabbitmq.conf for readability
 - Update tag splitting in the `rabbitmqctl` provider for `rabbitmq_user` to work with comma or space separated tags
 - Do not enforce the source value for the yum provider (MODULES-1631)
@@ -66,7 +424,7 @@ This release adds several features for greater flexibility in configuration of r
 - Fix issues in `rabbitmq_user` with tags not being sorted
 - Fix broken check for existing exchanges in `rabbitmq_exchange`
 
-## 2014-12-22 - Version 5.0.0
+## 5.0.0 (2014-12-22)
 ### Summary
 
 This release fixes a longstanding security issue where the rabbitmq
@@ -76,25 +434,25 @@ and fixes several bugs.
 
 #### Backwards-incompatible Changes
 
-- Removed the rabbitmq_erlang_cookie fact and replaced the logic to
+- Removed the rabbitmq\_erlang\_cookie fact and replaced the logic to
   manage that cookie with a provider.
 - Dropped official support for Puppet 2.7 (EOL 9/30/2014
   https://groups.google.com/forum/#!topic/puppet-users/QLguMcLraLE )
-- Changed the default value of $rabbitmq::params::ldap_user_dn_pattern
+- Changed the default value of $rabbitmq::params::ldap\_user\_dn\_pattern
   to not contain a variable
-- Removed deprecated parameters: $rabbitmq::cluster_disk_nodes,
-  $rabbitmq::server::manage_service, and
-  $rabbitmq::server::config_mirrored_queues
+- Removed deprecated parameters: $rabbitmq::cluster\_disk\_nodes,
+  $rabbitmq::server::manage\_service, and
+  $rabbitmq::server::config\_mirrored\_queues
 
 #### Features
 
-- Add tcp_keepalive parameter to enable TCP keepalive
+- Add tcp\_keepalive parameter to enable TCP keepalive
 - Use https to download rabbitmqadmin tool when $rabbitmq::ssl is true
-- Add key_content parameter for offline Debian package installations
+- Add key\_content parameter for offline Debian package installations
 - Use 16 character apt key to avoid potential collisions
-- Add rabbitmq_policy type, including support for rabbitmq <3.2.0
-- Add rabbitmq::ensure_repo parameter
-- Add ability to change rabbitmq_user password
+- Add rabbitmq\_policy type, including support for rabbitmq <3.2.0
+- Add rabbitmq::ensure\_repo parameter
+- Add ability to change rabbitmq\_user password
 - Allow disk as a valid cluster node type
 
 #### Bugfixes
@@ -102,11 +460,11 @@ and fixes several bugs.
 - Avoid attempting to install rabbitmqadmin via a proxy (since it is
   downloaded from localhost)
 - Optimize check for RHEL GPG key
-- Configure ssl_listener in stomp only if using ssl
+- Configure ssl\_listener in stomp only if using ssl
 - Use rpm as default package provider for RedHat, bringing the module in
   line with the documented instructions to manage erlang separately and allowing
   the default version and source parameters to become meaningful
-- Configure cacertfile only if verify_none is not set
+- Configure cacertfile only if verify\_none is not set
 - Use -q flag for rabbitmqctl commands to avoid parsing inconsistent
   debug output
 - Use the -m flag for rabbitmqplugins commands, again to avoid parsing
@@ -119,37 +477,37 @@ and fixes several bugs.
 - Add, update, and fix tests
 - Update docs
 
-## 2014-08-20 - Version 4.1.0
+## 4.1.0 (2014-08-20)
 ### Summary
 
 This release adds several new features, fixes bugs, and improves tests and
 documentation.
 
 #### Features
-- Autorequire the rabbitmq-server service in the rabbitmq_vhost type
+- Autorequire the rabbitmq-server service in the rabbitmq\_vhost type
 - Add credentials to rabbitmqadmin URL
-- Added $ssl_only parameter to rabbitmq, rabbitmq::params, and
+- Added $ssl\_only parameter to rabbitmq, rabbitmq::params, and
 rabbitmq::config
-- Added property tags to rabbitmq_user provider
+- Added property tags to rabbitmq\_user provider
 
 #### Bugfixes
 - Fix erroneous commas in rabbitmq::config
-- Use correct ensure value for the rabbitmq_stomp rabbitmq_plugin
+- Use correct ensure value for the rabbitmq\_stomp rabbitmq\_plugin
 - Set HOME env variable to nil when leveraging rabbitmq to remove type error
 from Python script
 - Fix location for rabbitmq-plugins for RHEL
-- Remove validation for package_source to allow it to be set to false
+- Remove validation for package\_source to allow it to be set to false
 - Allow LDAP auth configuration without configuring stomp
-- Added missing $ssl_verify and $ssl_fail_if_no_peer_cert to rabbitmq::config
+- Added missing $ssl\_verify and $ssl\_fail\_if\_no\_peer\_cert to rabbitmq::config
 
-## 2014-05-16 - Version 4.0.0
+## 4.0.0 (2014-05-16)
 ### Summary
 
 This release includes many new features and bug fixes.  With the exception of
 erlang management this should be backwards compatible with 3.1.0.
 
 #### Backwards-incompatible Changes
-- erlang_manage was removed.  You will need to manage erlang separately. See
+- erlang\_manage was removed.  You will need to manage erlang separately. See
 the README for more information on how to configure this.
 
 #### Features
@@ -168,17 +526,17 @@ the README for more information on how to configure this.
 - exchanges no longer recreated on each puppet run if non-default vhost is used
 - Allow port to be UNSET
 - Re-added rabbitmq::server class
-- Deprecated previously unused manage_service variable in favor of 
-  service_manage
+- Deprecated previously unused manage\_service variable in favor of 
+  service\_manage
 - Use correct key for rabbitmq apt::source
-- config_mirrored_queues variable removed
+- config\_mirrored\_queues variable removed
   - It previously did nothing, will now at least throw a warning if you try to
     use it
 - Remove unnecessary dependency on Class['rabbitmq::repo::rhel'] in
   rabbitmq::install
 
 
-## 2013-09-14 - Version 3.1.0
+## 3.1.0 (2013-09-14)
 ### Summary
 
 This release focuses on a few small (but critical) bugfixes as well as extends
@@ -190,12 +548,12 @@ the amount of custom RabbitMQ configuration you can do with the module.
 - ArchLinux support added.
 
 #### Fixes
-- Make use of the user/password parameters in rabbitmq_exchange{}
-- Correct the read/write parameter order on set_permissions/list_permissions as
+- Make use of the user/password parameters in rabbitmq\_exchange{}
+- Correct the read/write parameter order on set\_permissions/list\_permissions as
   they were reversed.
 - Make the module pull down 3.1.5 by default.
 
-## 2013-07-18 3.0.0
+## 3.0.0 (2013-07-18)
 ### Summary
 
 This release heavily refactors the RabbitMQ and changes functionality in
@@ -216,7 +574,7 @@ a 3.x release.
 - Refactor the module to fix RHEL support.  All interaction with the module
 is now done through the main rabbitmq class.
 - Add support for mirrored queues (Only on Debian family distributions currently)
-- Add rabbitmq_exchange provider (using rabbitmqadmin)
+- Add rabbitmq\_exchange provider (using rabbitmqadmin)
 - Add new `rabbitmq` class parameters:
   - `manage_service`: Boolean to choose if Puppet should manage the service. (For pacemaker/HA setups)
 - Add SuSE support.
@@ -226,36 +584,39 @@ is now done through the main rabbitmq class.
 - Rabbitmq::server has been removed and is now rabbitmq::config.  You should
 not use this class directly, only via the main rabbitmq class.
 
-## 2013-04-11 2.1.0
+## 2.1.0 (2013-04-11)
 
 - remove puppetversion from rabbitmq.config template
 - add cluster support
 - escape resource names in regexp
 
-## 2012-07-31 Jeff McCune <jeff@puppetlabs.com> 2.0.2
+## 2.0.2 (2012-07-31)
 - Re-release 2.0.1 with $EDITOR droppings cleaned up
 
-## 2012-05-03 2.0.0
+## 2.0.0 (2012-05-03)
 - added support for new-style admin users
 - added support for rabbitmq 2.7.1
 
-## 2011-06-14 Dan Bode <dan@Puppetlabs.com> 2.0.0rc1
+## 2.0.0rc1 (2011-06-14)
 - Massive refactor:
-- added native types for user/vhost/user_permissions
-- added apt support for vendor packages
-- added smoke tests
+  - added native types for user/vhost/user\_permissions
+  - added apt support for vendor packages
+  - added smoke tests
 
-## 2011-04-08 Jeff McCune <jeff@puppetlabs.com> 1.0.4
+## 1.0.4 (2011-04-08)
 - Update module for RabbitMQ 2.4.1 and rabbitmq-plugin-stomp package.
 
-## 2011-03-24 1.0.3
+## 1.0.3 (2011-03-24)
 - Initial release to the forge.  Reviewed by Cody.  Whitespace is good.
 
-## 2011-03-22 1.0.2
+## 1.0.2 (2011-03-22)
 - Whitespace only fix again...  ack '\t' is my friend...
 
-## 2011-03-22 1.0.1
+## 1.0.1 (2011-03-22)
 - Whitespace only fix.
 
-## 2011-03-22 1.0.0
+## 1.0.0 (2011-03-22)
 - Initial Release.  Manage the package, file and service.
+
+
+\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
\ No newline at end of file
diff --git a/3rdparty/modules/rabbitmq/CONTRIBUTING.md b/3rdparty/modules/rabbitmq/CONTRIBUTING.md
deleted file mode 100644 (file)
index f1cbde4..0000000
+++ /dev/null
@@ -1,220 +0,0 @@
-Checklist (and a short version for the impatient)
-=================================================
-
-  * Commits:
-
-    - 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:
-      `bundle exec rspec spec/acceptance` More information on [testing](#Testing) below
-
-    - When introducing a new feature, make sure it is properly
-      documented in the README.md
-
-  * Submission:
-
-    * Pre-requisites:
-
-      - Make sure you have a [GitHub account](https://github.com/join)
-
-      - [Create a ticket](https://tickets.puppetlabs.com/secure/CreateIssue!default.jspa), or [watch the ticket](https://tickets.puppetlabs.com/browse/) you are patching for.
-
-    * Preferred method:
-
-      - Fork the repository on GitHub.
-
-      - Push your changes to a topic branch in your fork of the
-        repository. (the format ticket/1234-short_description_of_change is
-        usually preferred for this project).
-
-      - Submit a pull request to the repository in the puppetlabs
-        organization.
-
-The 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.
-
-Testing
-=======
-
-Getting Started
----------------
-
-Our puppet modules provide [`Gemfile`](./Gemfile)s which can tell a ruby
-package manager such as [bundler](http://bundler.io/) what Ruby packages,
-or Gems, are required to build, develop, and test this software.
-
-Please make sure you have [bundler installed](http://bundler.io/#getting-started)
-on your system, then use it to install all dependencies needed for this project,
-by running
-
-```shell
-% bundle install
-Fetching gem metadata from https://rubygems.org/........
-Fetching gem metadata from https://rubygems.org/..
-Using rake (10.1.0)
-Using builder (3.2.2)
--- 8><-- many more --><8 --
-Using rspec-system-puppet (2.2.0)
-Using serverspec (0.6.3)
-Using rspec-system-serverspec (1.0.0)
-Using bundler (1.3.5)
-Your bundle is complete!
-Use `bundle show [gemname]` to see where a bundled gem is installed.
-```
-
-NOTE some systems may require you to run this command with sudo.
-
-If you already have those gems installed, make sure they are up-to-date:
-
-```shell
-% bundle update
-```
-
-With all dependencies in place and up-to-date we can now run the tests:
-
-```shell
-% rake spec
-```
-
-This will execute all the [rspec tests](http://rspec-puppet.com/) tests
-under [spec/defines](./spec/defines), [spec/classes](./spec/classes),
-and so on. rspec tests may have the same kind of dependencies as the
-module they are testing. While the module defines in its [Modulefile](./Modulefile),
-rspec tests define them in [.fixtures.yml](./fixtures.yml).
-
-Some puppet modules also come with [beaker](https://github.com/puppetlabs/beaker)
-tests. These tests spin up a virtual machine under
-[VirtualBox](https://www.virtualbox.org/)) with, controlling it with
-[Vagrant](http://www.vagrantup.com/) to actually simulate scripted test
-scenarios. In order to run these, you will need both of those tools
-installed on your system.
-
-You can run them by issuing the following command
-
-```shell
-% rake spec_clean
-% rspec spec/acceptance
-```
-
-This will now download a pre-fabricated image configured in the [default node-set](./spec/acceptance/nodesets/default.yml),
-install puppet, copy this module and install its dependencies per [spec/spec_helper_acceptance.rb](./spec/spec_helper_acceptance.rb)
-and then run all the tests under [spec/acceptance](./spec/acceptance).
-
-Writing Tests
--------------
-
-XXX getting started writing tests.
-
-If you have commit access to the repository
-===========================================
-
-Even if you have commit access to the repository, you will still need to
-go through the process above, and have someone else review and merge
-in your changes.  The rule is that all changes must be reviewed by a
-developer on the project (that did not write the code) to ensure that
-all changes go through a code review process.
-
-Having someone other than the author of the topic branch recorded as
-performing the merge is the record that they performed the code
-review.
-
-
-Additional Resources
-====================
-
-* [Getting additional help](http://puppetlabs.com/community/get-help)
-
-* [Writing tests](http://projects.puppetlabs.com/projects/puppet/wiki/Development_Writing_Tests)
-
-* [Patchwork](https://patchwork.puppetlabs.com)
-
-* [General GitHub documentation](http://help.github.com/)
-
-* [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
-
index 2b1b7cd..57fcafa 100644 (file)
@@ -1,7 +1,7 @@
 source ENV['GEM_SOURCE'] || "https://rubygems.org"
 
 def location_for(place, fake_version = nil)
-  if place =~ /^(git:[^#]*)#(.*)/
+  if place =~ /^(git[:@][^#]*)#(.*)/
     [fake_version, { :git => $1, :branch => $2, :require => false }].compact
   elsif place =~ /^file:\/\/(.*)/
     ['>= 0', { :path => File.expand_path($1), :require => false }]
@@ -10,38 +10,68 @@ def location_for(place, fake_version = nil)
   end
 end
 
-group :development, :unit_tests do
-  gem 'rspec-core', '3.1.7',     :require => false
-  gem 'puppetlabs_spec_helper',  :require => false
-  gem 'simplecov',               :require => false
-  gem 'puppet_facts',            :require => false
-  gem 'json',                    :require => false
+group :test do
+  gem 'puppetlabs_spec_helper', '~> 2.6.0',                         :require => false
+  gem 'rspec-puppet', '~> 2.5',                                     :require => false
+  gem 'rspec-puppet-facts',                                         :require => false
+  gem 'rspec-puppet-utils',                                         :require => false
+  gem 'puppet-lint-leading_zero-check',                             :require => false
+  gem 'puppet-lint-trailing_comma-check',                           :require => false
+  gem 'puppet-lint-version_comparison-check',                       :require => false
+  gem 'puppet-lint-classes_and_types_beginning_with_digits-check',  :require => false
+  gem 'puppet-lint-unquoted_string-check',                          :require => false
+  gem 'puppet-lint-variable_contains_upcase',                       :require => false
+  gem 'metadata-json-lint',                                         :require => false
+  gem 'redcarpet',                                                  :require => false
+  gem 'rubocop', '~> 0.49.1',                                       :require => false if RUBY_VERSION >= '2.3.0'
+  gem 'rubocop-rspec', '~> 1.15.0',                                 :require => false if RUBY_VERSION >= '2.3.0'
+  gem 'mocha', '>= 1.2.1',                                          :require => false
+  gem 'coveralls',                                                  :require => false
+  gem 'simplecov-console',                                          :require => false
+  gem 'rack', '~> 1.0',                                             :require => false if RUBY_VERSION < '2.2.2'
+  gem 'parallel_tests',                                             :require => false
+end
+
+group :development do
+  gem 'travis',                   :require => false
+  gem 'travis-lint',              :require => false
+  gem 'guard-rake',               :require => false
+  gem 'overcommit', '>= 0.39.1',  :require => false
 end
 
 group :system_tests do
+  gem 'winrm',                         :require => false
   if beaker_version = ENV['BEAKER_VERSION']
     gem 'beaker', *location_for(beaker_version)
+  else
+    gem 'beaker', '>= 3.9.0', :require => false
   end
   if beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION']
     gem 'beaker-rspec', *location_for(beaker_rspec_version)
   else
     gem 'beaker-rspec',  :require => false
   end
-  gem 'serverspec',    :require => false
+  gem 'serverspec',                    :require => false
+  gem 'beaker-puppet_install_helper',  :require => false
+  gem 'beaker-module_install_helper',  :require => false
+end
+
+group :release do
+  gem 'github_changelog_generator',  :require => false, :git => 'https://github.com/skywinder/github-changelog-generator' if RUBY_VERSION >= '2.2.2'
+  gem 'puppet-blacksmith',           :require => false
+  gem 'voxpupuli-release',           :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem'
+  gem 'puppet-strings', '~> 1.0',    :require => false
 end
 
 
 
 if facterversion = ENV['FACTER_GEM_VERSION']
-  gem 'facter', facterversion, :require => false
+  gem 'facter', facterversion.to_s, :require => false, :groups => [:test]
 else
-  gem 'facter', :require => false
+  gem 'facter', :require => false, :groups => [:test]
 end
 
-if puppetversion = ENV['PUPPET_GEM_VERSION']
-  gem 'puppet', puppetversion, :require => false
-else
-  gem 'puppet', :require => false
-end
+ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 5.0' : puppetversion = ENV['PUPPET_VERSION'].to_s
+gem 'puppet', puppetversion, :require => false, :groups => [:test]
 
-# vim:ft=ruby
+# vim: syntax=ruby
diff --git a/3rdparty/modules/rabbitmq/HISTORY.md b/3rdparty/modules/rabbitmq/HISTORY.md
new file mode 100644 (file)
index 0000000..af15d71
--- /dev/null
@@ -0,0 +1,347 @@
+## 5.5.0 (2016-08-29)
+### Summary
+Adds some exciting new features (listed below) for a long awaited release!
+
+### Features
+- Updates GPG signing key
+- Now add additional config variables with the `config_additional_variable` parameter!
+- Configure your management plugin with the new `collect_statistics_interval` parameter!
+- Enjoy more robust tuning of your TCP configuration with:
+  - `tcp_backlog`
+  - `tcp_sndbuf`
+  - `tcp_recbuf`
+
+### Bugfixes
+- MODULES-3740 - RabbitMQ template missing important config parameter
+
+## 5.4.0 (2016-05-11)
+### Summary
+Adds several new parameters, features, and lots of bugfixes
+
+#### Features
+- Adds configuration for rabbitmq\_shovel plugin including static shovels
+- (MODULE-2040) Add configuration of `auth_backends`
+- Adds the `config_management_variables` parameter
+- Adds `heartbeat` parameter
+- Adds `rabbitmq_version` fact
+- Adds ipv6 support to `rabbitmqadmin`
+- MODULES-3148: Allow shards-per-node for rabbitmq\_policy definition to be integer
+- Adds `rabbitmq_nodename` fact
+- Allow passing architecture to `apt::source`
+
+#### Bugfixes
+- MODULES-2252 - fix "Command execution expired" issue
+- Fixes an issue with Puppet 4+ when run from a cron job
+- Updates RedHat to use yum instead of rpm
+- Fixes the `$file_limit` parameter to allow integers
+- MODULES-2252 - fix "Could not prefetch rabbitmq\_exchange provider 'rabbitmqadmin': 757: unexpected token at 'fanout'" issue
+- Improves error message when policy definition value is not a string
+- MODULES-2645 add apt::update requirement for Debian
+- Fixes pinning for apt on Debian based distros
+- Updates install.pp to ensure that mnesia\_base directory exists
+- Fixes rabbitmqadmin url
+- Updates default `$package_gpg_key` to https
+- Fixes `curl --noproxy` command to set host dynamically
+- Ignore system umask when generating enabled\_plugins file
+- Fix to skip federated queues in the output
+- Updates module dependencies to use `puppet-staging` instead of `nanliu-staging`
+- Fixes bug where `rabbitmq_management` block is created twice
+- Fixes `rabbitmq_parameter` type check for `add-forward-headers` to require boolean.
+- Fixes an issue when `$node_ip_address` is 'UNSET'
+- Fixes package installation on OpenBSD
+- Fixes bug that shows new user password changes on noop runs
+- (MODULES-3295) Allow ssl => false without warning
+
+## 5.3.1 (2015-10-07)
+### Summary
+Adds a new resource type and a few ssl management parameters
+
+#### Features
+- Add rabbitmq\_parameter type
+- Add management\_ssl parameter to rabbitmq class
+- Add stomp\_ssl\_only parameter to rabbitmq class
+
+#### Bugfixes
+- file\_limit validation and el7 management
+- Fix mnesia dir not getting wiped
+- Fix message-ttl and max-length integer conversion in rabbitmq\_policy
+- Allow managing erlang cookie without config\_cluster
+
+## 5.3.0 (2015-05-26) [YANKED]
+### Summary
+This is a deleted release. It did not follow semver.
+
+## 5.2.3 (2015-06-23)
+### Summary
+This is a patch release that updates the dependency requirements in the metadata.
+
+## 5.2.2 (2015-06-09)
+### Summary
+This is a bugfix to allow the rabbitmq\_exchange type's internal/durable/auto\_delete attributes work when they are not explicitly passed.
+
+### Bugfixes
+- Fix rabbitmq\_exchange create when internal/durable/auto\_delete are not specified
+- Start unit testing on puppet 4
+- Add default value to tcp\_listen\_options
+
+## 5.2.1 (2015-05-26)
+### Summary
+This release includes a fix for idempotency between puppet runs, as well as Readme updates
+
+#### Features
+- Readme updates
+- Testing updates
+
+#### Bugfixes
+- Ensure idempotency between Puppet runs
+
+## 5.2.0 (2015-04-28)
+### Summary
+This release adds several new features for expanded configuration, support for SSL Ciphers, several bugfixes, and improved tests.
+
+#### Features
+- New parameters to class `rabbitmq`
+  - `ssl_ciphers`
+- New parameters to class `rabbitmq::config`
+  - `interface`
+  - `ssl_interface`
+- New parameters to type `rabbitmq_exchange`
+  - `internal`
+  - `auto_delete`
+  - `durable`
+- Adds syncing with Modulesync
+- Adds support for SSL Ciphers
+- Adds `file_limit` support for RedHat platforms
+
+#### Bugfixes
+- Will not create `rabbitmqadmin.conf` if admin is disabled
+- Fixes `check_password`
+- Fix to allow bindings and queues to be created when non-default management port is being used by rabbitmq. (MODULES-1856)
+- `rabbitmq_policy` converts known parameters to integers
+- Updates apt key for full fingerprint compliance.
+- Adds a missing `routing_key` param to rabbitmqadmin absent binding call.
+
+## 5.1.0 (2015-03-10)
+### Summary
+This release adds several features for greater flexibility in configuration of rabbitmq, includes a number of bug fixes, and bumps the minimum required version of puppetlabs-stdlib to 3.0.0.
+
+#### Changes to defaults
+- The default environment variables in `rabbitmq::config` have been renamed from `RABBITMQ_NODE_PORT` and `RABBITMQ_NODE_IP_ADDRESS` to `NODE_PORT` and `NODE_IP_ADDRESS` (MODULES-1673)
+
+#### Features
+- New parameters to class `rabbitmq`
+  - `file_limit`
+  - `interface`
+  - `ldap_other_bind`
+  - `ldap_config_variables`
+  - `ssl_interface`
+  - `ssl_versions`
+  - `rabbitmq_group`
+  - `rabbitmq_home`
+  - `rabbitmq_user`
+- Add `rabbitmq_queue` and `rabbitmq_binding` types
+- Update the providers to be able to retry commands
+
+#### Bugfixes
+- Cleans up the formatting for rabbitmq.conf for readability
+- Update tag splitting in the `rabbitmqctl` provider for `rabbitmq_user` to work with comma or space separated tags
+- Do not enforce the source value for the yum provider (MODULES-1631)
+- Fix conditional around `$pin`
+- Remove broken SSL option in rabbitmqadmin.conf (MODULES-1691)
+- Fix issues in `rabbitmq_user` with admin and no tags
+- Fix issues in `rabbitmq_user` with tags not being sorted
+- Fix broken check for existing exchanges in `rabbitmq_exchange`
+
+## 5.0.0 (2014-12-22)
+### Summary
+
+This release fixes a longstanding security issue where the rabbitmq
+erlang cookie was exposed as a fact by managing the cookie with a
+provider. It also drops support for Puppet 2.7, adds many features
+and fixes several bugs.
+
+#### Backwards-incompatible Changes
+
+- Removed the rabbitmq\_erlang\_cookie fact and replaced the logic to
+  manage that cookie with a provider.
+- Dropped official support for Puppet 2.7 (EOL 9/30/2014
+  https://groups.google.com/forum/#!topic/puppet-users/QLguMcLraLE )
+- Changed the default value of $rabbitmq::params::ldap\_user\_dn\_pattern
+  to not contain a variable
+- Removed deprecated parameters: $rabbitmq::cluster\_disk\_nodes,
+  $rabbitmq::server::manage\_service, and
+  $rabbitmq::server::config\_mirrored\_queues
+
+#### Features
+
+- Add tcp\_keepalive parameter to enable TCP keepalive
+- Use https to download rabbitmqadmin tool when $rabbitmq::ssl is true
+- Add key\_content parameter for offline Debian package installations
+- Use 16 character apt key to avoid potential collisions
+- Add rabbitmq\_policy type, including support for rabbitmq <3.2.0
+- Add rabbitmq::ensure\_repo parameter
+- Add ability to change rabbitmq\_user password
+- Allow disk as a valid cluster node type
+
+#### Bugfixes
+
+- Avoid attempting to install rabbitmqadmin via a proxy (since it is
+  downloaded from localhost)
+- Optimize check for RHEL GPG key
+- Configure ssl\_listener in stomp only if using ssl
+- Use rpm as default package provider for RedHat, bringing the module in
+  line with the documented instructions to manage erlang separately and allowing
+  the default version and source parameters to become meaningful
+- Configure cacertfile only if verify\_none is not set
+- Use -q flag for rabbitmqctl commands to avoid parsing inconsistent
+  debug output
+- Use the -m flag for rabbitmqplugins commands, again to avoid parsing
+  inconsistent debug output
+- Strip backslashes from the rabbitmqctl output to avoid parsing issues
+- Fix limitation where version parameter was ignored
+- Add /etc/rabbitmq/rabbitmqadmin.conf to fix rabbitmqadmin port usage
+  when ssl is on
+- Fix linter errors and warnings
+- Add, update, and fix tests
+- Update docs
+
+## 4.1.0 (2014-08-20)
+### Summary
+
+This release adds several new features, fixes bugs, and improves tests and
+documentation.
+
+#### Features
+- Autorequire the rabbitmq-server service in the rabbitmq\_vhost type
+- Add credentials to rabbitmqadmin URL
+- Added $ssl\_only parameter to rabbitmq, rabbitmq::params, and
+rabbitmq::config
+- Added property tags to rabbitmq\_user provider
+
+#### Bugfixes
+- Fix erroneous commas in rabbitmq::config
+- Use correct ensure value for the rabbitmq\_stomp rabbitmq\_plugin
+- Set HOME env variable to nil when leveraging rabbitmq to remove type error
+from Python script
+- Fix location for rabbitmq-plugins for RHEL
+- Remove validation for package\_source to allow it to be set to false
+- Allow LDAP auth configuration without configuring stomp
+- Added missing $ssl\_verify and $ssl\_fail\_if\_no\_peer\_cert to rabbitmq::config
+
+## 4.0.0 (2014-05-16)
+### Summary
+
+This release includes many new features and bug fixes.  With the exception of
+erlang management this should be backwards compatible with 3.1.0.
+
+#### Backwards-incompatible Changes
+- erlang\_manage was removed.  You will need to manage erlang separately. See
+the README for more information on how to configure this.
+
+#### Features
+- Improved SSL support
+- Add LDAP support
+- Add ability to manage RabbitMQ repositories
+- Add ability to manage Erlang kernel configuration options
+- Improved handling of user tags
+- Use nanliu-staging module instead of hardcoded 'curl'
+- Switch to yum or zypper provider instead of rpm
+- Add ability to manage STOMP plugin installation.
+- Allow empty permission fields
+- Convert existing system tests to beaker acceptance tests.
+
+#### Bugfixes
+- exchanges no longer recreated on each puppet run if non-default vhost is used
+- Allow port to be UNSET
+- Re-added rabbitmq::server class
+- Deprecated previously unused manage\_service variable in favor of 
+  service\_manage
+- Use correct key for rabbitmq apt::source
+- config\_mirrored\_queues variable removed
+  - It previously did nothing, will now at least throw a warning if you try to
+    use it
+- Remove unnecessary dependency on Class['rabbitmq::repo::rhel'] in
+  rabbitmq::install
+
+
+## 3.1.0 (2013-09-14)
+### Summary
+
+This release focuses on a few small (but critical) bugfixes as well as extends
+the amount of custom RabbitMQ configuration you can do with the module.
+
+#### Features
+- You can now change RabbitMQ 'Config Variables' via the parameter `config_variables`.
+- You can now change RabbitMQ 'Environment Variables' via the parameter `environment_variables`.
+- ArchLinux support added.
+
+#### Fixes
+- Make use of the user/password parameters in rabbitmq\_exchange{}
+- Correct the read/write parameter order on set\_permissions/list\_permissions as
+  they were reversed.
+- Make the module pull down 3.1.5 by default.
+
+## 3.0.0 (2013-07-18)
+### Summary
+
+This release heavily refactors the RabbitMQ and changes functionality in
+several key ways.  Please pay attention to the new README.md file for
+details of how to interact with the class now.  Puppet 3 and RHEL are
+now fully supported.  The default version of RabbitMQ has changed to
+a 3.x release.
+
+#### Bugfixes
+
+- Improve travis testing options.
+- Stop reimporting the GPG key on every run on RHEL and Debian.
+- Fix documentation to make it clear you don't have to set provider => each time.
+- Reference the standard rabbitmq port in the documentation instead of a custom port.
+- Fixes to the README formatting.
+
+#### Features
+- Refactor the module to fix RHEL support.  All interaction with the module
+is now done through the main rabbitmq class.
+- Add support for mirrored queues (Only on Debian family distributions currently)
+- Add rabbitmq\_exchange provider (using rabbitmqadmin)
+- Add new `rabbitmq` class parameters:
+  - `manage_service`: Boolean to choose if Puppet should manage the service. (For pacemaker/HA setups)
+- Add SuSE support.
+
+#### Incompatible Changes
+
+- Rabbitmq::server has been removed and is now rabbitmq::config.  You should
+not use this class directly, only via the main rabbitmq class.
+
+## 2.1.0 (2013-04-11)
+
+- remove puppetversion from rabbitmq.config template
+- add cluster support
+- escape resource names in regexp
+
+## 2.0.2 (2012-07-31)
+- Re-release 2.0.1 with $EDITOR droppings cleaned up
+
+## 2.0.0 (2012-05-03)
+- added support for new-style admin users
+- added support for rabbitmq 2.7.1
+
+## 2.0.0rc1 (2011-06-14)
+- Massive refactor:
+  - added native types for user/vhost/user\_permissions
+  - added apt support for vendor packages
+  - added smoke tests
+
+## 1.0.4 (2011-04-08)
+- Update module for RabbitMQ 2.4.1 and rabbitmq-plugin-stomp package.
+
+## 1.0.3 (2011-03-24)
+- Initial release to the forge.  Reviewed by Cody.  Whitespace is good.
+
+## 1.0.2 (2011-03-22)
+- Whitespace only fix again...  ack '\t' is my friend...
+
+## 1.0.1 (2011-03-22)
+- Whitespace only fix.
+
+## 1.0.0 (2011-03-22)
+- Initial Release.  Manage the package, file and service.
index 297f85c..d645695 100644 (file)
@@ -1,3 +1,4 @@
+
                                  Apache License
                            Version 2.0, January 2004
                         http://www.apache.org/licenses/
       To apply the Apache License to your work, attach the following
       boilerplate notice, with the fields enclosed by brackets "[]"
       replaced with your own identifying information. (Don't include
-      the brackets!) The text should be enclosed in the appropriate
+      the brackets!)  The text should be enclosed in the appropriate
       comment syntax for the file format. We also recommend that a
       file or class name and description of purpose be included on the
       same "printed page" as the copyright notice for easier
       identification within third-party archives.
 
-   Copyright 2013 Puppet Labs
+   Copyright [yyyy] [name of copyright owner]
 
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
diff --git a/3rdparty/modules/rabbitmq/MAINTAINERS.md b/3rdparty/modules/rabbitmq/MAINTAINERS.md
new file mode 100644 (file)
index 0000000..bbff6e5
--- /dev/null
@@ -0,0 +1,6 @@
+## Maintenance
+
+Maintainers:
+  - Puppet Forge Modules Team `forge-modules |at| puppet |dot| com`
+
+Tickets: https://tickets.puppet.com/browse/MODULES. Make sure to set component to `rabbitmq`.
diff --git a/3rdparty/modules/rabbitmq/NOTICE b/3rdparty/modules/rabbitmq/NOTICE
new file mode 100644 (file)
index 0000000..ce5b072
--- /dev/null
@@ -0,0 +1,15 @@
+Puppet Module - puppetlabs-rabbitmq
+
+Copyright 2017 Puppet, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
\ No newline at end of file
index 72c1ea0..4e9bab8 100644 (file)
-#rabbitmq
+# rabbitmq
 
-####Table of Contents
+[![License](https://img.shields.io/github/license/voxpupuli/puppet-rabbitmq.svg)](https://github.com/voxpupuli/puppet-rabbitmq/blob/master/LICENSE)
+[![Build Status](https://travis-ci.org/voxpupuli/puppet-rabbitmq.svg?branch=master)](https://travis-ci.org/voxpupuli/puppet-rabbitmq)
+[![Code Coverage](https://coveralls.io/repos/github/voxpupuli/puppet-rabbitmq/badge.svg?branch=master)](https://coveralls.io/github/voxpupuli/puppet-rabbitmq)
+[![Puppet Forge](https://img.shields.io/puppetforge/v/puppet/rabbitmq.svg)](https://forge.puppetlabs.com/puppet/rabbitmq)
+[![Puppet Forge - downloads](https://img.shields.io/puppetforge/dt/puppet/rabbitmq.svg)](https://forge.puppetlabs.com/puppet/rabbitmq)
+[![Puppet Forge - endorsement](https://img.shields.io/puppetforge/e/puppet/rabbitmq.svg)](https://forge.puppetlabs.com/puppet/rabbitmq)
+[![Puppet Forge - scores](https://img.shields.io/puppetforge/f/puppet/rabbitmq.svg)](https://forge.puppetlabs.com/puppet/rabbitmq)
+
+#### Table of Contents
 
 1. [Overview](#overview)
 2. [Module Description - What the module does and why it is useful](#module-description)
 3. [Setup - The basics of getting started with rabbitmq](#setup)
     * [What rabbitmq affects](#what-rabbitmq-affects)
     * [Setup requirements](#setup-requirements)
-    * [Beginning with rabbitmq](#beginning-with-rabbitmq)
 4. [Usage - Configuration options and additional functionality](#usage)
 5. [Reference - An under-the-hood peek at what the module is doing and how](#reference)
 5. [Limitations - OS compatibility, etc.](#limitations)
    * [RedHat module dependencies](#redhat-module-dependecies)
 6. [Development - Guide for contributing to the module](#development)
 
-##Overview
+## Overview
 
 This module manages RabbitMQ (www.rabbitmq.com)
 
-##Module Description
+## Module Description
 The rabbitmq module sets up rabbitmq and has a number of providers to manage
 everything from vhosts to exchanges after setup.
 
-This module has been tested against 2.7.1 and is known to not support
-all features against earlier versions.
+This module has been tested against 3.5.x and 3.6.x (as well as earlier
+versions) and is known to not support all features against versions
+prior to 2.7.1.
 
-##Setup
+## Setup
 
-###What rabbitmq affects
+### What rabbitmq affects
 
 * rabbitmq repository files.
 * rabbitmq package.
 * rabbitmq configuration file.
 * rabbitmq service.
 
-###Beginning with rabbitmq
-
-
-```puppet
-include '::rabbitmq'
-```
-
-##Usage
+## Usage
 
 All options and configuration can be done through interacting with the parameters
-on the main rabbitmq class.  These are documented below.
+on the main rabbitmq class.
+These are now documented via [Puppet Strings](https://github.com/puppetlabs/puppet-strings)
+
+For convenience, some examples are duplicated here:
 
-##rabbitmq class
+## rabbitmq class
 
 To begin with the rabbitmq class controls the installation of rabbitmq.  In here
 you can control many parameters relating to the package and service, such as
 disabling puppet support of the service:
 
 ```puppet
-class { '::rabbitmq':
+class { 'rabbitmq':
   service_manage    => false,
   port              => '5672',
   delete_guest_user => true,
 }
 ```
 
-Or such as offline installation from intranet or local mirrors:
+### Environment Variables
+To use RabbitMQ Environment Variables, use the parameters `environment_variables` e.g.:
 
 ```puppet
-class { '::rabbitmq':
-   key_content      => template('openstack/rabbit.pub.key'),
-   package_gpg_key  => '/tmp/rabbit.pub.key',
+class { 'rabbitmq':
+  port                  => 5672,
+  environment_variables => {
+    'NODENAME'    => 'node01',
+    'SERVICENAME' => 'RabbitMQ'
+  }
 }
 ```
 
-And this one will use external package key source for any (apt/rpm) package provider:
+### Variables Configurable in rabbitmq.config
+To change RabbitMQ Config Variables in rabbitmq.config, use the parameters `config_variables` e.g.:
 
 ```puppet
-class { '::rabbitmq':
-   package_gpg_key  => 'http://www.some_site.some_domain/some_key.pub.key',
+class { 'rabbitmq':
+  port             => 5672,
+  config_variables => {
+    'hipe_compile' => true,
+    'frame_max'    => 131072,
+    'log_levels'   => "[{connection, info}]"
+  }
 }
 ```
 
-### Environment Variables
-To use RabbitMQ Environment Variables, use the parameters `environment_variables` e.g.:
+To change Erlang Kernel Config Variables in rabbitmq.config, use the parameters
+`config_kernel_variables` e.g.:
 
 ```puppet
 class { 'rabbitmq':
-  port              => '5672',
-  environment_variables   => {
-    'NODENAME'     => 'node01',
-    'SERVICENAME'  => 'RabbitMQ'
+  port                    => 5672,
+  config_kernel_variables => {
+    'inet_dist_listen_min' => 9100,
+    'inet_dist_listen_max' => 9105,
   }
 }
 ```
 
-### Variables Configurable in rabbitmq.config
-To change RabbitMQ Config Variables in rabbitmq.config, use the parameters `config_variables` e.g.:
+To change Management Plugin Config Variables in rabbitmq.config, use the parameters
+`config_management_variables` e.g.:
 
 ```puppet
 class { 'rabbitmq':
-  port              => '5672',
-  config_variables   => {
-    'hipe_compile'  => true,
-    'frame_max'     => 131072,
-    'log_levels'    => "[{connection, info}]"
+  config_management_variables => {
+    'rates_mode' => 'basic',
   }
 }
 ```
 
-To change Erlang Kernel Config Variables in rabbitmq.config, use the parameters
-`config_kernel_variables` e.g.:
+### Additional Variables Configurable in rabbitmq.config
+To change Additional Config Variables in rabbitmq.config, use the parameter
+`config_additional_variables` e.g.:
 
 ```puppet
 class { 'rabbitmq':
-  port              => '5672',
-  config_kernel_variables  => {
-    'inet_dist_listen_min' => 9100,
-    'inet_dist_listen_max' => 9105,
+  config_additional_variables => {
+    'autocluster' => '[{consul_service, "rabbit"},{cluster_name, "rabbit"}]',
+    'foo'         => '[{bar, "baz"}]'
   }
 }
 ```
+This will result in the following config appended to the config file:
+```
+% Additional config
+  {autocluster, [{consul_service, "rabbit"},{cluster_name, "rabbit"}]},
+  {foo, [{bar, "baz"}]}
+```
+(This is required for the [autocluster plugin](https://github.com/aweber/rabbitmq-autocluster)
 
 ### Clustering
 To use RabbitMQ clustering facilities, use the rabbitmq parameters
@@ -131,296 +149,11 @@ class { 'rabbitmq':
 }
 ```
 
-##Reference
-
-##Classes
-
-* rabbitmq: Main class for installation and service management.
-* rabbitmq::config: Main class for rabbitmq configuration/management.
-* rabbitmq::install: Handles package installation.
-* rabbitmq::params: Different configuration data for different systems.
-* rabbitmq::service: Handles the rabbitmq service.
-* rabbitmq::repo::apt: Handles apt repo for Debian systems.
-* rabbitmq::repo::rhel: Handles rpm repo for Redhat systems.
-
-###Parameters
-
-####`admin_enable`
-
-Boolean, if enabled sets up the management interface/plugin for RabbitMQ.
-
-####`cluster_node_type`
-
-Choose between disk and ram nodes.
-
-####`cluster_nodes`
-
-An array of nodes for clustering.
-
-####`cluster_partition_handling`
-
-Value to set for `cluster_partition_handling` RabbitMQ configuration variable.
-
-####`config`
-
-The file to use as the rabbitmq.config template.
-
-####`config_cluster`
-
-Boolean to enable or disable clustering support.
-
-####`config_kernel_variables`
-
-Hash of Erlang kernel configuration variables to set (see [Variables Configurable in rabbitmq.config](#variables-configurable-in-rabbitmq.config)).
-
-####`config_mirrored_queues`
-
-DEPRECATED
-
-Configuring queue mirroring should be done by setting the according policy for
-the queue. You can read more about it
-[here](http://www.rabbitmq.com/ha.html#genesis)
-
-####`config_path`
-
-The path to write the RabbitMQ configuration file to.
-
-####`config_stomp`
-
-Boolean to enable or disable stomp.
-
-####`config_variables`
-
-To set config variables in rabbitmq.config
-
-####`default_user`
-
-Username to set for the `default_user` in rabbitmq.config.
-
-####`default_pass`
-
-Password to set for the `default_user` in rabbitmq.config.
-
-####`delete_guest_user`
-
-Boolean to decide if we should delete the default guest user.
-
-####`env_config`
-
-The template file to use for rabbitmq_env.config.
-
-####`env_config_path`
-
-The path to write the rabbitmq_env.config file to.
-
-####`environment_variables`
-
-RabbitMQ Environment Variables in rabbitmq_env.config
-
-####`erlang_cookie`
-
-The erlang cookie to use for clustering - must be the same between all nodes.
-This value has no default and must be set explicitly if using clustering.
-
-####`file_limit`
-
-Set rabbitmq file ulimit. Defaults to 16384. Only available on systems with
-`$::osfamily == 'Debian'` or `$::osfamily == 'RedHat'`.
-
-####`key_content`
-
-Uses content method for Debian OS family. Should be a template for apt::source
-class. Overrides `package_gpg_key` behavior, if enabled. Undefined by default.
-
-####`ldap_auth`
-
-Boolean, set to true to enable LDAP auth.
-
-####`ldap_server`
-
-LDAP server to use for auth.
-
-####`ldap_user_dn_pattern`
-
-User DN pattern for LDAP auth.
-
-####`ldap_other_bind`
-
-How to bind to the LDAP server. Defaults to 'anon'.
-
-####`ldap_config_variables`
-
-Hash of other LDAP config variables.
-
-####`ldap_use_ssl`
-
-Boolean, set to true to use SSL for the LDAP server.
-
-####`ldap_port`
-
-Numeric port for LDAP server.
-
-####`ldap_log`
-
-Boolean, set to true to log LDAP auth.
-
-####`manage_repos`
-
-Boolean, whether or not to manage package repositories.
-
-####`management_port`
-
-The port for the RabbitMQ management interface.
-
-####`node_ip_address`
-
-The value of NODE_IP_ADDRESS in rabbitmq_env.config
-
-####`package_ensure`
-
-Determines the ensure state of the package.  Set to installed by default, but could
-be changed to latest.
-
-####`package_gpg_key`
-
-RPM package GPG key to import. Uses source method. Should be a URL for Debian/RedHat
-OS family, or a file name for RedHat OS family.
-Set to http://www.rabbitmq.com/rabbitmq-signing-key-public.asc by default.
-Note, that `key_content`, if specified, would override this parameter for Debian OS family.
-
-####`package_name`
-
-The name of the package to install.
-
-####`package_provider`
-
-What provider to use to install the package.
-
-####`package_source`
-
-Where should the package be installed from?
-
-On Debian- and Arch-based systems using the default package provider,
-this parameter is ignored and the package is installed from the
-rabbitmq repository, if enabled with manage_repo => true, or from the
-system repository otherwise. If you want to use dpkg as the
-package_provider, you must specify a local package_source.
-
-####`plugin_dir`
-
-Location of RabbitMQ plugins.
-
-####`port`
-
-The RabbitMQ port.
-
-####`service_ensure`
-
-The state of the service.
-
-####`service_manage`
-
-Determines if the service is managed.
-
-####`service_name`
-
-The name of the service to manage.
-
-####`ssl`
-
-Configures the service for using SSL.
-
-####`ssl_only`
-
-Configures the service to only use SSL.  No cleartext TCP listeners will be created.
-Requires that ssl => true and port => UNSET also
-
-####`ssl_cacert`
-
-CA cert path to use for SSL.
-
-####`ssl_cert`
-
-Cert to use for SSL.
-
-####`ssl_key`
-
-Key to use for SSL.
-
-####`ssl_management_port`
-
-SSL management port.
-
-####`ssl_stomp_port`
-
-SSL stomp port.
-
-####`ssl_verify`
-
-rabbitmq.config SSL verify setting.
-
-####`ssl_fail_if_no_peer_cert`
-
-rabbitmq.config `fail_if_no_peer_cert` setting.
-
-####`ssl_versions`
-
-Choose which SSL versions to enable. Example: `['tlsv1.2', 'tlsv1.1']`.
-
-Note that it is recommended to disable `sslv3` and `tlsv1` to prevent against POODLE and BEAST attacks. Please see the [RabbitMQ SSL](https://www.rabbitmq.com/ssl.html) documentation for more information.
-
-####`ssl_ciphers`
-
-Support only a given list of SSL ciphers. Example: `['dhe_rsa,aes_256_cbc,sha','dhe_dss,aes_256_cbc,sha','ecdhe_rsa,aes_256_cbc,sha']`.
-
-Supported ciphers in your install can be listed with:
- rabbitmqctl eval 'ssl:cipher_suites().'
-Functionality can be tested with cipherscan or similar tool: https://github.com/jvehent/cipherscan.git
-
-####`stomp_port`
-
-The port to use for Stomp.
-
-####`stomp_ensure`
-
-Boolean to install the stomp plugin.
-
-####`tcp_keepalive`
-
-Boolean to enable TCP connection keepalive for RabbitMQ service.
-
-####`version`
-
-Sets the version to install.
-
-On Debian- and Arch-based operating systems, the version parameter is
-ignored and the latest version is installed from the rabbitmq
-repository, if enabled with manage_repo => true, or from the system
-repository otherwise.
-
-####`wipe_db_on_cookie_change`
-
-Boolean to determine if we should DESTROY AND DELETE the RabbitMQ database.
-
-####`rabbitmq_user`
-
-String: OS dependent, default defined in param.pp. The system user the rabbitmq daemon runs as.
-
-####`rabbitmq_group`
-
-String: OS dependent, default defined in param.pp. The system group the rabbitmq daemon runs as.
-
-####`rabbitmq_home`
-
-String: OS dependent. default defined in param.pp. The home directory of the rabbitmq deamon.
-
-##Native Types
-
 ### rabbitmq\_user
 
 query all current users: `$ puppet resource rabbitmq_user`
 
-```
+```puppet
 rabbitmq_user { 'dan':
   admin    => true,
   password => 'bar',
@@ -436,7 +169,6 @@ rabbitmq_user { 'dan':
 }
 ```
 
-
 ### rabbitmq\_vhost
 
 query all current vhosts: `$ puppet resource rabbitmq_vhost`
@@ -451,14 +183,14 @@ rabbitmq_vhost { 'myvhost':
 
 ```puppet
 rabbitmq_exchange { 'myexchange@myvhost':
-  user     => 'dan',
-  password => 'bar',
-  type     => 'topic',
-  ensure   => present,
-  internal => false,
+  ensure      => present,
+  user        => 'dan',
+  password    => 'bar',
+  type        => 'topic',
+  internal    => false,
   auto_delete => false,
-  durable => true,
-  arguments => {
+  durable     => true,
+  arguments   => {
     hash-header => 'message-distribution-hash'
   }
 }
@@ -468,15 +200,15 @@ rabbitmq_exchange { 'myexchange@myvhost':
 
 ```puppet
 rabbitmq_queue { 'myqueue@myvhost':
+  ensure      => present,
   user        => 'dan',
   password    => 'bar',
   durable     => true,
   auto_delete => false,
   arguments   => {
-    x-message-ttl => 123,
+    x-message-ttl          => 123,
     x-dead-letter-exchange => 'other'
   },
-  ensure      => present,
 }
 ```
 
@@ -484,13 +216,40 @@ rabbitmq_queue { 'myqueue@myvhost':
 
 ```puppet
 rabbitmq_binding { 'myexchange@myqueue@myvhost':
+  ensure           => present,
   user             => 'dan',
   password         => 'bar',
   destination_type => 'queue',
   routing_key      => '#',
   arguments        => {},
+}
+```
+
+```puppet
+rabbitmq_binding { 'binding 1':
   ensure           => present,
+  source           => 'myexchange',
+  destination      => 'myqueue',
+  vhost            => 'myvhost',
+  user             => 'dan',
+  password         => 'bar',
+  destination_type => 'queue',
+  routing_key      => 'key1',
+  arguments        => {},
 }
+
+rabbitmq_binding { 'binding 2':
+  ensure           => present,
+  source           => 'myexchange',
+  destination      => 'myqueue',
+  vhost            => 'myvhost',
+  user             => 'dan',
+  password         => 'bar',
+  destination_type => 'queue',
+  routing_key      => 'key2',
+  arguments        => {},
+}
+
 ```
 
 ### rabbitmq\_user\_permissions
@@ -527,32 +286,45 @@ rabbitmq_plugin {'rabbitmq_stomp':
 }
 ```
 
-### rabbitmq\_erlang\_cookie
-
-This is essentially a private type used by the rabbitmq::config class
-to manage the erlang cookie. It replaces the rabbitmq_erlang_cookie fact
-from earlier versions of this module. It manages the content of the cookie
-usually located at "${rabbitmq_home}/.erlang.cookie", which includes
-stopping the rabbitmq service and wiping out the database at
-"${rabbitmq_home}/mnesia" if the user agrees to it. We don't recommend using
-this type directly.
+### rabbitmq\_parameter
 
-##Limitations
+```puppet
+  rabbitmq_parameter { 'documentumShovel@/':
+    component_name => '',
+    value          => {
+        'src-uri'    => 'amqp://',
+        'src-queue'  => 'my-queue',
+        'dest-uri'   => 'amqp://remote-server',
+        'dest-queue' => 'another-queue',
+    },
+  }
 
-This module has been built on and tested against Puppet 3.x.
+  rabbitmq_parameter { 'documentumFed@/':
+    component_name => 'federation-upstream',
+    value          => {
+        'uri'     => 'amqp://myserver',
+        'expires' => '360000',
+    },
+  }
+```
 
-The module has been tested on:
+## Reference
 
-* RedHat Enterprise Linux 5/6
-* Debian 6/7
-* CentOS 5/6
-* Ubuntu 12.04/14.04
+## Classes
 
-Testing on other platforms has been light and cannot be guaranteed.
+* rabbitmq: Main class for installation and service management.
+* rabbitmq::config: Main class for rabbitmq configuration/management.
+* rabbitmq::install: Handles package installation.
+* rabbitmq::params: Different configuration data for different systems.
+* rabbitmq::service: Handles the rabbitmq service.
+* rabbitmq::repo::apt: Handles apt repo for Debian systems.
+* rabbitmq::repo::rhel: Handles rpm repo for Redhat systems.
 
 ### Module dependencies
 
-If running CentOS/RHEL, and using the yum provider, ensure the epel repo is present.
+If running CentOS/RHEL, ensure the epel repo, or another repo containing a
+suitable Erlang version, is present. On Debian systems, puppetlabs/apt
+(>=2.0.0 < 5.0.0) is a soft dependency.
 
 To have a suitable erlang version installed on RedHat and Debian systems,
 you have to install another puppet module from http://forge.puppetlabs.com/garethr/erlang with:
@@ -574,36 +346,19 @@ For Debian systems:
       ensure => 'latest',
     }
 
-This module also depends on the excellent nanliu/staging module on the Forge:
-
-    puppet module install nanliu-staging
-
-### Downgrade Issues
-
-Be advised that there were configuration file syntax and other changes made between RabbitMQ
-versions 2 and 3. In order to downgrade from 3 to 2 (not that this is a terribly good idea)
-you will need to manually remove all RabbitMQ configuration files (``/etc/rabbitmq``) and
-the mnesia directory (usually ``/var/lib/rabbitmq/mnesia``). The latter action will delete
-any and all messages stored to disk.
-
-Failure to do this will result in RabbitMQ failing to start with a cryptic error message about
-"init terminating in do_boot", containing "rabbit_upgrade,maybe_upgrade_mnesia".
-
-##Development
+This module also depends on voxpupuli/archive to install rabbitmqadmin.
 
-Puppet Labs modules on the Puppet Forge are open projects, and community
-contributions are essential for keeping them great. We can’t access the
-huge number of platforms and myriad of hardware, software, and deployment
-configurations that Puppet is intended to serve.
+## Development
 
-We want to keep it as easy as possible to contribute changes so that our
-modules work in your environment. There are a few guidelines that we need
-contributors to follow so that we can have a chance of keeping on top of things.
+This module is maintained by [Vox Pupuli](https://voxpupuli.org/). Voxpupuli
+welcomes new contributions to this module, especially those that include
+documentation and rspec tests. We are happy to provide guidance if necessary.
 
-You can read the complete module contribution guide [on the Puppet Labs wiki.](http://projects.puppetlabs.com/projects/module-site/wiki/Module_contributing)
+Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for more details.
 
 ### Authors
 * Jeff McCune <jeff@puppetlabs.com>
 * Dan Bode <dan@puppetlabs.com>
 * RPM/RHEL packages by Vincent Janelle <randomfrequency@gmail.com>
 * Puppetlabs Module Team
+* Voxpupuli Team
index 181157e..279580a 100644 (file)
@@ -1,10 +1,92 @@
 require 'puppetlabs_spec_helper/rake_tasks'
-require 'puppet-lint/tasks/puppet-lint'
 
+# load optional tasks for releases
+# only available if gem group releases is installed
+begin
+  require 'puppet_blacksmith/rake_tasks'
+  require 'voxpupuli/release/rake_tasks'
+  require 'puppet-strings/tasks'
+rescue LoadError
+end
+
+PuppetLint.configuration.log_format = '%{path}:%{line}:%{check}:%{KIND}:%{message}'
 PuppetLint.configuration.fail_on_warnings = true
 PuppetLint.configuration.send('relative')
-PuppetLint.configuration.send('disable_80chars')
+PuppetLint.configuration.send('disable_140chars')
 PuppetLint.configuration.send('disable_class_inherits_from_params_class')
 PuppetLint.configuration.send('disable_documentation')
 PuppetLint.configuration.send('disable_single_quote_string_with_variables')
-PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]
+
+exclude_paths = %w(
+  pkg/**/*
+  vendor/**/*
+  .vendor/**/*
+  spec/**/*
+)
+PuppetLint.configuration.ignore_paths = exclude_paths
+PuppetSyntax.exclude_paths = exclude_paths
+
+desc 'Auto-correct puppet-lint offenses'
+task 'lint:auto_correct' do
+  PuppetLint.configuration.fix = true
+  Rake::Task[:lint].invoke
+end
+
+desc 'Run acceptance tests'
+RSpec::Core::RakeTask.new(:acceptance) do |t|
+  t.pattern = 'spec/acceptance'
+end
+
+desc 'Run tests metadata_lint, release_checks'
+task test: [
+  :metadata_lint,
+  :release_checks,
+]
+
+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
+end
+
+desc "Print supported beaker sets"
+task 'beaker_sets', [:directory] do |t, args|
+  directory = args[:directory]
+
+  metadata = JSON.load(File.read('metadata.json'))
+
+  (metadata['operatingsystem_support'] || []).each do |os|
+    (os['operatingsystemrelease'] || []).each do |release|
+      if directory
+        beaker_set = "#{directory}/#{os['operatingsystem'].downcase}-#{release}"
+      else
+        beaker_set = "#{os['operatingsystem'].downcase}-#{release}-x64"
+      end
+
+      filename = "spec/acceptance/nodesets/#{beaker_set}.yml"
+
+      puts beaker_set if File.exists? filename
+    end
+  end
+end
+
+begin
+  require 'github_changelog_generator/task'
+  GitHubChangelogGenerator::RakeTask.new :changelog do |config|
+    version = (Blacksmith::Modulefile.new).version
+    config.future_release = "v#{version}" if 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'
+    metadata_json = File.join(File.dirname(__FILE__), 'metadata.json')
+    metadata = JSON.load(File.read(metadata_json))
+    config.project = metadata['name']
+  end
+rescue LoadError
+end
+# vim: syntax=ruby
diff --git a/3rdparty/modules/rabbitmq/TODO b/3rdparty/modules/rabbitmq/TODO
deleted file mode 100644 (file)
index 8ae578e..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-provider TODO -
-  - password should be a property and not a param
-     - what if we tried to log in as that user?
-  - can permissions from list_user_permissions contain whitespace?
-  - what about defaultfor :true?
-  - prefetching for performance
-  - rabbit plugin should require rabbitmq class
-  - rabbitmq class should be renamed server??
-  - service name should default to -server
-  - cannot find stomp package
index f228740..d174dbd 100644 (file)
 {
-  "CHANGELOG.md": "43cb464088dc5a6558ce1f2f119a0f48",
-  "CONTRIBUTING.md": "e2b8e8e433fc76b3798b7fe435f49375",
-  "Gemfile": "e62c96457cdaab2a09f1a37479ea6351",
-  "LICENSE": "6089b6bd1f0d807edb8bdfd76da0b038",
-  "README.md": "1babcf19c9f1f10e3a594b6b89620b49",
-  "Rakefile": "d953eb985f82600dc3b9ac6e1f2cfe64",
-  "TODO": "53cf21155ec1e83e3e167f711fd3ff9f",
+  "CHANGELOG.md": "aca6bc1405b6148a1ae00630d41348de",
+  "Gemfile": "a427f4577f53f3ac769632eb79c01559",
+  "HISTORY.md": "2dc7d0508d34c37cb41128d89e962e7d",
+  "LICENSE": "3b83ef96387f14655fc854ddc3c6bd57",
+  "MAINTAINERS.md": "1b0321bd01f2a6d4ce0515d57b834143",
+  "NOTICE": "a40e0f06a8c1b4a948b81f718c5602be",
+  "README.md": "6ae9ba282f104a5806f9172d3f09ab13",
+  "Rakefile": "3c6f218e7e63e1a6e24251f365423e49",
+  "examples/erlang_deps.pp": "3a9251d500fd2cd1147d1a2abc9bdc02",
+  "examples/full.pp": "33133b2d34a5291a7cdd998cd333e93c",
+  "examples/permissions/add.pp": "b53b627a4d5521af8cdcfd83d99d3824",
+  "examples/plugin.pp": "5fc1271d5684dd51fa94b67876179e63",
+  "examples/repo/apt.pp": "08f6497b6561f274a8d9e2ee5400e33e",
+  "examples/server.pp": "56dba93d20d5b716b66df2e0f4f693d6",
+  "examples/service.pp": "f06296b103daf449f9e7644fd9eee58b",
+  "examples/site.pp": "653334bf690768a8af42cd13e8e53ef2",
+  "examples/user/add.pp": "d9f051f1edc91114097b54f818729ea8",
+  "examples/vhosts/add.pp": "f054d84ac87dc206f586d779fc312fa6",
   "files/README.markdown": "3d44458cc68d8513b51e3b56c604eec4",
   "files/plugins/amqp_client-2.3.1.ez": "543ec53b7208fdc2dc4eba3684868011",
   "files/plugins/rabbit_stomp-2.3.1.ez": "f552a986409a6d407a080b1aceb80d20",
-  "lib/puppet/provider/rabbitmq_binding/rabbitmqadmin.rb": "1b7bd0bd9ce3e0303f52178487170f42",
-  "lib/puppet/provider/rabbitmq_erlang_cookie/ruby.rb": "80c99bb254471ed32e6ee25a9dcb6f73",
-  "lib/puppet/provider/rabbitmq_exchange/rabbitmqadmin.rb": "f79a7aab47e00a6d29910e09550f03d9",
-  "lib/puppet/provider/rabbitmq_plugin/rabbitmqplugins.rb": "393eac704e7f906052f4d1c285de364e",
-  "lib/puppet/provider/rabbitmq_policy/rabbitmqctl.rb": "ea39ffa45a616fcd755c8121338fcbcd",
-  "lib/puppet/provider/rabbitmq_queue/rabbitmqadmin.rb": "b971f7ec8f5454623d82b35a6c178432",
-  "lib/puppet/provider/rabbitmq_user/rabbitmqctl.rb": "eeddc61ef6c57e7225c818e494fc6e47",
-  "lib/puppet/provider/rabbitmq_user_permissions/rabbitmqctl.rb": "35c1224ef9f1191c61cc577d7b496395",
-  "lib/puppet/provider/rabbitmq_vhost/rabbitmqctl.rb": "3e4754621f03062a4620950134cb2042",
-  "lib/puppet/provider/rabbitmqctl.rb": "59d97156cab9dba9008426e650df17bc",
-  "lib/puppet/type/rabbitmq_binding.rb": "5c19f5f98247d4ee5286e16242a53441",
-  "lib/puppet/type/rabbitmq_erlang_cookie.rb": "ad082a425169634391888fcd9a2131bb",
-  "lib/puppet/type/rabbitmq_exchange.rb": "3ed3e62c8f85cc4e41a81cd07915727c",
-  "lib/puppet/type/rabbitmq_plugin.rb": "6a707d089d0e50a949ecf8fae114eab0",
-  "lib/puppet/type/rabbitmq_policy.rb": "6e421d709978675d36bd6e1e361be498",
-  "lib/puppet/type/rabbitmq_queue.rb": "653a5e3eaa69c6d0d29f477c40362c13",
-  "lib/puppet/type/rabbitmq_user.rb": "4cac856b77ccebff4e9fd63e71ccf611",
-  "lib/puppet/type/rabbitmq_user_permissions.rb": "2d12cd7d9c8bd2afd2e4a4b24a35b58b",
-  "lib/puppet/type/rabbitmq_vhost.rb": "ff6fc35bb9c22b1c493b84adf6bb3167",
-  "log/centos-6-x64-vcloud/2015-05-22_18_55_23/sut.log": "062a9bc8d4ae0dd97e5ee74784a26c9d",
-  "log/centos-6-x64-vcloud/2015-05-22_18_57_07/sut.log": "4b5085af02e0fba4e6ae0addee258ce1",
-  "log/debian-7-x64-vcloud/2015-05-22_18_35_45/sut.log": "b6c8b56197861c0e6c3a46fb730f3334",
-  "log/debian-7-x64-vcloud/2015-05-22_18_49_58/sut.log": "a4d4b5f2278e5cba66026ad9f0156de4",
-  "log/debian-7-x64-vcloud/2015-05-22_19_10_48/sut.log": "27d3e61d3a9d9da3b87501a49f49aece",
-  "log/debian-7-x64-vcloud/2015-05-22_19_11_31/sut.log": "ad6cbb9cbd128e0848c5f5bcfe3d494a",
-  "log/default/2015-05-22_18_35_28/sut.log": "d41d8cd98f00b204e9800998ecf8427e",
-  "manifests/config.pp": "df0d180fd482f63eb8b26ca2ca83febf",
-  "manifests/init.pp": "52b0931a4d2083e90e36c331d6450084",
-  "manifests/install/rabbitmqadmin.pp": "64a81e06996b5ecc147795e64f3c6e7b",
-  "manifests/install.pp": "0f700b158484bfdacb2ce3ec65b939c9",
+  "lib/facter/erl_ssl_path.rb": "23c959a454a56fb017caef2eff6823f2",
+  "lib/facter/rabbitmq_nodename.rb": "721ca655917a00c65ac6072ef8412a65",
+  "lib/facter/rabbitmq_version.rb": "feb647a06cf10f09024a3b063a4dc906",
+  "lib/puppet/provider/rabbitmq_binding/rabbitmqadmin.rb": "a0480ad4b0ad5ebdb8197b56d85481de",
+  "lib/puppet/provider/rabbitmq_erlang_cookie/ruby.rb": "264998dd115e1bbd17851b34e7f0fafb",
+  "lib/puppet/provider/rabbitmq_exchange/rabbitmqadmin.rb": "0f0ede44e8c675781087507d31b02d92",
+  "lib/puppet/provider/rabbitmq_parameter/rabbitmqctl.rb": "4ad7618c9638cc5931e8f42d0db000c1",
+  "lib/puppet/provider/rabbitmq_plugin/rabbitmqplugins.rb": "6549134306d37ce581ddfd9c79e74f6f",
+  "lib/puppet/provider/rabbitmq_policy/rabbitmqctl.rb": "a38c72233e49e82553bc582147182ebe",
+  "lib/puppet/provider/rabbitmq_queue/rabbitmqadmin.rb": "ef7541ad426595332389f9ef699bddf8",
+  "lib/puppet/provider/rabbitmq_user/rabbitmqctl.rb": "261a25ad40f0609635dc563f91f4d31e",
+  "lib/puppet/provider/rabbitmq_user_permissions/rabbitmqctl.rb": "e5c13c85d24f1b92211fbc19028a7f2b",
+  "lib/puppet/provider/rabbitmq_vhost/rabbitmqctl.rb": "87966e7e56b60909b430f7f9a63754fd",
+  "lib/puppet/provider/rabbitmqctl.rb": "147cbe0a172658bcbbd6d4c2c5c77d3f",
+  "lib/puppet/type/rabbitmq_binding.rb": "28014dd738d8e15ec5fe909e1c0b7620",
+  "lib/puppet/type/rabbitmq_erlang_cookie.rb": "47c93fcedb7dd5fe3cf1b1392361071b",
+  "lib/puppet/type/rabbitmq_exchange.rb": "a227a2f924d715a0d4339acabf09db34",
+  "lib/puppet/type/rabbitmq_parameter.rb": "982080644db620c80a8c65379c1902ca",
+  "lib/puppet/type/rabbitmq_plugin.rb": "4bf11beeef4ca32f0d0b19e83cd6da5b",
+  "lib/puppet/type/rabbitmq_policy.rb": "9d451905ed900175e1b8777062641f4d",
+  "lib/puppet/type/rabbitmq_queue.rb": "3ab6475182e18e8d775dedc8cefa7980",
+  "lib/puppet/type/rabbitmq_user.rb": "e8aa82c32004db1929e19c54578b9b63",
+  "lib/puppet/type/rabbitmq_user_permissions.rb": "7aaa66091c3f9e4670e79aa299d7906b",
+  "lib/puppet/type/rabbitmq_vhost.rb": "8901580e183399ce561fbcb8057c3d51",
+  "locales/config.yaml": "827f30d1fc7f6dc606f2e513a7d0a60c",
+  "manifests/config.pp": "7f635b5120c97997015359d947290c4c",
+  "manifests/init.pp": "212370a779f3d16d7b7f936dec887040",
+  "manifests/install/rabbitmqadmin.pp": "fdcc018b1142ee0f446c019af2b6bdc7",
+  "manifests/install.pp": "7fb9f463a22ddcf033ac9f8138ba65ea",
   "manifests/management.pp": "93c41d238f2734fa7c5944b8f32f6cc4",
-  "manifests/params.pp": "260d40f1ece0f76e4a86079455e12c87",
-  "manifests/repo/apt.pp": "a5b1a06ac77526e8764bc754bc0718c4",
-  "manifests/repo/rhel.pp": "1c4cfcba993e0667b65ec3c5deafbac7",
-  "manifests/server.pp": "3bc67c2006c1144c50c3fc04394cd800",
-  "manifests/service.pp": "ec365148eec9e739ca06e24c972cd5de",
-  "metadata.json": "cfe09daeacab44586c336f6ea55d6aff",
+  "manifests/params.pp": "17a1b63513f829be6ce6ef9e2e9af4fb",
+  "manifests/repo/apt.pp": "2982cffe7f0eda1c67e714fd9ee44537",
+  "manifests/repo/rhel.pp": "5189fe3435ff5c20df1bc5af15f46d58",
+  "manifests/server.pp": "b94a24083f7314a3140e3edd4a7b9307",
+  "manifests/service.pp": "e897516f5020d3da859efbadfa5ea684",
+  "metadata.json": "bfabf79c87f82faa9dbdf28d8ea96f97",
   "spec/README.markdown": "32a1fc0121c28aff554ef5d422b8b51e",
-  "spec/acceptance/class_spec.rb": "26e9ed9f9391692419f110624c091390",
-  "spec/acceptance/clustering_spec.rb": "1aa359697551e1ddf2a030cac5b8f2f5",
-  "spec/acceptance/delete_guest_user_spec.rb": "7c5da810cf2a3a124943eb56c46cac83",
-  "spec/acceptance/nodesets/centos-59-x64.yml": "57eb3e471b9042a8ea40978c467f8151",
-  "spec/acceptance/nodesets/centos-6-x64-vcloud.yml": "aaa7352c8a5f5244a6f9008112918074",
-  "spec/acceptance/nodesets/centos-64-x64-pe.yml": "ec075d95760df3d4702abea1ce0a829b",
-  "spec/acceptance/nodesets/centos-65-x64.yml": "3e5c36e6aa5a690229e720f4048bb8af",
-  "spec/acceptance/nodesets/debian-7-x64-vcloud.yml": "83c1c189f46fced0a8d5ec27a3e12877",
-  "spec/acceptance/nodesets/default.yml": "d65958bdf25fb31eb4838fd984b555df",
-  "spec/acceptance/nodesets/ubuntu-server-10044-x64.yml": "75e86400b7889888dc0781c0ae1a1297",
-  "spec/acceptance/nodesets/ubuntu-server-12042-x64.yml": "d30d73e34cd50b043c7d14e305955269",
-  "spec/acceptance/nodesets/ubuntu-server-1404-x64.yml": "5f0aed10098ac5b78e4217bb27c7aaf0",
-  "spec/acceptance/policy_spec.rb": "28211810baf46a25e0e9dda0097ce2db",
-  "spec/acceptance/queue_spec.rb": "b7d54bd218982f191b8a909652d65d09",
-  "spec/acceptance/rabbitmqadmin_spec.rb": "7844ca3109ed35147ee8bcd2c8a045c6",
-  "spec/acceptance/server_spec.rb": "f88e85559c71afcf5d80b01ffd78877d",
-  "spec/acceptance/user_spec.rb": "1f560f25a45e249bafdae3964efabaf2",
-  "spec/acceptance/vhost_spec.rb": "75c867b618eae881b9f13272cffdc777",
-  "spec/acceptance/zz281_spec.rb": "56051cd811c1f2546bcdce2590860306",
-  "spec/classes/rabbitmq_spec.rb": "45725cd9e08e33a4ea809a7ec48ee2f8",
-  "spec/spec.opts": "a600ded995d948e393fbe2320ba8e51c",
-  "spec/spec_helper.rb": "0db89c9a486df193c0e40095422e19dc",
-  "spec/spec_helper_acceptance.rb": "9aa45d83b91ef209b17abeace32781bf",
-  "spec/unit/puppet/provider/rabbitmq_binding/rabbitmqadmin_spec.rb": "f855af3424e3573b37f015f460b3f3f5",
-  "spec/unit/puppet/provider/rabbitmq_exchange/rabbitmqadmin_spec.rb": "3a909fddbe1019b6bf68d43408c5fa70",
-  "spec/unit/puppet/provider/rabbitmq_plugin/rabbitmqctl_spec.rb": "430f9d204f9a0135772b90f10fb36c76",
-  "spec/unit/puppet/provider/rabbitmq_policy/rabbitmqctl_spec.rb": "9b9213cc615b7e164a5b2c754c57f2d0",
-  "spec/unit/puppet/provider/rabbitmq_queue/rabbitmqadmin_spec.rb": "6f7664ce99673b73114ec17afa20febe",
-  "spec/unit/puppet/provider/rabbitmq_user/rabbitmqctl_spec.rb": "b6835fdfed6719217325e36667e9b416",
-  "spec/unit/puppet/provider/rabbitmq_user_permissions/rabbitmqctl_spec.rb": "7a16aee31dbf747d0226ded6ce8a3b45",
-  "spec/unit/puppet/provider/rabbitmq_vhost/rabbitmqctl_spec.rb": "1f8d85c70d5f288a2ac803c99dc3eb72",
-  "spec/unit/puppet/type/rabbitmq_binding_spec.rb": "60bde85ca7075b0584bfd57bd86ebfd3",
-  "spec/unit/puppet/type/rabbitmq_exchange_spec.rb": "797b8a550f0620731efc2280a0f30a53",
-  "spec/unit/puppet/type/rabbitmq_policy_spec.rb": "387079c6a0235602c4ef18b456c2b282",
-  "spec/unit/puppet/type/rabbitmq_queue_spec.rb": "568f66963bd4392b91fe347b3e1baa45",
-  "spec/unit/puppet/type/rabbitmq_user_permissions_spec.rb": "eb5b390edb76be3a2b8899e9b996d6e1",
-  "spec/unit/puppet/type/rabbitmq_user_spec.rb": "80e042c92f64e3a5f97a83bbbde85d42",
-  "spec/unit/puppet/type/rabbitmq_vhost_spec.rb": "162e29065eb5ce664842b66bcfa0ac34",
+  "spec/acceptance/class_spec.rb": "672cacf8d2cdf5f18f05758b2f3cc5d7",
+  "spec/acceptance/clustering_spec.rb": "4955bd71da17a8204c7381346d4f7880",
+  "spec/acceptance/delete_guest_user_spec.rb": "a968fa68172e99ebcf2c3b79ac3436cb",
+  "spec/acceptance/nodesets/archlinux-2-x64.yml": "daafcfcb4c8c8766856f52cec6ae5e86",
+  "spec/acceptance/nodesets/centos-511-x64.yml": "ca8258bc835dd985a1754689d124cd66",
+  "spec/acceptance/nodesets/centos-6-x64.yml": "58065782a8d40780d9728257a23504cd",
+  "spec/acceptance/nodesets/centos-66-x64-pe.yml": "e68e03dc562bf58f7c5bba54a1a34619",
+  "spec/acceptance/nodesets/centos-7-x64.yml": "68d3556f670b8ac0a169a8270ff8c37a",
+  "spec/acceptance/nodesets/debian-78-x64.yml": "56af2760a64c13a0bccd59404435939c",
+  "spec/acceptance/nodesets/debian-8-x64.yml": "d2d2977900989f30086ad251a14a1f39",
+  "spec/acceptance/nodesets/debian-82-x64.yml": "26f2f696e6073549fe0a844f9a46f85b",
+  "spec/acceptance/nodesets/default.yml": "b42da5a1ea0c964567ba7495574b8808",
+  "spec/acceptance/nodesets/docker/centos-5.yml": "7be89192f37653cc187d6d5212d9ff3e",
+  "spec/acceptance/nodesets/docker/centos-6.yml": "4f135653fce91e0a0547f7caa0ba48b8",
+  "spec/acceptance/nodesets/docker/centos-7.yml": "01ffbd81ab40aeca31cac4f28611f70a",
+  "spec/acceptance/nodesets/docker/debian-7.yml": "9ff595ea5a917cdefa76074cec6231dc",
+  "spec/acceptance/nodesets/docker/debian-8.yml": "b4339feeafa4271176c75ef2c30753a5",
+  "spec/acceptance/nodesets/docker/debian-9.yml": "75a4064dabe9bf3af4b0820290e84d30",
+  "spec/acceptance/nodesets/docker/ubuntu-12.04.yml": "cd32551771ad120f5c060c208ef48f4e",
+  "spec/acceptance/nodesets/docker/ubuntu-14.04.yml": "aab4956b48b40cbd7e831825f6a99d31",
+  "spec/acceptance/nodesets/docker/ubuntu-16.04.yml": "74c5071349f7ac0525ea134f6e99cfda",
+  "spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml": "b3dc2d81918fcc6d56855c88ba5b7ce8",
+  "spec/acceptance/nodesets/ec2/image_templates.yaml": "516f9c4c3407993a100090ce9e1a643c",
+  "spec/acceptance/nodesets/ec2/rhel-73-x64.yml": "e74670a1cb8eea32afc879a5d786f9bd",
+  "spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml": "2506efcc9fb420132edc37bf88d6e21d",
+  "spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml": "87efd97ff1b073c3448f429a8ffc5a7c",
+  "spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml": "e9db4dd16c60c52b433694130c2583a0",
+  "spec/acceptance/nodesets/fedora-24-x64.yml": "431cd85b87a65a55af193a360aa52f26",
+  "spec/acceptance/nodesets/fedora-25-x64.yml": "807fbf45f95fc7bc2af8c689d34e4160",
+  "spec/acceptance/nodesets/fedora-26-x64.yml": "e7ee1e18590548ff098192c2127c6697",
+  "spec/acceptance/nodesets/fedora-27-x64.yml": "326a10c4eb327ccd85775dfa0f76e5c1",
+  "spec/acceptance/nodesets/ubuntu-server-1204-x64.yml": "0dd7639bf95bfb18169ebba9a2bac163",
+  "spec/acceptance/nodesets/ubuntu-server-1404-x64.yml": "7455367b784060b921360b29a56cd74c",
+  "spec/acceptance/nodesets/ubuntu-server-1604-x64.yml": "37673118cc3bf052755d65fb5dd90226",
+  "spec/acceptance/parameter_spec.rb": "93a911a4a6e8a8f0631ab62388b64c5c",
+  "spec/acceptance/policy_spec.rb": "ef747d433d6ddb5ec481c234434e88ca",
+  "spec/acceptance/queue_spec.rb": "09dd18dab23da4246948327243d43c61",
+  "spec/acceptance/rabbitmqadmin_spec.rb": "507f5a99c6e1135259597cbc7faf62ab",
+  "spec/acceptance/server_spec.rb": "c56c19ce559cc73054a826b5b3ba1f5f",
+  "spec/acceptance/user_spec.rb": "5edc29d0a70e53d2314852d60ce61247",
+  "spec/acceptance/vhost_spec.rb": "bf2bf77189aed14f3708f74f1eea933e",
+  "spec/classes/coverage_spec.rb": "166c74e93a4e70e9de79ae69f3c10e1d",
+  "spec/classes/rabbitmq_spec.rb": "fe55d925c7705acf8ab7da0d5cad78c9",
+  "spec/default_facts.yml": "3da74b0aff340a4fbcca9cc4eba104c1",
+  "spec/spec_helper.rb": "993a58ebe59987d8557cf671577ac2dc",
+  "spec/spec_helper_acceptance.rb": "3152bd07b46176e48651910199c2f49b",
+  "spec/spec_helper_local.rb": "142df2ef02d754111c12dbca203d4b89",
+  "spec/unit/facter/util/fact_erl_ssl_path_spec.rb": "81e19366b3517dc5f38c1702ac941477",
+  "spec/unit/facter/util/fact_rabbitmq_nodename_spec.rb": "069ac104500c9172d92037b3221808e4",
+  "spec/unit/facter/util/fact_rabbitmq_version_spec.rb": "b4d39f702cfdd498749c192377e284f1",
+  "spec/unit/puppet/provider/rabbitmq_binding/rabbitmqadmin_spec.rb": "2aa2a11c23de6f333509625783be1283",
+  "spec/unit/puppet/provider/rabbitmq_exchange/rabbitmqadmin_spec.rb": "2b2ecbf2cef7164eb9576b36633d4337",
+  "spec/unit/puppet/provider/rabbitmq_parameter/rabbitmqctl_spec.rb": "2d25099152320ca64f0afd0314c29945",
+  "spec/unit/puppet/provider/rabbitmq_plugin/rabbitmqctl_spec.rb": "bef1df43e8955ea9e1ecc2da9364df6e",
+  "spec/unit/puppet/provider/rabbitmq_policy/rabbitmqctl_spec.rb": "63ccc3f3fa09f7fae30d1bb9bda4cf16",
+  "spec/unit/puppet/provider/rabbitmq_queue/rabbitmqadmin_spec.rb": "06adfd5487b4340ae5dac326227bdb68",
+  "spec/unit/puppet/provider/rabbitmq_user/rabbitmqctl_spec.rb": "65c9c6fc4afe3fc2f02c888769f80bac",
+  "spec/unit/puppet/provider/rabbitmq_user_permissions/rabbitmqctl_spec.rb": "f18827d229b2e15cc7c6a31c1dbd2a08",
+  "spec/unit/puppet/provider/rabbitmq_vhost/rabbitmqctl_spec.rb": "72a45e92967d7854e1545a055ddde227",
+  "spec/unit/puppet/type/rabbitmq_binding_spec.rb": "348c9c04b96e87d76009686577be12dc",
+  "spec/unit/puppet/type/rabbitmq_exchange_spec.rb": "a5d489fe4aeb40db3b07e6119f3dec95",
+  "spec/unit/puppet/type/rabbitmq_parameter_spec.rb": "9650c694d3a0736e5bc9c2d2196224c0",
+  "spec/unit/puppet/type/rabbitmq_plugin_spec.rb": "a676e0083fe906502864a7dfe4a5f8cc",
+  "spec/unit/puppet/type/rabbitmq_policy_spec.rb": "0b6c51058459d535b9d4a152972cfc08",
+  "spec/unit/puppet/type/rabbitmq_queue_spec.rb": "90515dbddd104e594ea6e20eb26021a2",
+  "spec/unit/puppet/type/rabbitmq_user_permissions_spec.rb": "20ad6006ae71e7370d89fd43f28305b8",
+  "spec/unit/puppet/type/rabbitmq_user_spec.rb": "f8f2ae38cc938f561e847c004e591dea",
+  "spec/unit/puppet/type/rabbitmq_vhost_spec.rb": "28b13add025d2b17b80d1d56df23a158",
   "templates/README.markdown": "aada0a1952329e46b98695349dba6203",
   "templates/default.erb": "800642a1015e3eaa37f18100d1d63f41",
+  "templates/inetrc.erb": "070640c8b2d0b3092ca9ef1d89633b13",
   "templates/limits.conf": "c5f991430be0bcb7446eb7291cf34bf8",
-  "templates/rabbitmq-env.conf.erb": "174bf40d6f7fed0cf29604e858cc96c4",
+  "templates/rabbitmq-env.conf.erb": "ecd1d32b26edf5d6ffb02eafae75dfba",
   "templates/rabbitmq-server.service.d/limits.conf": "80655f98baca4c7bc673359c5f846690",
-  "templates/rabbitmq.config.erb": "1d0ed42cd32aa466b4f3c4d3efb252cb",
-  "templates/rabbitmqadmin.conf.erb": "df2a15c7ee621cced815916cb0c56a5f",
-  "tests/erlang_deps.pp": "4a2ac78d56802dee3a66e3246633b603",
-  "tests/full.pp": "fb1e9f59fe63846c60b402202152eeb0",
-  "tests/permissions/add.pp": "b53b627a4d5521af8cdcfd83d99d3824",
-  "tests/plugin.pp": "5fc1271d5684dd51fa94b67876179e63",
-  "tests/repo/apt.pp": "4ea43b4f8dcaf474ec11d796efef66a3",
-  "tests/server.pp": "56dba93d20d5b716b66df2e0f4f693d6",
-  "tests/service.pp": "f06296b103daf449f9e7644fd9eee58b",
-  "tests/site.pp": "653334bf690768a8af42cd13e8e53ef2",
-  "tests/user/add.pp": "d9f051f1edc91114097b54f818729ea8",
-  "tests/vhosts/add.pp": "f054d84ac87dc206f586d779fc312fa6"
+  "templates/rabbitmq.config.erb": "f2f663969e197d1b4fb30a253f68ac64",
+  "templates/rabbitmqadmin.conf.erb": "428c661b4ad428e495bd01f1ad8604d0"
 }
\ No newline at end of file
diff --git a/3rdparty/modules/rabbitmq/examples/erlang_deps.pp b/3rdparty/modules/rabbitmq/examples/erlang_deps.pp
new file mode 100644 (file)
index 0000000..20cd6b5
--- /dev/null
@@ -0,0 +1,5 @@
+# install first the garethr-erlang module. See README.md
+include erlang
+
+class { 'erlang': epel_enable => true}
+Class['erlang'] -> Class['rabbitmq']
diff --git a/3rdparty/modules/rabbitmq/examples/full.pp b/3rdparty/modules/rabbitmq/examples/full.pp
new file mode 100644 (file)
index 0000000..2862ac8
--- /dev/null
@@ -0,0 +1,25 @@
+class { 'rabbitmq::repo::apt':
+  pin => '900',
+}
+
+-> class { 'rabbitmq::server':
+  delete_guest_user => true,
+#  version           => '2.4.1',
+}
+
+-> rabbitmq_user { 'dan':
+  admin    => true,
+  password => 'pass',
+  provider => 'rabbitmqctl',
+}
+
+-> rabbitmq_vhost { 'myhost':
+  provider => 'rabbitmqctl',
+}
+
+rabbitmq_user_permissions { 'dan@myhost':
+  configure_permission => '.*',
+  read_permission      => '.*',
+  write_permission     => '.*',
+  provider             => 'rabbitmqctl',
+}
diff --git a/3rdparty/modules/rabbitmq/examples/permissions/add.pp b/3rdparty/modules/rabbitmq/examples/permissions/add.pp
new file mode 100644 (file)
index 0000000..fb71af1
--- /dev/null
@@ -0,0 +1,9 @@
+rabbitmq_user { 'blah7':
+  password => 'foo',
+}
+rabbitmq_vhost { 'test5': }
+rabbitmq_user_permissions { 'blah7@test5':
+  configure_permission => 'config2',
+  read_permission      => 'ready',
+  #write_permission     => 'ready',
+}
diff --git a/3rdparty/modules/rabbitmq/examples/plugin.pp b/3rdparty/modules/rabbitmq/examples/plugin.pp
new file mode 100644 (file)
index 0000000..6c5605b
--- /dev/null
@@ -0,0 +1,11 @@
+class { 'rabbitmq::server':
+    config_stomp => true,
+}
+
+$rabbitmq_plugins = [ 'amqp_client', 'rabbitmq_stomp' ]
+
+rabbitmq_plugin { $rabbitmq_plugins:
+  ensure   => present,
+  require  => Class['rabbitmq::server'],
+  provider => 'rabbitmqplugins',
+}
diff --git a/3rdparty/modules/rabbitmq/examples/repo/apt.pp b/3rdparty/modules/rabbitmq/examples/repo/apt.pp
new file mode 100644 (file)
index 0000000..936a75f
--- /dev/null
@@ -0,0 +1,2 @@
+# requires pupetlabs-apt
+include ::rabbitmq::repo::apt
diff --git a/3rdparty/modules/rabbitmq/examples/server.pp b/3rdparty/modules/rabbitmq/examples/server.pp
new file mode 100644 (file)
index 0000000..caea893
--- /dev/null
@@ -0,0 +1,5 @@
+class { 'rabbitmq::server':
+  port              => '5672',
+  delete_guest_user => true,
+  version           => 'latest',
+}
diff --git a/3rdparty/modules/rabbitmq/examples/service.pp b/3rdparty/modules/rabbitmq/examples/service.pp
new file mode 100644 (file)
index 0000000..9a00d2b
--- /dev/null
@@ -0,0 +1 @@
+class { 'rabbitmq::service': }
diff --git a/3rdparty/modules/rabbitmq/examples/site.pp b/3rdparty/modules/rabbitmq/examples/site.pp
new file mode 100644 (file)
index 0000000..75ebcfe
--- /dev/null
@@ -0,0 +1,16 @@
+node default {
+
+  $rabbitmq_plugins = [ 'amqp_client', 'rabbitmq_stomp' ]
+
+  class { 'rabbitmq::server':
+    config => '[ {rabbit_stomp, [{tcp_listeners, [1234]} ]} ].',
+  }
+
+  # Required for MCollective
+  rabbitmq_plugin { $rabbitmq_plugins:
+    ensure   => present,
+    require  => Class['rabbitmq::server'],
+    provider => 'rabbitmqplugins',
+  }
+}
+
diff --git a/3rdparty/modules/rabbitmq/examples/user/add.pp b/3rdparty/modules/rabbitmq/examples/user/add.pp
new file mode 100644 (file)
index 0000000..2c3a870
--- /dev/null
@@ -0,0 +1,4 @@
+rabbitmq_user { ['blah2', 'blah3', 'blah4']:
+  password => 'phoey!',
+  #provider => 'rabbitmqctl',
+}
diff --git a/3rdparty/modules/rabbitmq/examples/vhosts/add.pp b/3rdparty/modules/rabbitmq/examples/vhosts/add.pp
new file mode 100644 (file)
index 0000000..d818a19
--- /dev/null
@@ -0,0 +1 @@
+rabbitmq_vhost { ['fooey', 'blah']: }
diff --git a/3rdparty/modules/rabbitmq/lib/facter/erl_ssl_path.rb b/3rdparty/modules/rabbitmq/lib/facter/erl_ssl_path.rb
new file mode 100644 (file)
index 0000000..c8f41f6
--- /dev/null
@@ -0,0 +1,13 @@
+# Fact to get the ssl path for the erlang distribution in the current
+# system as described in the RabbitMQ docs [1].
+#
+# [1] https://www.rabbitmq.com/clustering-ssl.html
+Facter.add(:erl_ssl_path) do
+  setcode do
+    if Facter::Util::Resolution.which('erl')
+      data = Facter::Core::Execution.execute("erl -eval 'io:format(\"~p\", [code:lib_dir(ssl, ebin)]),halt().' -noshell")
+      # erl returns the string with quotes, strip them off
+      data.gsub!(%r{\A"|"\Z}, '')
+    end
+  end
+end
diff --git a/3rdparty/modules/rabbitmq/lib/facter/rabbitmq_nodename.rb b/3rdparty/modules/rabbitmq/lib/facter/rabbitmq_nodename.rb
new file mode 100644 (file)
index 0000000..8dee93c
--- /dev/null
@@ -0,0 +1,8 @@
+Facter.add(:rabbitmq_nodename) do
+  setcode do
+    if Facter::Util::Resolution.which('rabbitmqctl')
+      rabbitmq_nodename = Facter::Core::Execution.execute('rabbitmqctl status 2>&1')
+      %r{^Status of node '?([\w\.\-]+@[\w\.\-]+)'?}.match(rabbitmq_nodename)[1]
+    end
+  end
+end
diff --git a/3rdparty/modules/rabbitmq/lib/facter/rabbitmq_version.rb b/3rdparty/modules/rabbitmq/lib/facter/rabbitmq_version.rb
new file mode 100644 (file)
index 0000000..57369d8
--- /dev/null
@@ -0,0 +1,8 @@
+Facter.add(:rabbitmq_version) do
+  setcode do
+    if Facter::Util::Resolution.which('rabbitmqadmin')
+      rabbitmq_version = Facter::Core::Execution.execute('rabbitmqadmin --version 2>&1')
+      %r{^rabbitmqadmin ([\w\.]+)}.match(rabbitmq_version)[1]
+    end
+  end
+end
index e02c466..e7f9345 100644 (file)
@@ -1,73 +1,76 @@
 require 'json'
 require 'puppet'
-Puppet::Type.type(:rabbitmq_binding).provide(:rabbitmqadmin) do
+require 'digest'
 
-  if Puppet::PUPPETVERSION.to_f < 3
-    commands :rabbitmqctl   => 'rabbitmqctl'
-    commands :rabbitmqadmin => '/usr/local/bin/rabbitmqadmin'
-  else
-    has_command(:rabbitmqctl, 'rabbitmqctl') do
-      environment :HOME => "/tmp"
-    end
-    has_command(:rabbitmqadmin, '/usr/local/bin/rabbitmqadmin') do
-      environment :HOME => "/tmp"
-    end
+Puppet::Type.type(:rabbitmq_binding).provide(:rabbitmqadmin) do
+  has_command(:rabbitmqctl, 'rabbitmqctl') do
+    environment HOME: '/tmp'
+  end
+  has_command(:rabbitmqadmin, '/usr/local/bin/rabbitmqadmin') do
+    environment HOME: '/tmp'
   end
-  defaultfor :feature => :posix
+
+  confine feature: :posix
+
+  # Without this, the composite namevar stuff doesn't work properly.
+  mk_resource_methods
 
   def should_vhost
     if @should_vhost
       @should_vhost
     else
-      @should_vhost = resource[:name].split('@').last
+      @should_vhost = resource[:vhost]
     end
   end
 
   def self.all_vhosts
     vhosts = []
-    rabbitmqctl('list_vhosts', '-q').split(/\n/).collect do |vhost|
+    rabbitmqctl('list_vhosts', '-q').split(%r{\n}).map do |vhost|
       vhosts.push(vhost)
     end
     vhosts
   end
 
   def self.all_bindings(vhost)
-    rabbitmqctl('list_bindings', '-q', '-p', vhost, 'source_name', 'destination_name', 'destination_kind', 'routing_key', 'arguments').split(/\n/)
+    rabbitmqctl('list_bindings', '-q', '-p', vhost, 'source_name', 'destination_name', 'destination_kind', 'routing_key', 'arguments').split(%r{\n})
   end
 
   def self.instances
     resources = []
     all_vhosts.each do |vhost|
-      all_bindings(vhost).collect do |line|
-        source_name, destination_name, destination_type, routing_key, arguments = line.split(/\t/)
+      all_bindings(vhost).map do |line|
+        source_name, destination_name, destination_type, routing_key, arguments = line.split(%r{\t})
         # Convert output of arguments from the rabbitmqctl command to a json string.
         if !arguments.nil?
-          arguments = arguments.gsub(/^\[(.*)\]$/, "").gsub(/\{("(?:.|\\")*?"),/, '{\1:').gsub(/\},\{/, ",")
-          if arguments == ""
-            arguments = '{}'
-          end
+          arguments = arguments.gsub(%r{^\[(.*)\]$}, '').gsub(%r{\{("(?:.|\\")*?"),}, '{\1:').gsub(%r{\},\{}, ',')
+          arguments = '{}' if arguments == ''
         else
           arguments = '{}'
         end
-        if (source_name != '')
-          binding = {
-            :destination_type => destination_type,
-            :routing_key      => routing_key,
-            :arguments        => JSON.parse(arguments),
-            :ensure           => :present,
-            :name             => "%s@%s@%s" % [source_name, destination_name, vhost],
-          }
-          resources << new(binding) if binding[:name]
-        end
+        hashed_name = Digest::SHA256.hexdigest format('%s@%s@%s@%s', source_name, destination_name, vhost, routing_key)
+        next if source_name.empty?
+        binding = {
+          source: source_name,
+          destination: destination_name,
+          vhost: vhost,
+          destination_type: destination_type,
+          routing_key: routing_key,
+          arguments: JSON.parse(arguments),
+          ensure: :present,
+          name: hashed_name
+        }
+        resources << new(binding) if binding[:name]
       end
     end
     resources
   end
 
+  # see
+  # https://github.com/puppetlabs/puppetlabs-netapp/blob/d0a655665463c69c932f835ba8756be32417a4e9/lib/puppet/provider/netapp_qtree/sevenmode.rb#L66-L73
   def self.prefetch(resources)
-    packages = instances
-    resources.keys.each do |name|
-      if provider = packages.find{ |pkg| pkg.name == name }
+    bindings = instances
+    resources.each do |name, res|
+      if (provider = bindings.find { |binding| binding.source == res[:source] && binding.destination == res[:destination] && binding.vhost == res[:vhost] && binding.routing_key == res[:routing_key] })
         resources[name].provider = provider
       end
     end
@@ -79,34 +82,26 @@ Puppet::Type.type(:rabbitmq_binding).provide(:rabbitmqadmin) do
 
   def create
     vhost_opt = should_vhost ? "--vhost=#{should_vhost}" : ''
-    name = resource[:name].split('@').first
-    destination = resource[:name].split('@')[1]
     arguments = resource[:arguments]
-    if arguments.nil?
-      arguments = {}
-    end
+    arguments = {} if arguments.nil?
     rabbitmqadmin('declare',
-      'binding',
-      vhost_opt,
-      "--user=#{resource[:user]}",
-      "--password=#{resource[:password]}",
-      '-c',
-      '/etc/rabbitmq/rabbitmqadmin.conf',
-      "source=#{name}",
-      "destination=#{destination}",
-      "arguments=#{arguments.to_json}",
-      "routing_key=#{resource[:routing_key]}",
-      "destination_type=#{resource[:destination_type]}"
-    )
+                  'binding',
+                  vhost_opt,
+                  "--user=#{resource[:user]}",
+                  "--password=#{resource[:password]}",
+                  '-c',
+                  '/etc/rabbitmq/rabbitmqadmin.conf',
+                  "source=#{resource[:source]}",
+                  "destination=#{resource[:destination]}",
+                  "arguments=#{arguments.to_json}",
+                  "routing_key=#{resource[:routing_key]}",
+                  "destination_type=#{resource[:destination_type]}")
     @property_hash[:ensure] = :present
   end
 
   def destroy
     vhost_opt = should_vhost ? "--vhost=#{should_vhost}" : ''
-    name = resource[:name].split('@').first
-    destination = resource[:name].split('@')[1]
-    rabbitmqadmin('delete', 'binding', vhost_opt, "--user=#{resource[:user]}", "--password=#{resource[:password]}", '-c', '/etc/rabbitmq/rabbitmqadmin.conf', "source=#{name}", "destination_type=#{resource[:destination_type]}", "destination=#{destination}", "properties_key=#{resource[:routing_key]}")
+    rabbitmqadmin('delete', 'binding', vhost_opt, "--user=#{resource[:user]}", "--password=#{resource[:password]}", '-c', '/etc/rabbitmq/rabbitmqadmin.conf', "source=#{resource[:source]}", "destination_type=#{resource[:destination_type]}", "destination=#{resource[:destination]}", "properties_key=#{resource[:routing_key]}")
     @property_hash[:ensure] = :absent
   end
-
 end
index 58c8b3c..47dfdd3 100644 (file)
@@ -1,11 +1,7 @@
 require 'puppet'
 require 'set'
 Puppet::Type.type(:rabbitmq_erlang_cookie).provide(:ruby) do
-
-  defaultfor :feature => :posix
-  has_command(:puppet, 'puppet') do
-    environment :PATH => '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin'
-  end
+  confine feature: :posix
 
   def exists?
     # Hack to prevent the create method from being called.
@@ -14,25 +10,22 @@ Puppet::Type.type(:rabbitmq_erlang_cookie).provide(:ruby) do
   end
 
   def content=(value)
-    if resource[:force] == :true # Danger!
-      puppet('resource', 'service', resource[:service_name], 'ensure=stopped')
-      FileUtils.rm_rf(resource[:rabbitmq_home] + File::PATH_SEPARATOR + 'mnesia')
-      File.open(resource[:path], 'w') do |cookie|
-        cookie.chmod(0400)
-        cookie.write(value)
-      end
-      FileUtils.chown(resource[:rabbitmq_user], resource[:rabbitmq_group], resource[:path])
-    else
-      fail("The current erlang cookie needs to change. In order to do this the RabbitMQ database needs to be wiped.  Please set force => true to allow this to happen automatically.")
+    raise('The current erlang cookie needs to change. In order to do this the RabbitMQ database needs to be wiped.  Please set force => true to allow this to happen automatically.') unless resource[:force] == :true # Danger!
+
+    Puppet::Type.type(:service).new(name: resource[:service_name]).provider.stop
+    FileUtils.rm_rf(resource[:rabbitmq_home] + File::SEPARATOR + 'mnesia')
+    File.open(resource[:path], 'w') do |cookie|
+      cookie.chmod(0o400)
+      cookie.write(value)
     end
+    FileUtils.chown(resource[:rabbitmq_user], resource[:rabbitmq_group], resource[:path])
   end
 
   def content
-    if File.exists?(resource[:path])
+    if File.exist?(resource[:path])
       File.read(resource[:path])
     else
       ''
     end
   end
-
 end
index c1cff09..bdff0ed 100644 (file)
@@ -1,19 +1,18 @@
 require 'puppet'
 require File.expand_path(File.join(File.dirname(__FILE__), '..', 'rabbitmqctl'))
-Puppet::Type.type(:rabbitmq_exchange).provide(:rabbitmqadmin, :parent => Puppet::Provider::Rabbitmqctl) do
-
+Puppet::Type.type(:rabbitmq_exchange).provide(:rabbitmqadmin, parent: Puppet::Provider::Rabbitmqctl) do
   if Puppet::PUPPETVERSION.to_f < 3
-    commands :rabbitmqctl   => 'rabbitmqctl'
-    commands :rabbitmqadmin => '/usr/local/bin/rabbitmqadmin'
+    commands rabbitmqctl: 'rabbitmqctl'
+    commands rabbitmqadmin: '/usr/local/bin/rabbitmqadmin'
   else
     has_command(:rabbitmqctl, 'rabbitmqctl') do
-      environment :HOME => "/tmp"
+      environment HOME: '/tmp'
     end
     has_command(:rabbitmqadmin, '/usr/local/bin/rabbitmqadmin') do
-      environment :HOME => "/tmp"
+      environment HOME: '/tmp'
     end
   end
-  defaultfor :feature => :posix
+  confine feature: :posix
 
   def should_vhost
     if @should_vhost
@@ -24,56 +23,45 @@ Puppet::Type.type(:rabbitmq_exchange).provide(:rabbitmqadmin, :parent => Puppet:
   end
 
   def self.all_vhosts
-    vhosts = []
-    self.run_with_retries {
-      rabbitmqctl('-q', 'list_vhosts')
-    }.split(/\n/).each do |vhost|
-      vhosts.push(vhost)
-    end
-    vhosts
+    run_with_retries { rabbitmqctl('-q', 'list_vhosts') }.split(%r{\n})
   end
 
   def self.all_exchanges(vhost)
-    exchanges = []
-    self.run_with_retries {
+    exchange_list = run_with_retries do
       rabbitmqctl('-q', 'list_exchanges', '-p', vhost, 'name', 'type', 'internal', 'durable', 'auto_delete', 'arguments')
-    }.split(/\n/).each do |exchange|
-      exchanges.push(exchange)
     end
-    exchanges
+    exchange_list.split(%r{\n}).reject { |exchange| exchange =~ %r{^federation:} }
   end
 
   def self.instances
     resources = []
     all_vhosts.each do |vhost|
-        all_exchanges(vhost).each do |line|
-            name, type, internal, durable, auto_delete, arguments = line.split()
-            if type.nil?
-                # if name is empty, it will wrongly get the type's value.
-                # This way type will get the correct value
-                type = name
-                name = ''
-            end
-            # Convert output of arguments from the rabbitmqctl command to a json string.
-            if !arguments.nil?
-              arguments = arguments.gsub(/^\[(.*)\]$/, "").gsub(/\{("(?:.|\\")*?"),/, '{\1:').gsub(/\},\{/, ",")
-              if arguments == ""
-                arguments = '{}'
-              end
-            else
-              arguments = '{}'
-            end
-            exchange = {
-              :type   => type,
-              :ensure => :present,
-              :internal => internal,
-              :durable => durable,
-              :auto_delete => auto_delete,
-              :name   => "%s@%s" % [name, vhost],
-              :arguments => JSON.parse(arguments),
-            }
-            resources << new(exchange) if exchange[:type]
+      all_exchanges(vhost).each do |line|
+        name, type, internal, durable, auto_delete, arguments = line.split
+        if type.nil?
+          # if name is empty, it will wrongly get the type's value.
+          # This way type will get the correct value
+          type = name
+          name = ''
+        end
+        # Convert output of arguments from the rabbitmqctl command to a json string.
+        if !arguments.nil?
+          arguments = arguments.gsub(%r{^\[(.*)\]$}, '').gsub(%r{\{("(?:.|\\")*?"),}, '{\1:').gsub(%r{\},\{}, ',')
+          arguments = '{}' if arguments == ''
+        else
+          arguments = '{}'
         end
+        exchange = {
+          type: type,
+          ensure: :present,
+          internal: internal,
+          durable: durable,
+          auto_delete: auto_delete,
+          name: format('%s@%s', name, vhost),
+          arguments: JSON.parse(arguments)
+        }
+        resources << new(exchange) if exchange[:type]
+      end
     end
     resources
   end
@@ -81,7 +69,7 @@ Puppet::Type.type(:rabbitmq_exchange).provide(:rabbitmqadmin, :parent => Puppet:
   def self.prefetch(resources)
     packages = instances
     resources.keys.each do |name|
-      if provider = packages.find{ |pkg| pkg.name == name }
+      if (provider = packages.find { |pkg| pkg.name == name })
         resources[name].provider = provider
       end
     end
@@ -95,10 +83,13 @@ Puppet::Type.type(:rabbitmq_exchange).provide(:rabbitmqadmin, :parent => Puppet:
     vhost_opt = should_vhost ? "--vhost=#{should_vhost}" : ''
     name = resource[:name].split('@')[0]
     arguments = resource[:arguments]
-    if arguments.nil?
-      arguments = {}
-    end
-    rabbitmqadmin('declare', 'exchange', vhost_opt, "--user=#{resource[:user]}", "--password=#{resource[:password]}", "name=#{name}", "type=#{resource[:type]}", "internal=#{resource[:internal]}", "durable=#{resource[:durable]}", "auto_delete=#{resource[:auto_delete]}", "arguments=#{arguments.to_json}", '-c', '/etc/rabbitmq/rabbitmqadmin.conf')
+    arguments = {} if arguments.nil?
+    cmd = ['declare', 'exchange', vhost_opt, "--user=#{resource[:user]}", "--password=#{resource[:password]}", "name=#{name}", "type=#{resource[:type]}"]
+    cmd << "internal=#{resource[:internal]}" if resource[:internal]
+    cmd << "durable=#{resource[:durable]}" if resource[:durable]
+    cmd << "auto_delete=#{resource[:auto_delete]}" if resource[:auto_delete]
+    cmd += ["arguments=#{arguments.to_json}", '-c', '/etc/rabbitmq/rabbitmqadmin.conf']
+    rabbitmqadmin(*cmd)
     @property_hash[:ensure] = :present
   end
 
@@ -108,5 +99,4 @@ Puppet::Type.type(:rabbitmq_exchange).provide(:rabbitmqadmin, :parent => Puppet:
     rabbitmqadmin('delete', 'exchange', vhost_opt, "--user=#{resource[:user]}", "--password=#{resource[:password]}", "name=#{name}", '-c', '/etc/rabbitmq/rabbitmqadmin.conf')
     @property_hash[:ensure] = :absent
   end
-
 end
diff --git a/3rdparty/modules/rabbitmq/lib/puppet/provider/rabbitmq_parameter/rabbitmqctl.rb b/3rdparty/modules/rabbitmq/lib/puppet/provider/rabbitmq_parameter/rabbitmqctl.rb
new file mode 100644 (file)
index 0000000..5c910d7
--- /dev/null
@@ -0,0 +1,81 @@
+require 'json'
+require 'puppet/util/package'
+
+require File.expand_path(File.join(File.dirname(__FILE__), '..', 'rabbitmqctl'))
+Puppet::Type.type(:rabbitmq_parameter).provide(:rabbitmqctl, parent: Puppet::Provider::Rabbitmqctl) do
+  confine feature: :posix
+
+  # cache parameters
+  def self.parameters(name, vhost)
+    @parameters = {} unless @parameters
+    unless @parameters[vhost]
+      @parameters[vhost] = {}
+      parameter_list = run_with_retries do
+        rabbitmqctl('list_parameters', '-q', '-p', vhost)
+      end
+      parameter_list.split(%r{\n}).each do |line|
+        raise Puppet::Error, "cannot parse line from list_parameter:#{line}" unless line =~ %r{^(\S+)\s+(\S+)\s+(\S+)$}
+        @parameters[vhost][Regexp.last_match(2)] = {
+          component_name: Regexp.last_match(1),
+          value: JSON.parse(Regexp.last_match(3))
+        }
+      end
+    end
+    @parameters[vhost][name]
+  end
+
+  def parameters(name, vhost)
+    self.class.parameters(vhost, name)
+  end
+
+  def should_parameter
+    @should_parameter ||= resource[:name].rpartition('@').first
+  end
+
+  def should_vhost
+    @should_vhost ||= resource[:name].rpartition('@').last
+  end
+
+  def create
+    set_parameter
+  end
+
+  def destroy
+    rabbitmqctl('clear_parameter', '-p', should_vhost, 'shovel', should_parameter)
+  end
+
+  def exists?
+    parameters(should_vhost, should_parameter)
+  end
+
+  def component_name
+    parameters(should_vhost, should_parameter)[:component_name]
+  end
+
+  def component_name=(_component_name)
+    set_parameter
+  end
+
+  def value
+    parameters(should_vhost, should_parameter)[:value]
+  end
+
+  def value=(_value)
+    set_parameter
+  end
+
+  def set_parameter
+    return if @set_parameter
+
+    @set_parameter = true
+    resource[:value] ||= value
+    resource[:component_name] ||= component_name
+    rabbitmqctl(
+      'set_parameter',
+      '-p', should_vhost,
+      resource[:component_name],
+      should_parameter,
+      resource[:value].to_json
+    )
+  end
+end
index 7ab5420..9437cf3 100644 (file)
@@ -1,40 +1,35 @@
 require File.expand_path(File.join(File.dirname(__FILE__), '..', 'rabbitmqctl'))
-Puppet::Type.type(:rabbitmq_plugin).provide(:rabbitmqplugins, :parent => Puppet::Provider::Rabbitmqctl) do
-
-  if Puppet::PUPPETVERSION.to_f < 3
-    if Facter.value(:osfamily) == 'RedHat'
-      commands :rabbitmqplugins => '/usr/lib/rabbitmq/bin/rabbitmq-plugins'
-    else
-      commands :rabbitmqplugins => 'rabbitmq-plugins'
+Puppet::Type.type(:rabbitmq_plugin).provide(:rabbitmqplugins, parent: Puppet::Provider::Rabbitmqctl) do
+  # Prefer rabbitmq-plugins if it's in $PATH, but fall back to /usr/lib/rabbitmq/bin
+  if Puppet::Util.which('rabbitmq-plugins')
+    has_command(:rabbitmqplugins, 'rabbitmq-plugins') do
+      environment HOME: '/tmp'
     end
   else
-    if Facter.value(:osfamily) == 'RedHat'
-      has_command(:rabbitmqplugins, '/usr/lib/rabbitmq/bin/rabbitmq-plugins') do
-        environment :HOME => "/tmp"
-      end
-    else
-      has_command(:rabbitmqplugins, 'rabbitmq-plugins') do
-        environment :HOME => "/tmp"
-      end
+    has_command(:rabbitmqplugins, '/usr/lib/rabbitmq/bin/rabbitmq-plugins') do
+      environment HOME: '/tmp'
     end
   end
 
-  defaultfor :feature => :posix
+  confine feature: :posix
 
   def self.instances
-    self.run_with_retries {
+    plugin_list = run_with_retries do
       rabbitmqplugins('list', '-E', '-m')
-    }.split(/\n/).map do |line|
-      if line =~ /^(\S+)$/
-        new(:name => $1)
-      else
-        raise Puppet::Error, "Cannot parse invalid plugins line: #{line}"
-      end
+    end
+
+    plugin_list.split(%r{\n}).map do |line|
+      raise Puppet::Error, "Cannot parse invalid plugins line: #{line}" unless line =~ %r{^(\S+)$}
+      new(name: Regexp.last_match(1))
     end
   end
 
   def create
-    rabbitmqplugins('enable', resource[:name])
+    if resource[:umask].nil?
+      rabbitmqplugins('enable', resource[:name])
+    else
+      Puppet::Util.withumask(resource[:umask]) { rabbitmqplugins('enable', resource[:name]) }
+    end
   end
 
   def destroy
@@ -42,11 +37,6 @@ Puppet::Type.type(:rabbitmq_plugin).provide(:rabbitmqplugins, :parent => Puppet:
   end
 
   def exists?
-    self.class.run_with_retries {
-      rabbitmqplugins('list', '-E', '-m')
-    }.split(/\n/).detect do |line|
-      line.match(/^#{resource[:name]}$/)
-    end
+    self.class.run_with_retries { rabbitmqplugins('list', '-E', '-m') }.split(%r{\n}).include? resource[:name]
   end
-
 end
index 7e73295..1d112e9 100644 (file)
@@ -2,37 +2,54 @@ require 'json'
 require 'puppet/util/package'
 
 require File.expand_path(File.join(File.dirname(__FILE__), '..', 'rabbitmqctl'))
-Puppet::Type.type(:rabbitmq_policy).provide(:rabbitmqctl, :parent => Puppet::Provider::Rabbitmqctl) do
-
-  defaultfor :feature => :posix
+Puppet::Type.type(:rabbitmq_policy).provide(:rabbitmqctl, parent: Puppet::Provider::Rabbitmqctl) do
+  confine feature: :posix
 
   # cache policies
-  def self.policies(name, vhost)
+  def self.policies(vhost, name)
     @policies = {} unless @policies
     unless @policies[vhost]
       @policies[vhost] = {}
-      self.run_with_retries {
+      policy_list = run_with_retries do
         rabbitmqctl('list_policies', '-q', '-p', vhost)
-      }.split(/\n/).each do |line|
-        # rabbitmq<3.2 does not support the applyto field
-        # 1 2      3?  4  5                                            6
-        # / ha-all all .* {"ha-mode":"all","ha-sync-mode":"automatic"} 0
-        if line =~ /^(\S+)\s+(\S+)\s+(all|exchanges|queues)?\s*(\S+)\s+(\S+)\s+(\d+)$/
-          applyto = $3 || 'all'
-          @policies[vhost][$2] = {
-            :applyto    => applyto,
-            :pattern    => $4,
-            :definition => JSON.parse($5),
-            :priority   => $6}
-        else
-          raise Puppet::Error, "cannot parse line from list_policies:#{line}"
-        end
+      end
+
+      # rabbitmq<3.2 does not support the applyto field
+      # 1 2      3?  4  5                                            6
+      # / ha-all all .* {"ha-mode":"all","ha-sync-mode":"automatic"} 0 << This is for RabbitMQ v < 3.7.0
+      # / ha-all .* all {"ha-mode":"all","ha-sync-mode":"automatic"} 0 << This is for RabbitMQ v >= 3.7.0
+      if Puppet::Util::Package.versioncmp(rabbitmq_version, '3.7') >= 0
+        regex = %r{^(\S+)\s+(\S+)\s+(\S+)\s+(all|exchanges|queues)?\s+(\S+)\s+(\d+)$}
+        applyto_index = 4
+        pattern_index = 3
+      else
+        regex = %r{^(\S+)\s+(\S+)\s+(all|exchanges|queues)?\s*(\S+)\s+(\S+)\s+(\d+)$}
+        applyto_index = 3
+        pattern_index = 4
+      end
+
+      policy_list.split(%r{\n}).each do |line|
+        raise Puppet::Error, "cannot parse line from list_policies:#{line}" unless line =~ regex
+        n          = Regexp.last_match(2)
+        applyto    = Regexp.last_match(applyto_index) || 'all'
+        priority   = Regexp.last_match(6)
+        definition = JSON.parse(Regexp.last_match(5))
+        # be aware that the gsub will reset the captures
+        # from the regexp above
+        pattern    = Regexp.last_match(pattern_index).to_s.gsub(%r{\\\\}, '\\')
+
+        @policies[vhost][n] = {
+          applyto: applyto,
+          pattern: pattern,
+          definition: definition,
+          priority: priority
+        }
       end
     end
     @policies[vhost][name]
   end
 
-  def policies(name, vhost)
+  def policies(vhost, name)
     self.class.policies(vhost, name)
   end
 
@@ -60,7 +77,7 @@ Puppet::Type.type(:rabbitmq_policy).provide(:rabbitmqctl, :parent => Puppet::Pro
     policies(should_vhost, should_policy)[:pattern]
   end
 
-  def pattern=(pattern)
+  def pattern=(_pattern)
     set_policy
   end
 
@@ -68,7 +85,7 @@ Puppet::Type.type(:rabbitmq_policy).provide(:rabbitmqctl, :parent => Puppet::Pro
     policies(should_vhost, should_policy)[:applyto]
   end
 
-  def applyto=(applyto)
+  def applyto=(_applyto)
     set_policy
   end
 
@@ -76,7 +93,7 @@ Puppet::Type.type(:rabbitmq_policy).provide(:rabbitmqctl, :parent => Puppet::Pro
     policies(should_vhost, should_policy)[:definition]
   end
 
-  def definition=(definition)
+  def definition=(_definition)
     set_policy
   end
 
@@ -84,36 +101,37 @@ Puppet::Type.type(:rabbitmq_policy).provide(:rabbitmqctl, :parent => Puppet::Pro
     policies(should_vhost, should_policy)[:priority]
   end
 
-  def priority=(priority)
+  def priority=(_priority)
     set_policy
   end
 
   def set_policy
-    unless @set_policy
-      @set_policy = true
-      resource[:applyto]    ||= applyto
-      resource[:definition] ||= definition
-      resource[:pattern]    ||= pattern
-      resource[:priority]   ||= priority
-      # rabbitmq>=3.2.0
-      if Puppet::Util::Package.versioncmp(self.class.rabbitmq_version, '3.2.0') >= 0
-        rabbitmqctl('set_policy',
-          '-p', should_vhost,
-          '--priority', resource[:priority],
-          '--apply-to', resource[:applyto].to_s,
-          should_policy,
-          resource[:pattern],
-          resource[:definition].to_json
-        )
-      else
-        rabbitmqctl('set_policy',
-          '-p', should_vhost,
-          should_policy,
-          resource[:pattern],
-          resource[:definition].to_json,
-          resource[:priority]
-        )
-      end
+    return if @set_policy
+    @set_policy = true
+    resource[:applyto]    ||= applyto
+    resource[:definition] ||= definition
+    resource[:pattern]    ||= pattern
+    resource[:priority]   ||= priority
+    # rabbitmq>=3.2.0
+    if Puppet::Util::Package.versioncmp(self.class.rabbitmq_version, '3.2.0') >= 0
+      rabbitmqctl(
+        'set_policy',
+        '-p', should_vhost,
+        '--priority', resource[:priority],
+        '--apply-to', resource[:applyto].to_s,
+        should_policy,
+        resource[:pattern],
+        resource[:definition].to_json
+      )
+    else
+      rabbitmqctl(
+        'set_policy',
+        '-p', should_vhost,
+        should_policy,
+        resource[:pattern],
+        resource[:definition].to_json,
+        resource[:priority]
+      )
     end
   end
 end
index eeffa95..fb930b3 100644 (file)
@@ -1,19 +1,18 @@
 require 'json'
 require 'puppet'
 Puppet::Type.type(:rabbitmq_queue).provide(:rabbitmqadmin) do
-
   if Puppet::PUPPETVERSION.to_f < 3
-    commands :rabbitmqctl   => 'rabbitmqctl'
-    commands :rabbitmqadmin => '/usr/local/bin/rabbitmqadmin'
+    commands rabbitmqctl: 'rabbitmqctl'
+    commands rabbitmqadmin: '/usr/local/bin/rabbitmqadmin'
   else
     has_command(:rabbitmqctl, 'rabbitmqctl') do
-      environment :HOME => "/tmp"
+      environment HOME: '/tmp'
     end
     has_command(:rabbitmqadmin, '/usr/local/bin/rabbitmqadmin') do
-      environment :HOME => "/tmp"
+      environment HOME: '/tmp'
     end
   end
-  defaultfor :feature => :posix
+  confine feature: :posix
 
   def should_vhost
     if @should_vhost
@@ -24,37 +23,32 @@ Puppet::Type.type(:rabbitmq_queue).provide(:rabbitmqadmin) do
   end
 
   def self.all_vhosts
-    vhosts = []
-    rabbitmqctl('list_vhosts', '-q').split(/\n/).collect do |vhost|
-        vhosts.push(vhost)
-    end
-    vhosts
+    rabbitmqctl('list_vhosts', '-q').split(%r{\n})
   end
 
   def self.all_queues(vhost)
-    rabbitmqctl('list_queues', '-q', '-p', vhost, 'name', 'durable', 'auto_delete', 'arguments').split(/\n/)
+    rabbitmqctl('list_queues', '-q', '-p', vhost, 'name', 'durable', 'auto_delete', 'arguments').split(%r{\n})
   end
 
   def self.instances
     resources = []
     all_vhosts.each do |vhost|
-      all_queues(vhost).collect do |line|
-        name, durable, auto_delete, arguments = line.split()
+      all_queues(vhost).map do |line|
+        next if line =~ %r{^federation:}
+        name, durable, auto_delete, arguments = line.split("\t")
         # Convert output of arguments from the rabbitmqctl command to a json string.
         if !arguments.nil?
-          arguments = arguments.gsub(/^\[(.*)\]$/, "").gsub(/\{("(?:.|\\")*?"),/, '{\1:').gsub(/\},\{/, ",")
-          if arguments == ""
-            arguments = '{}'
-          end
+          arguments = arguments.gsub(%r{^\[(.*)\]$}, '').gsub(%r{\{("(?:.|\\")*?"),}, '{\1:').gsub(%r{\},\{}, ',')
+          arguments = '{}' if arguments == ''
         else
           arguments = '{}'
         end
         queue = {
-          :durable     => durable,
-          :auto_delete => auto_delete,
-          :arguments   => JSON.parse(arguments),
-          :ensure      => :present,
-          :name        => "%s@%s" % [name, vhost],
+          durable: durable,
+          auto_delete: auto_delete,
+          arguments: JSON.parse(arguments),
+          ensure: :present,
+          name: format('%s@%s', name, vhost)
         }
         resources << new(queue) if queue[:name]
       end
@@ -65,7 +59,7 @@ Puppet::Type.type(:rabbitmq_queue).provide(:rabbitmqadmin) do
   def self.prefetch(resources)
     packages = instances
     resources.keys.each do |name|
-      if provider = packages.find{ |pkg| pkg.name == name }
+      if (provider = packages.find { |pkg| pkg.name == name })
         resources[name].provider = provider
       end
     end
@@ -79,21 +73,18 @@ Puppet::Type.type(:rabbitmq_queue).provide(:rabbitmqadmin) do
     vhost_opt = should_vhost ? "--vhost=#{should_vhost}" : ''
     name = resource[:name].rpartition('@').first
     arguments = resource[:arguments]
-    if arguments.nil?
-      arguments = {}
-    end
+    arguments = {} if arguments.nil?
     rabbitmqadmin('declare',
-      'queue',
-      vhost_opt,
-      "--user=#{resource[:user]}",
-      "--password=#{resource[:password]}",
-      '-c',
-      '/etc/rabbitmq/rabbitmqadmin.conf',
-      "name=#{name}",
-      "durable=#{resource[:durable]}",
-      "auto_delete=#{resource[:auto_delete]}",
-      "arguments=#{arguments.to_json}"
-    )
+                  'queue',
+                  vhost_opt,
+                  "--user=#{resource[:user]}",
+                  "--password=#{resource[:password]}",
+                  '-c',
+                  '/etc/rabbitmq/rabbitmqadmin.conf',
+                  "name=#{name}",
+                  "durable=#{resource[:durable]}",
+                  "auto_delete=#{resource[:auto_delete]}",
+                  "arguments=#{arguments.to_json}")
     @property_hash[:ensure] = :present
   end
 
@@ -103,5 +94,4 @@ Puppet::Type.type(:rabbitmq_queue).provide(:rabbitmqadmin) do
     rabbitmqadmin('delete', 'queue', vhost_opt, "--user=#{resource[:user]}", "--password=#{resource[:password]}", '-c', '/etc/rabbitmq/rabbitmqadmin.conf', "name=#{name}")
     @property_hash[:ensure] = :absent
   end
-
 end
index da37886..9eab0dd 100644 (file)
-require 'puppet'
-require 'set'
 require File.expand_path(File.join(File.dirname(__FILE__), '..', 'rabbitmqctl'))
-Puppet::Type.type(:rabbitmq_user).provide(:rabbitmqctl, :parent => Puppet::Provider::Rabbitmqctl) do
-
-  if Puppet::PUPPETVERSION.to_f < 3
-    commands :rabbitmqctl => 'rabbitmqctl'
-  else
-     has_command(:rabbitmqctl, 'rabbitmqctl') do
-       environment :HOME => "/tmp"
-     end
+Puppet::Type.type(:rabbitmq_user).provide(
+  :rabbitmqctl,
+  parent: Puppet::Provider::Rabbitmqctl
+) do
+  has_command(:rabbitmqctl, 'rabbitmqctl') do
+    environment HOME: '/tmp'
   end
 
-  defaultfor :feature => :posix
+  confine feature: :posix
+
+  def initialize(value = {})
+    super(value)
+    @property_flush = {}
+  end
 
   def self.instances
-    self.run_with_retries {
+    user_list = run_with_retries do
       rabbitmqctl('-q', 'list_users')
-    }.split(/\n/).collect do |line|
-      if line =~ /^(\S+)(\s+\[.*?\]|)$/
-        new(:name => $1)
-      else
-        raise Puppet::Error, "Cannot parse invalid user line: #{line}"
-      end
     end
-  end
 
-  def create
-    rabbitmqctl('add_user', resource[:name], resource[:password])
-    if resource[:admin] == :true
-      make_user_admin()
-    end
-    if ! resource[:tags].empty?
-      set_user_tags(resource[:tags])
+    user_list.split(%r{\n}).map do |line|
+      raise Puppet::Error, "Cannot parse invalid user line: #{line}" unless line =~ %r{^(\S+)\s+\[(.*?)\]$}
+      user = Regexp.last_match(1)
+      tags = Regexp.last_match(2).split(%r{,\s*})
+      new(
+        ensure: :present,
+        name: user,
+        tags: tags
+      )
     end
   end
 
-  def change_password
-    rabbitmqctl('change_password', resource[:name], resource[:password])
+  def self.prefetch(resources)
+    users = instances
+    resources.each_key do |user|
+      if (provider = users.find { |u| u.name == user })
+        resources[user].provider = provider
+      end
+    end
   end
 
-  def password
-    nil
+  def exists?
+    @property_hash[:ensure] == :present
   end
 
+  def create
+    # Fail here (rather than a validate block in the type) if password is not
+    # set, so that "puppet resource" still works.
+    raise Puppet::Error, "Password is a required parameter for rabbitmq_user (user: #{name})" if @resource[:password].nil?
 
-  def check_password
-    response = rabbitmqctl('eval', 'rabbit_access_control:check_user_pass_login(list_to_binary("' + resource[:name] + '"), list_to_binary("' + resource[:password] +'")).')
-    if response.include? 'refused'
-        false
-    else
-        true
-    end
+    rabbitmqctl('add_user', @resource[:name], @resource[:password])
+
+    tags = @resource[:tags]
+    tags << admin_tag if @resource[:admin] == :true
+    rabbitmqctl('set_user_tags', @resource[:name], tags) unless tags.empty?
+
+    @property_hash[:ensure] = :present
   end
 
   def destroy
-    rabbitmqctl('delete_user', resource[:name])
+    rabbitmqctl('delete_user', @resource[:name])
+    @property_hash[:ensure] = :absent
   end
 
-  def exists?
-    self.class.run_with_retries {
-      rabbitmqctl('-q', 'list_users')
-    }.split(/\n/).detect do |line|
-      line.match(/^#{Regexp.escape(resource[:name])}(\s+(\[.*?\]|\S+)|)$/)
-    end
+  def password=(password)
+    rabbitmqctl('change_password', @resource[:name], password)
   end
 
+  def password; end
+
+  def check_password(password)
+    check_access_control = [
+      'rabbit_access_control:check_user_pass_login(',
+      %[list_to_binary("#{@resource[:name]}"), ],
+      %[list_to_binary("#{password}")).]
+    ]
+
+    response = rabbitmqctl('eval', check_access_control.join)
+    !response.include? 'refused'
+  end
 
   def tags
-    tags = get_user_tags
     # do not expose the administrator tag for admins
-    if resource[:admin] == :true
-      tags.delete('administrator')
-    end
-    tags.entries.sort
+    @property_hash[:tags].reject { |tag| tag == admin_tag }
   end
 
-
   def tags=(tags)
-    if ! tags.nil?
-      set_user_tags(tags)
-    end
+    @property_flush[:tags] = tags
   end
 
   def admin
-    if usertags = get_user_tags
-      (:true if usertags.include?('administrator')) || :false
-    else
-      raise Puppet::Error, "Could not match line '#{resource[:name]} (true|false)' from list_users (perhaps you are running on an older version of rabbitmq that does not support admin users?)"
-    end
+    usertags = get_user_tags
+    raise Puppet::Error, "Could not match line '#{resource[:name]} (true|false)' from list_users (perhaps you are running on an older version of rabbitmq that does not support admin users?)" unless usertags
+    (:true if usertags.include?('administrator')) || :false
   end
 
   def admin=(state)
     if state == :true
-      make_user_admin()
+      make_user_admin
     else
       usertags = get_user_tags
       usertags.delete('administrator')
@@ -100,27 +105,25 @@ Puppet::Type.type(:rabbitmq_user).provide(:rabbitmqctl, :parent => Puppet::Provi
     end
   end
 
-  def set_user_tags(tags)
-    is_admin = get_user_tags().member?("administrator") \
-               || resource[:admin] == :true
-    usertags = Set.new(tags)
-    if is_admin
-      usertags.add("administrator")
-    end
-    rabbitmqctl('set_user_tags', resource[:name], usertags.entries.sort)
+  def admin
+    @property_hash[:tags].include?(admin_tag) ? :true : :false
   end
 
-  def make_user_admin
-    usertags = get_user_tags
-    usertags.add('administrator')
-    rabbitmqctl('set_user_tags', resource[:name], usertags.entries.sort)
+  def admin=(state)
+    @property_flush[:admin] = state
+  end
+
+  def flush
+    return if @property_flush.empty?
+    tags = @property_flush[:tags] || @resource[:tags]
+    tags << admin_tag if @resource[:admin] == :true
+    rabbitmqctl('set_user_tags', @resource[:name], tags)
+    @property_flush.clear
   end
 
   private
-  def get_user_tags
-    match = rabbitmqctl('-q', 'list_users').split(/\n/).collect do |line|
-      line.match(/^#{Regexp.escape(resource[:name])}\s+\[(.*?)\]/)
-    end.compact.first
-    Set.new(match[1].split(' ').map{|x| x.gsub(/,$/, '')}) if match
+
+  def admin_tag
+    'administrator'
   end
 end
index a0b8b5a..d44d458 100644 (file)
@@ -1,31 +1,28 @@
 require File.expand_path(File.join(File.dirname(__FILE__), '..', 'rabbitmqctl'))
-Puppet::Type.type(:rabbitmq_user_permissions).provide(:rabbitmqctl, :parent => Puppet::Provider::Rabbitmqctl) do
-
+Puppet::Type.type(:rabbitmq_user_permissions).provide(:rabbitmqctl, parent: Puppet::Provider::Rabbitmqctl) do
   if Puppet::PUPPETVERSION.to_f < 3
-    commands :rabbitmqctl => 'rabbitmqctl'
+    commands rabbitmqctl: 'rabbitmqctl'
   else
-     has_command(:rabbitmqctl, 'rabbitmqctl') do
-       environment :HOME => "/tmp"
-     end
+    has_command(:rabbitmqctl, 'rabbitmqctl') do
+      environment HOME: '/tmp'
+    end
   end
 
-  defaultfor :feature=> :posix
+  confine feature: :posix
 
   # cache users permissions
   def self.users(name, vhost)
     @users = {} unless @users
     unless @users[name]
       @users[name] = {}
-      self.run_with_retries {
+      user_permission_list = run_with_retries do
         rabbitmqctl('-q', 'list_user_permissions', name)
-      }.split(/\n/).each do |line|
-        line = self::strip_backslashes(line)
-        if line =~ /^(\S+)\s+(\S*)\s+(\S*)\s+(\S*)$/
-          @users[name][$1] =
-            {:configure => $2, :read => $4, :write => $3}
-        else
-          raise Puppet::Error, "cannot parse line from list_user_permissions:#{line}"
-        end
+      end
+      user_permission_list.split(%r{\n}).each do |line|
+        line = strip_backslashes(line)
+        raise Puppet::Error, "cannot parse line from list_user_permissions:#{line}" unless line =~ %r{^(\S+)\s+(\S*)\s+(\S*)\s+(\S*)$}
+        @users[name][Regexp.last_match(1)] =
+          { configure: Regexp.last_match(2), read: Regexp.last_match(4), write: Regexp.last_match(3) }
       end
     end
     @users[name][vhost]
@@ -72,7 +69,7 @@ Puppet::Type.type(:rabbitmq_user_permissions).provide(:rabbitmqctl, :parent => P
     users(should_user, should_vhost)[:configure]
   end
 
-  def configure_permission=(perm)
+  def configure_permission=(_perm)
     set_permissions
   end
 
@@ -80,7 +77,7 @@ Puppet::Type.type(:rabbitmq_user_permissions).provide(:rabbitmqctl, :parent => P
     users(should_user, should_vhost)[:read]
   end
 
-  def read_permission=(perm)
+  def read_permission=(_perm)
     set_permissions
   end
 
@@ -88,27 +85,30 @@ Puppet::Type.type(:rabbitmq_user_permissions).provide(:rabbitmqctl, :parent => P
     users(should_user, should_vhost)[:write]
   end
 
-  def write_permission=(perm)
+  def write_permission=(_perm)
     set_permissions
   end
 
   # implement memoization so that we only call set_permissions once
   def set_permissions
-    unless @permissions_set
-      @permissions_set = true
-      resource[:configure_permission] ||= configure_permission
-      resource[:read_permission]      ||= read_permission
-      resource[:write_permission]     ||= write_permission
-      rabbitmqctl('set_permissions', '-p', should_vhost, should_user,
-        resource[:configure_permission], resource[:write_permission],
-        resource[:read_permission]
-      )
-    end
+    return if @permissions_set
+
+    @permissions_set = true
+    resource[:configure_permission] ||= configure_permission
+    resource[:read_permission]      ||= read_permission
+    resource[:write_permission]     ||= write_permission
+    rabbitmqctl(
+      'set_permissions',
+      '-p', should_vhost,
+      should_user,
+      resource[:configure_permission],
+      resource[:write_permission],
+      resource[:read_permission]
+    )
   end
 
   def self.strip_backslashes(string)
     # See: https://github.com/rabbitmq/rabbitmq-server/blob/v1_7/docs/rabbitmqctl.1.pod#output-escaping
-    string.gsub(/\\\\/, '\\')
+    string.gsub(%r{\\\\}, '\\')
   end
-
 end
index fbd389d..c270361 100644 (file)
@@ -1,23 +1,21 @@
 require File.expand_path(File.join(File.dirname(__FILE__), '..', 'rabbitmqctl'))
-Puppet::Type.type(:rabbitmq_vhost).provide(:rabbitmqctl, :parent => Puppet::Provider::Rabbitmqctl) do
-
+Puppet::Type.type(:rabbitmq_vhost).provide(:rabbitmqctl, parent: Puppet::Provider::Rabbitmqctl) do
   if Puppet::PUPPETVERSION.to_f < 3
-    commands :rabbitmqctl => 'rabbitmqctl'
+    commands rabbitmqctl: 'rabbitmqctl'
   else
-     has_command(:rabbitmqctl, 'rabbitmqctl') do
-       environment :HOME => "/tmp"
-     end
+    has_command(:rabbitmqctl, 'rabbitmqctl') do
+      environment HOME: '/tmp'
+    end
   end
 
   def self.instances
-    self.run_with_retries {
+    vhost_list = run_with_retries do
       rabbitmqctl('-q', 'list_vhosts')
-    }.split(/\n/).map do |line|
-      if line =~ /^(\S+)$/
-        new(:name => $1)
-      else
-        raise Puppet::Error, "Cannot parse invalid user line: #{line}"
-      end
+    end
+
+    vhost_list.split(%r{\n}).map do |line|
+      raise Puppet::Error, "Cannot parse invalid vhost line: #{line}" unless line =~ %r{^(\S+)$}
+      new(name: Regexp.last_match(1))
     end
   end
 
@@ -30,11 +28,6 @@ Puppet::Type.type(:rabbitmq_vhost).provide(:rabbitmqctl, :parent => Puppet::Prov
   end
 
   def exists?
-    out = self.class.run_with_retries {
-      rabbitmqctl('-q', 'list_vhosts')
-    }.split(/\n/).detect do |line|
-      line.match(/^#{Regexp.escape(resource[:name])}$/)
-    end
+    self.class.run_with_retries { rabbitmqctl('-q', 'list_vhosts') }.split(%r{\n}).include? resource[:name]
   end
-
 end
index d236645..bfc27cf 100644 (file)
@@ -1,10 +1,10 @@
 class Puppet::Provider::Rabbitmqctl < Puppet::Provider
   initvars
-  commands :rabbitmqctl => 'rabbitmqctl'
+  commands rabbitmqctl: 'rabbitmqctl'
 
   def self.rabbitmq_version
     output = rabbitmqctl('-q', 'status')
-    version = output.match(/\{rabbit,"RabbitMQ","([\d\.]+)"\}/)
+    version = output.match(%r{\{rabbit,"RabbitMQ","([\d\.]+)"\}})
     version[1] if version
   end
 
@@ -13,13 +13,13 @@ class Puppet::Provider::Rabbitmqctl < Puppet::Provider
   # Limit each query time by 'timeout'.
   # For example:
   #   users = self.class.run_with_retries { rabbitmqctl 'list_users' }
-  def self.run_with_retries(count=30, step=6, timeout=10)
-    count.times do |n|
+  def self.run_with_retries(count = 30, step = 6, timeout = 10)
+    count.times do |_n|
       begin
-        output = Timeout::timeout(timeout) do
+        output = Timeout.timeout(timeout) do
           yield
         end
-      rescue Puppet::ExecutionFailure, Timeout
+      rescue Puppet::ExecutionFailure, Timeout::Error
         Puppet.debug 'Command failed, retrying'
         sleep step
       else
@@ -29,5 +29,4 @@ class Puppet::Provider::Rabbitmqctl < Puppet::Provider
     end
     raise Puppet::Error, "Command is still failing after #{count * step} seconds expired!"
   end
-
 end
index 1309480..1165fd9 100644 (file)
@@ -1,5 +1,42 @@
 Puppet::Type.newtype(:rabbitmq_binding) do
-  desc 'Native type for managing rabbitmq bindings'
+  desc <<-DESC
+Native type for managing rabbitmq bindings
+
+@example Create a rabbitmq_binding
+ rabbitmq_binding { 'myexchange@myqueue@myvhost':
+   user             => 'dan',
+   password         => 'bar',
+   destination_type => 'queue',
+   routing_key      => '#',
+   arguments        => {},
+   ensure           => present,
+ }
+
+@example Create bindings with same source / destination / vhost but different routing key using individual parameters
+rabbitmq_binding { 'binding 1':
+  ensure           => present,
+  source           => 'myexchange',
+  destination      => 'myqueue',
+  vhost            => 'myvhost',
+  user             => 'dan',
+  password         => 'bar',
+  destination_type => 'queue',
+  routing_key      => 'key1',
+  arguments        => {},
+}
+
+rabbitmq_binding { 'binding 2':
+  ensure           => present,
+  source           => 'myexchange',
+  destination      => 'myqueue',
+  vhost            => 'myvhost',
+  user             => 'dan',
+  password         => 'bar',
+  destination_type => 'queue',
+  routing_key      => 'key2',
+  arguments        => {},
+}
+DESC
 
   ensurable do
     defaultto(:present)
@@ -11,23 +48,70 @@ Puppet::Type.newtype(:rabbitmq_binding) do
     end
   end
 
-  newparam(:name, :namevar => true) do
-    desc 'source and destination of bind'
-    newvalues(/^\S*@\S+@\S+$/)
+  # Match patterns without '@' as arbitrary names; match patterns with
+  # src@destination@vhost to their named params for backwards compatibility.
+  def self.title_patterns
+    [
+      [
+        %r{(^([^@]*)$)}m,
+        [
+          [:name]
+        ]
+      ],
+      [
+        %r{^((\S+)@(\S+)@(\S+))$}m,
+        [
+          [:name],
+          [:source],
+          [:destination],
+          [:vhost]
+        ]
+      ]
+    ]
   end
 
-  newparam(:destination_type) do
-    desc 'binding destination_type'
-    newvalues(/queue|exchange/)
-    defaultto('queue')
+  newparam(:name) do
+    desc 'resource name, either source@destination@vhost or arbitrary name with params'
+
+    isnamevar
   end
-  
-  newparam(:routing_key) do
+
+  newproperty(:source) do
+    desc 'source of binding'
+
+    newvalues(%r{^\S+$})
+    isnamevar
+  end
+
+  newproperty(:destination) do
+    desc 'destination of binding'
+
+    newvalues(%r{^\S+$})
+    isnamevar
+  end
+
+  newproperty(:vhost) do
+    desc 'vhost'
+
+    newvalues(%r{^\S+$})
+    defaultto('/')
+    isnamevar
+  end
+
+  newproperty(:routing_key) do
     desc 'binding routing_key'
-    newvalues(/^\S*$/)
+
+    newvalues(%r{^\S*$})
+    isnamevar
+  end
+
+  newproperty(:destination_type) do
+    desc 'binding destination_type'
+    newvalues(%r{queue|exchange})
+    defaultto('queue')
   end
 
-  newparam(:arguments) do
+  newproperty(:arguments) do
     desc 'binding arguments'
     defaultto {}
     validate do |value|
@@ -38,19 +122,19 @@ Puppet::Type.newtype(:rabbitmq_binding) do
   newparam(:user) do
     desc 'The user to use to connect to rabbitmq'
     defaultto('guest')
-    newvalues(/^\S+$/)
+    newvalues(%r{^\S+$})
   end
 
   newparam(:password) do
     desc 'The password to use to connect to rabbitmq'
     defaultto('guest')
-    newvalues(/\S+/)
+    newvalues(%r{\S+})
   end
 
   autorequire(:rabbitmq_vhost) do
-    [self[:name].split('@')[2]]
+    setup_autorequire('vhost')
   end
-  
+
   autorequire(:rabbitmq_exchange) do
     setup_autorequire('exchange')
   end
@@ -65,32 +149,41 @@ Puppet::Type.newtype(:rabbitmq_binding) do
 
   autorequire(:rabbitmq_user_permissions) do
     [
-      "#{self[:user]}@#{self[:name].split('@')[1]}",
-      "#{self[:user]}@#{self[:name].split('@')[0]}"
+      "#{self[:user]}@#{self[:source]}",
+      "#{self[:user]}@#{self[:destination]}"
     ]
   end
 
   def setup_autorequire(type)
     destination_type = value(:destination_type)
     if type == 'exchange'
-      rval = ["#{self[:name].split('@')[0]}@#{self[:name].split('@')[2]}"]
+      rval = ["#{self[:source]}@#{self[:vhost]}"]
       if destination_type == type
-        rval.push("#{self[:name].split('@')[1]}@#{self[:name].split('@')[2]}")
+        rval.push("#{self[:destination]}@#{self[:vhost]}")
       end
     else
-      if destination_type == type
-        rval = ["#{self[:name].split('@')[1]}@#{self[:name].split('@')[2]}"]
-      else
-        rval = []
-      end
+      rval = if destination_type == type
+               ["#{self[:destination]}@#{self[:vhost]}"]
+             else
+               []
+             end
     end
     rval
   end
 
   def validate_argument(argument)
-    unless [Hash].include?(argument.class)
-      raise ArgumentError, "Invalid argument"
-    end
+    raise ArgumentError, 'Invalid argument' unless [Hash].include?(argument.class)
   end
 
+  # Validate that we have both source and destination now that these are not
+  # necessarily only coming from the resource title.
+  validate do
+    if !self[:source] && !defined? provider.source
+      raise ArgumentError, '`source` must be defined'
+    end
+
+    if !self[:destination] && !defined? provider.destination
+      raise ArgumentError, '`destination` must be defined'
+    end
+  end
 end
index c2e5898..0673caf 100644 (file)
@@ -1,13 +1,23 @@
 Puppet::Type.newtype(:rabbitmq_erlang_cookie) do
-  desc 'Type to manage the rabbitmq erlang cookie securely'
+  desc <<-DESC
+Type to manage the rabbitmq erlang cookie securely
 
-  newparam(:path, :namevar => true)
+This is essentially a private type used by the rabbitmq::config class
+to manage the erlang cookie. It replaces the rabbitmq_erlang_cookie fact
+from earlier versions of this module. It manages the content of the cookie
+usually located at "${rabbitmq_home}/.erlang.cookie", which includes
+stopping the rabbitmq service and wiping out the database at
+"${rabbitmq_home}/mnesia" if the user agrees to it. We don't recommend using
+this type directly.
+DESC
+
+  newparam(:path, namevar: true)
 
   newproperty(:content) do
     desc 'Content of cookie'
-    newvalues(/^\S+$/)
-    def change_to_s(current, desired)
-      "The rabbitmq erlang cookie was changed"
+    newvalues(%r{^\S+$})
+    def change_to_s(_current, _desired)
+      'The rabbitmq erlang cookie was changed'
     end
   end
 
@@ -29,6 +39,6 @@ Puppet::Type.newtype(:rabbitmq_erlang_cookie) do
   end
 
   newparam(:service_name) do
-    newvalues(/^\S+$/)
+    newvalues(%r{^\S+$})
   end
 end
index b2e88a8..4f274f2 100644 (file)
@@ -1,5 +1,21 @@
 Puppet::Type.newtype(:rabbitmq_exchange) do
-  desc 'Native type for managing rabbitmq exchanges'
+  desc <<-DESC
+Native type for managing rabbitmq exchanges
+
+@example Create a rabbitmq_exchange
+ rabbitmq_exchange { 'myexchange@myvhost':
+   user        => 'dan',
+   password    => 'bar',
+   type        => 'topic',
+   ensure      => present,
+   internal    => false,
+   auto_delete => false,
+   durable     => true,
+   arguments   => {
+     hash-header => 'message-distribution-hash'
+   }
+ }
+DESC
 
   ensurable do
     defaultto(:present)
@@ -11,29 +27,32 @@ Puppet::Type.newtype(:rabbitmq_exchange) do
     end
   end
 
-  newparam(:name, :namevar => true) do
+  newparam(:name, namevar: true) do
     desc 'Name of exchange'
-    newvalues(/^\S*@\S+$/)
+    newvalues(%r{^\S*@\S+$})
   end
 
   newparam(:type) do
     desc 'Exchange type to be set *on creation*'
-    newvalues(/^\S+$/)
+    newvalues(%r{^\S+$})
   end
 
   newparam(:durable) do
     desc 'Exchange durability to be set *on creation*'
-    newvalues(/^\S+$/)
+    newvalues(%r{^\S+$})
+    defaultto 'false'
   end
 
   newparam(:auto_delete) do
     desc 'Exchange auto delete option to be set *on creation*'
-    newvalues(/^\S+$/)
+    newvalues(%r{^\S+$})
+    defaultto 'false'
   end
 
   newparam(:internal) do
     desc 'Exchange internal option to be set *on creation*'
-    newvalues(/^\S+$/)
+    newvalues(%r{^\S+$})
+    defaultto 'false'
   end
 
   newparam(:arguments) do
@@ -44,17 +63,17 @@ Puppet::Type.newtype(:rabbitmq_exchange) do
   newparam(:user) do
     desc 'The user to use to connect to rabbitmq'
     defaultto('guest')
-    newvalues(/^\S+$/)
+    newvalues(%r{^\S+$})
   end
 
   newparam(:password) do
     desc 'The password to use to connect to rabbitmq'
     defaultto('guest')
-    newvalues(/\S+/)
+    newvalues(%r{\S+})
   end
 
   validate do
-    if self[:ensure] == :present and self[:type].nil?
+    if self[:ensure] == :present && self[:type].nil?
       raise ArgumentError, "must set type when creating exchange for #{self[:name]} whose type is #{self[:type]}"
     end
   end
@@ -70,5 +89,4 @@ Puppet::Type.newtype(:rabbitmq_exchange) do
   autorequire(:rabbitmq_user_permissions) do
     ["#{self[:user]}@#{self[:name].split('@')[1]}"]
   end
-
 end
diff --git a/3rdparty/modules/rabbitmq/lib/puppet/type/rabbitmq_parameter.rb b/3rdparty/modules/rabbitmq/lib/puppet/type/rabbitmq_parameter.rb
new file mode 100644 (file)
index 0000000..8a062c0
--- /dev/null
@@ -0,0 +1,86 @@
+Puppet::Type.newtype(:rabbitmq_parameter) do
+  desc <<-DESC
+Type for managing rabbitmq parameters
+
+@example Create some rabbitmq_parameter resources
+   rabbitmq_parameter { 'documentumShovel@/':
+     component_name => '',
+     value          => {
+         'src-uri'    => 'amqp://',
+         'src-queue'  => 'my-queue',
+         'dest-uri'   => 'amqp://remote-server',
+         'dest-queue' => 'another-queue',
+     },
+   }
+   rabbitmq_parameter { 'documentumFed@/':
+     component_name => 'federation-upstream',
+     value          => {
+         'uri'     => 'amqp://myserver',
+         'expires' => '360000',
+     },
+   }
+DESC
+
+  ensurable do
+    defaultto(:present)
+    newvalue(:present) do
+      provider.create
+    end
+    newvalue(:absent) do
+      provider.destroy
+    end
+  end
+
+  autorequire(:service) { 'rabbitmq-server' }
+
+  validate do
+    raise('component_name parameter is required.') if self[:ensure] == :present && self[:component_name].nil?
+    raise('value parameter is required.') if self[:ensure] == :present && self[:value].nil?
+  end
+
+  newparam(:name, namevar: true) do
+    desc 'combination of name@vhost to set parameter for'
+    newvalues(%r{^\S+@\S+$})
+  end
+
+  newproperty(:component_name) do
+    desc 'The component_name to use when setting parameter, eg: shovel or federation'
+    validate do |value|
+      resource.validate_component_name(value)
+    end
+  end
+
+  newproperty(:value) do
+    desc 'A hash of values to use with the component name you are setting'
+    validate do |value|
+      resource.validate_value(value)
+    end
+    munge do |value|
+      resource.munge_value(value)
+    end
+  end
+
+  autorequire(:rabbitmq_vhost) do
+    [self[:name].split('@')[1]]
+  end
+
+  def validate_component_name(value)
+    raise ArgumentError, 'component_name must be defined' if value.empty?
+  end
+
+  def validate_value(value)
+    raise ArgumentError, 'Invalid value' unless [Hash].include?(value.class)
+    value.each do |_k, v|
+      unless [String, TrueClass, FalseClass].include?(v.class)
+        raise ArgumentError, 'Invalid value'
+      end
+    end
+  end
+
+  def munge_value(value)
+    value.each do |k, v|
+      value[k] = v.to_i if v =~ %r{\A[-+]?[0-9]+\z}
+    end
+    value
+  end
+end
index 497ced4..2cb96c5 100644 (file)
@@ -1,5 +1,15 @@
 Puppet::Type.newtype(:rabbitmq_plugin) do
-  desc 'manages rabbitmq plugins'
+  desc <<-DESC
+manages rabbitmq plugins
+
+@example query all currently enabled plugins
+ $ puppet resource rabbitmq_plugin
+
+@example Ensure a rabbitmq_plugin resource
+ rabbitmq_plugin {'rabbitmq_stomp':
+   ensure => present,
+ }
+DESC
 
   ensurable do
     defaultto(:present)
@@ -11,9 +21,17 @@ Puppet::Type.newtype(:rabbitmq_plugin) do
     end
   end
 
-  newparam(:name, :namevar => true) do
-    'name of the plugin to enable'
-    newvalues(/^\S+$/)
+  newparam(:name, namevar: true) do
+    desc 'The name of the plugin to enable'
+    newvalues(%r{^\S+$})
   end
 
+  newparam(:umask) do
+    desc 'Sets the octal umask to be used while creating this resource'
+    defaultto '0022'
+    munge do |value|
+      raise Puppet::Error, "The umask specification is invalid: #{value.inspect}" unless value =~ %r{^0?[0-7]{1,3}$}
+      return value.to_i(8)
+    end
+  end
 end
index 259a1d6..65275a7 100644 (file)
@@ -1,5 +1,18 @@
 Puppet::Type.newtype(:rabbitmq_policy) do
-  desc 'Type for managing rabbitmq policies'
+  desc <<-DESC
+Type for managing rabbitmq policies
+
+@example Create a rabbitmq_policy
+ rabbitmq_policy { 'ha-all@myvhost':
+   pattern    => '.*',
+   priority   => 0,
+   applyto    => 'all',
+   definition => {
+     'ha-mode'      => 'all',
+     'ha-sync-mode' => 'automatic',
+   },
+ }
+DESC
 
   ensurable do
     defaultto(:present)
@@ -14,13 +27,13 @@ Puppet::Type.newtype(:rabbitmq_policy) do
   autorequire(:service) { 'rabbitmq-server' }
 
   validate do
-    fail('pattern parameter is required.') if self[:ensure] == :present and self[:pattern].nil?
-    fail('definition parameter is required.') if self[:ensure] == :present and self[:definition].nil?
+    raise('pattern parameter is required.') if self[:ensure] == :present && self[:pattern].nil?
+    raise('definition parameter is required.') if self[:ensure] == :present && self[:definition].nil?
   end
 
-  newparam(:name, :namevar => true) do
+  newparam(:name, namevar: true) do
     desc 'combination of policy@vhost to create policy for'
-    newvalues(/^\S+@\S+$/)
+    newvalues(%r{^\S+@\S+$})
   end
 
   newproperty(:pattern) do
@@ -50,7 +63,7 @@ Puppet::Type.newtype(:rabbitmq_policy) do
 
   newproperty(:priority) do
     desc 'policy priority'
-    newvalues(/^\d+$/)
+    newvalues(%r{^\d+$})
     defaultto 0
   end
 
@@ -59,20 +72,24 @@ Puppet::Type.newtype(:rabbitmq_policy) do
   end
 
   def validate_pattern(value)
-    begin
-      Regexp.new(value)
-    rescue RegexpError
-      raise ArgumentError, "Invalid regexp #{value}"
-    end
+    Regexp.new(value)
+  rescue RegexpError
+    raise ArgumentError, "Invalid regexp #{value}"
   end
 
   def validate_definition(definition)
     unless [Hash].include?(definition.class)
-      raise ArgumentError, "Invalid definition"
+      raise ArgumentError, 'Invalid definition'
     end
-    definition.each do |k,v|
-      unless [String].include?(v.class)
-        raise ArgumentError, "Invalid definition"
+    definition.each do |k, v|
+      if k == 'ha-params' && definition['ha-mode'] == 'nodes'
+        unless [Array].include?(v.class)
+          raise ArgumentError, "Invalid definition, value #{v} for key #{k} is not an array"
+        end
+      else
+        unless [String].include?(v.class)
+          raise ArgumentError, "Invalid definition, value #{v} is not a string"
+        end
       end
     end
     if definition['ha-mode'] == 'exactly'
@@ -87,6 +104,36 @@ Puppet::Type.newtype(:rabbitmq_policy) do
         raise ArgumentError, "Invalid expires value '#{expires_val}'"
       end
     end
+    if definition.key? 'message-ttl'
+      message_ttl_val = definition['message-ttl']
+      unless message_ttl_val.to_i.to_s == message_ttl_val
+        raise ArgumentError, "Invalid message-ttl value '#{message_ttl_val}'"
+      end
+    end
+    if definition.key? 'max-length'
+      max_length_val = definition['max-length']
+      unless max_length_val.to_i.to_s == max_length_val
+        raise ArgumentError, "Invalid max-length value '#{max_length_val}'"
+      end
+    end
+    if definition.key? 'max-length-bytes'
+      max_length_bytes_val = definition['max-length-bytes']
+      unless max_length_bytes_val.to_i.to_s == max_length_bytes_val
+        raise ArgumentError, "Invalid max-length-bytes value '#{max_length_bytes_val}'"
+      end
+    end
+    if definition.key? 'shards-per-node'
+      shards_per_node_val = definition['shards-per-node']
+      unless shards_per_node_val.to_i.to_s == shards_per_node_val
+        raise ArgumentError, "Invalid shards-per-node value '#{shards_per_node_val}'"
+      end
+    end
+    if definition.key? 'ha-sync-batch-size' # rubocop:disable Style/GuardClause
+      ha_sync_batch_size_val = definition['ha-sync-batch-size']
+      unless ha_sync_batch_size_val.to_i.to_s == ha_sync_batch_size_val
+        raise ArgumentError, "Invalid ha-sync-batch-size value '#{ha_sync_batch_size_val}'"
+      end
+    end
   end
 
   def munge_definition(definition)
@@ -96,6 +143,21 @@ Puppet::Type.newtype(:rabbitmq_policy) do
     if definition.key? 'expires'
       definition['expires'] = definition['expires'].to_i
     end
+    if definition.key? 'message-ttl'
+      definition['message-ttl'] = definition['message-ttl'].to_i
+    end
+    if definition.key? 'max-length'
+      definition['max-length'] = definition['max-length'].to_i
+    end
+    if definition.key? 'max-length-bytes'
+      definition['max-length-bytes'] = definition['max-length-bytes'].to_i
+    end
+    if definition.key? 'shards-per-node'
+      definition['shards-per-node'] = definition['shards-per-node'].to_i
+    end
+    if definition.key? 'ha-sync-batch-size'
+      definition['ha-sync-batch-size'] = definition['ha-sync-batch-size'].to_i
+    end
     definition
   end
 end
index 464a2ca..63fc19b 100644 (file)
@@ -1,5 +1,20 @@
 Puppet::Type.newtype(:rabbitmq_queue) do
-  desc 'Native type for managing rabbitmq queue'
+  desc <<-DESC
+Native type for managing rabbitmq queue
+
+@example Create a rabbitmq_queue
+ rabbitmq_queue { 'myqueue@myvhost':
+   ensure      => present,
+   user        => 'dan',
+   password    => 'bar',
+   durable     => true,
+   auto_delete => false,
+   arguments   => {
+     x-message-ttl          => 123,
+     x-dead-letter-exchange => 'other'
+   },
+ }
+DESC
 
   ensurable do
     defaultto(:present)
@@ -11,20 +26,20 @@ Puppet::Type.newtype(:rabbitmq_queue) do
     end
   end
 
-  newparam(:name, :namevar => true) do
+  newparam(:name, namevar: true) do
     desc 'Name of queue'
-    newvalues(/^\S*@\S+$/)
+    newvalues(%r{^\S*@\S+$})
   end
 
   newparam(:durable) do
     desc 'Queue is durable'
-    newvalues(/true|false/)
+    newvalues(%r{true|false})
     defaultto('true')
   end
-  
+
   newparam(:auto_delete) do
     desc 'Queue will be auto deleted'
-    newvalues(/true|false/)
+    newvalues(%r{true|false})
     defaultto('false')
   end
 
@@ -39,13 +54,13 @@ Puppet::Type.newtype(:rabbitmq_queue) do
   newparam(:user) do
     desc 'The user to use to connect to rabbitmq'
     defaultto('guest')
-    newvalues(/^\S+$/)
+    newvalues(%r{^\S+$})
   end
 
   newparam(:password) do
     desc 'The password to use to connect to rabbitmq'
     defaultto('guest')
-    newvalues(/\S+/)
+    newvalues(%r{\S+})
   end
 
   autorequire(:rabbitmq_vhost) do
@@ -61,8 +76,6 @@ Puppet::Type.newtype(:rabbitmq_queue) do
   end
 
   def validate_argument(argument)
-    unless [Hash].include?(argument.class)
-      raise ArgumentError, "Invalid argument"
-    end
+    raise ArgumentError, 'Invalid argument' unless [Hash].include?(argument.class)
   end
 end
index baf4795..9fda2c2 100644 (file)
@@ -1,5 +1,24 @@
 Puppet::Type.newtype(:rabbitmq_user) do
-  desc 'Native type for managing rabbitmq users'
+  desc <<-DESC
+Native type for managing rabbitmq users
+
+@example query all current users
+ $ puppet resource rabbitmq_user
+
+@example Configure a user, dan
+ rabbitmq_user { 'dan':
+   admin    => true,
+   password => 'bar',
+ }
+
+@example Optional parameter tags will set further rabbitmq tags like monitoring, policymaker, etc.
+ To set the administrator tag use admin-flag.
+ rabbitmq_user { 'dan':
+   admin    => true,
+   password => 'bar',
+   tags     => ['monitoring', 'tag1'],
+ }
+DESC
 
   ensurable do
     defaultto(:present)
@@ -13,27 +32,25 @@ Puppet::Type.newtype(:rabbitmq_user) do
 
   autorequire(:service) { 'rabbitmq-server' }
 
-  newparam(:name, :namevar => true) do
+  newparam(:name, namevar: true) do
     desc 'Name of user'
-    newvalues(/^\S+$/)
+    newvalues(%r{^\S+$})
   end
 
   newproperty(:password) do
     desc 'User password to be set *on creation* and validated each run'
-    def insync?(is)
-      provider.check_password
+    def insync?(_is)
+      provider.check_password(should)
     end
-    def set(value)
-      provider.change_password
-    end
-    def change_to_s(current, desired)
-      "password has been changed"
+
+    def change_to_s(_current, _desired)
+      'password has been changed'
     end
   end
 
   newproperty(:admin) do
     desc 'whether or not user should be an admin'
-    newvalues(/true|false/)
+    newvalues(%r{true|false})
     munge do |value|
       # converting to_s in case its a boolean
       value.to_s.to_sym
@@ -41,45 +58,25 @@ Puppet::Type.newtype(:rabbitmq_user) do
     defaultto :false
   end
 
-  newproperty(:tags, :array_matching => :all) do
+  newproperty(:tags, array_matching: :all) do
     desc 'additional tags for the user'
     validate do |value|
-      unless value =~ /^\S+$/
+      unless value =~ %r{^\S+$}
         raise ArgumentError, "Invalid tag: #{value.inspect}"
       end
 
-      if value == "administrator"
-        raise ArgumentError, "must use admin property instead of administrator tag"
+      if value == 'administrator'
+        raise ArgumentError, 'must use admin property instead of administrator tag'
       end
     end
     defaultto []
 
     def insync?(is)
-      self.is_to_s(is) == self.should_to_s
+      is.sort == should.sort
     end
 
-    def is_to_s(currentvalue = @is)
-      if currentvalue
-        "[#{currentvalue.sort.join(', ')}]"
-      else
-        '[]'
-      end
+    def should_to_s(value)
+      Array(value)
     end
-
-    def should_to_s(newvalue = @should)
-      if newvalue
-        "[#{newvalue.sort.join(', ')}]"
-      else
-        '[]'
-      end
-    end
-
   end
-
-  validate do
-    if self[:ensure] == :present and ! self[:password]
-      raise ArgumentError, 'must set password when creating user' unless self[:password]
-    end
-  end
-
 end
index 493d47c..a1fc929 100644 (file)
@@ -1,5 +1,14 @@
 Puppet::Type.newtype(:rabbitmq_user_permissions) do
-  desc 'Type for managing rabbitmq user permissions'
+  desc <<-DESC
+Type for managing rabbitmq user permissions
+
+@example Define some rabbitmq_user_permissions
+ rabbitmq_user_permissions { 'dan@myvhost':
+   configure_permission => '.*',
+   read_permission      => '.*',
+   write_permission     => '.*',
+ }
+DESC
 
   ensurable do
     defaultto(:present)
@@ -13,9 +22,9 @@ Puppet::Type.newtype(:rabbitmq_user_permissions) do
 
   autorequire(:service) { 'rabbitmq-server' }
 
-  newparam(:name, :namevar => true) do
+  newparam(:name, namevar: true) do
     desc 'combination of user@vhost to grant privileges to'
-    newvalues(/^\S+@\S+$/)
+    newvalues(%r{^\S+@\S+$})
   end
 
   newproperty(:configure_permission) do
@@ -47,13 +56,9 @@ Puppet::Type.newtype(:rabbitmq_user_permissions) do
     [self[:name].split('@')[0]]
   end
 
-  # I may want to dissalow whitespace
   def validate_permissions(value)
-    begin
-      Regexp.new(value)
-    rescue RegexpError
-      raise ArgumentError, "Invalid regexp #{value}"
-    end
+    Regexp.new(value)
+  rescue RegexpError
+    raise ArgumentError, "Invalid regexp #{value}"
   end
-
 end
index 1349be6..8e9407e 100644 (file)
@@ -1,5 +1,15 @@
 Puppet::Type.newtype(:rabbitmq_vhost) do
-  desc 'manages rabbitmq vhosts'
+  desc <<-DESC
+Native type for managing rabbitmq vhosts
+
+@example query all current vhosts
+ $ puppet resource rabbitmq_vhost`
+
+@example Create a rabbitmq_vhost
+ rabbitmq_vhost { 'myvhost':
+   ensure => present,
+ }
+DESC
 
   ensurable do
     defaultto(:present)
@@ -13,9 +23,8 @@ Puppet::Type.newtype(:rabbitmq_vhost) do
 
   autorequire(:service) { 'rabbitmq-server' }
 
-  newparam(:name, :namevar => true) do
-    'name of the vhost to add'
-    newvalues(/^\S+$/)
+  newparam(:name, namevar: true) do
+    desc 'The name of the vhost to add'
+    newvalues(%r{^\S+$})
   end
-
 end
diff --git a/3rdparty/modules/rabbitmq/locales/config.yaml b/3rdparty/modules/rabbitmq/locales/config.yaml
new file mode 100644 (file)
index 0000000..f0a6ae6
--- /dev/null
@@ -0,0 +1,25 @@
+---
+# This is the project-specific configuration file for setting up
+# fast_gettext for your project.
+gettext:
+  # This is used for the name of the .pot and .po files; they will be
+  # called <project_name>.pot?
+  project_name: puppetlabs-rabbitmq
+  # This is used in comments in the .pot and .po files to indicate what
+  # project the files belong to and should bea little more desctiptive than
+  # <project_name>
+  package_name: puppetlabs-rabbitmq
+  # The locale that the default messages in the .pot file are in
+  default_locale: en
+  # The email used for sending bug reports.
+  bugs_address: docs@puppet.com
+  # The holder of the copyright.
+  copyright_holder: Puppet, Inc.
+  # This determines which comments in code should be eligible for translation.
+  # Any comments that start with this string will be externalized. (Leave
+  # empty to include all.)
+  comments_tag: TRANSLATOR
+  # Patterns for +Dir.glob+ used to find all files that might contain
+  # translatable content, relative to the project root directory
+  source_files:
+  
diff --git a/3rdparty/modules/rabbitmq/log/centos-6-x64-vcloud/2015-05-22_18_55_23/sut.log b/3rdparty/modules/rabbitmq/log/centos-6-x64-vcloud/2015-05-22_18_55_23/sut.log
deleted file mode 100644 (file)
index daba18f..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-2015-05-22 18:55:24    [+]     vcloud  el-6-x86_64     x7igdqecc5wczwg.delivery.puppetlabs.net (centos-6-vcloud)
-2015-05-22 18:56:27    [-]     vcloud  el-6-x86_64     x7igdqecc5wczwg.delivery.puppetlabs.net (centos-6-vcloud)
diff --git a/3rdparty/modules/rabbitmq/log/centos-6-x64-vcloud/2015-05-22_18_57_07/sut.log b/3rdparty/modules/rabbitmq/log/centos-6-x64-vcloud/2015-05-22_18_57_07/sut.log
deleted file mode 100644 (file)
index ee5be97..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-2015-05-22 18:57:08    [+]     vcloud  el-6-x86_64     bnzq0zsilo3bhbv.delivery.puppetlabs.net (centos-6-vcloud)
-2015-05-22 19:09:48    [-]     vcloud  el-6-x86_64     bnzq0zsilo3bhbv.delivery.puppetlabs.net (centos-6-vcloud)
diff --git a/3rdparty/modules/rabbitmq/log/debian-7-x64-vcloud/2015-05-22_18_35_45/sut.log b/3rdparty/modules/rabbitmq/log/debian-7-x64-vcloud/2015-05-22_18_35_45/sut.log
deleted file mode 100644 (file)
index 5f2329a..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-2015-05-22 18:35:46    [+]     vcloud  debian-7-x86_64 upzah8fcy4az78n.delivery.puppetlabs.net (debian-7-vcloud)
-2015-05-22 18:46:28    [-]     vcloud  debian-7-x86_64 upzah8fcy4az78n.delivery.puppetlabs.net (debian-7-vcloud)
diff --git a/3rdparty/modules/rabbitmq/log/debian-7-x64-vcloud/2015-05-22_18_49_58/sut.log b/3rdparty/modules/rabbitmq/log/debian-7-x64-vcloud/2015-05-22_18_49_58/sut.log
deleted file mode 100644 (file)
index 322d50b..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-2015-05-22 18:49:59    [+]     vcloud  debian-7-x86_64 pwvlrfgqbbgoc21.delivery.puppetlabs.net (debian-7-vcloud)
-2015-05-22 18:54:13    [-]     vcloud  debian-7-x86_64 pwvlrfgqbbgoc21.delivery.puppetlabs.net (debian-7-vcloud)
diff --git a/3rdparty/modules/rabbitmq/log/debian-7-x64-vcloud/2015-05-22_19_10_48/sut.log b/3rdparty/modules/rabbitmq/log/debian-7-x64-vcloud/2015-05-22_19_10_48/sut.log
deleted file mode 100644 (file)
index 5d01374..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-2015-05-22 19:10:49    [+]     vcloud  debian-7-x86_64 tnx0tmyf2ws118o.delivery.puppetlabs.net (debian-7-vcloud)
-2015-05-22 19:11:16    [-]     vcloud  debian-7-x86_64 tnx0tmyf2ws118o.delivery.puppetlabs.net (debian-7-vcloud)
diff --git a/3rdparty/modules/rabbitmq/log/debian-7-x64-vcloud/2015-05-22_19_11_31/sut.log b/3rdparty/modules/rabbitmq/log/debian-7-x64-vcloud/2015-05-22_19_11_31/sut.log
deleted file mode 100644 (file)
index ff82d28..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-2015-05-22 19:11:32    [+]     vcloud  debian-7-x86_64 inmrclcv6poi3ho.delivery.puppetlabs.net (debian-7-vcloud)
-2015-05-22 19:15:48    [-]     vcloud  debian-7-x86_64 inmrclcv6poi3ho.delivery.puppetlabs.net (debian-7-vcloud)
diff --git a/3rdparty/modules/rabbitmq/log/default/2015-05-22_18_35_28/sut.log b/3rdparty/modules/rabbitmq/log/default/2015-05-22_18_35_28/sut.log
deleted file mode 100644 (file)
index e69de29..0000000
index 159ae68..a1cdf26 100644 (file)
 # config and ssl.
 class rabbitmq::config {
 
-  $admin_enable               = $rabbitmq::admin_enable
-  $cluster_node_type          = $rabbitmq::cluster_node_type
-  $cluster_nodes              = $rabbitmq::cluster_nodes
-  $config                     = $rabbitmq::config
-  $config_cluster             = $rabbitmq::config_cluster
-  $config_path                = $rabbitmq::config_path
-  $config_stomp               = $rabbitmq::config_stomp
-  $default_user               = $rabbitmq::default_user
-  $default_pass               = $rabbitmq::default_pass
-  $env_config                 = $rabbitmq::env_config
-  $env_config_path            = $rabbitmq::env_config_path
-  $erlang_cookie              = $rabbitmq::erlang_cookie
-  $interface                  = $rabbitmq::interface
-  $management_port            = $rabbitmq::management_port
-  $node_ip_address            = $rabbitmq::node_ip_address
-  $plugin_dir                 = $rabbitmq::plugin_dir
-  $rabbitmq_user              = $rabbitmq::rabbitmq_user
-  $rabbitmq_group             = $rabbitmq::rabbitmq_group
-  $rabbitmq_home              = $rabbitmq::rabbitmq_home
-  $port                       = $rabbitmq::port
-  $tcp_keepalive              = $rabbitmq::tcp_keepalive
-  $service_name               = $rabbitmq::service_name
-  $ssl                        = $rabbitmq::ssl
-  $ssl_only                   = $rabbitmq::ssl_only
-  $ssl_cacert                 = $rabbitmq::ssl_cacert
-  $ssl_cert                   = $rabbitmq::ssl_cert
-  $ssl_key                    = $rabbitmq::ssl_key
-  $ssl_port                   = $rabbitmq::ssl_port
-  $ssl_interface              = $rabbitmq::ssl_interface
-  $ssl_management_port        = $rabbitmq::ssl_management_port
-  $ssl_stomp_port             = $rabbitmq::ssl_stomp_port
-  $ssl_verify                 = $rabbitmq::ssl_verify
-  $ssl_fail_if_no_peer_cert   = $rabbitmq::ssl_fail_if_no_peer_cert
-  $ssl_versions               = $rabbitmq::ssl_versions
-  $ssl_ciphers                = $rabbitmq::ssl_ciphers
-  $stomp_port                 = $rabbitmq::stomp_port
-  $ldap_auth                  = $rabbitmq::ldap_auth
-  $ldap_server                = $rabbitmq::ldap_server
-  $ldap_user_dn_pattern       = $rabbitmq::ldap_user_dn_pattern
-  $ldap_other_bind            = $rabbitmq::ldap_other_bind
-  $ldap_use_ssl               = $rabbitmq::ldap_use_ssl
-  $ldap_port                  = $rabbitmq::ldap_port
-  $ldap_log                   = $rabbitmq::ldap_log
-  $ldap_config_variables      = $rabbitmq::ldap_config_variables
-  $wipe_db_on_cookie_change   = $rabbitmq::wipe_db_on_cookie_change
-  $config_variables           = $rabbitmq::config_variables
-  $config_kernel_variables    = $rabbitmq::config_kernel_variables
-  $cluster_partition_handling = $rabbitmq::cluster_partition_handling
-  $file_limit                 = $rabbitmq::file_limit
-  $default_env_variables      =  {
-    'NODE_PORT'        => $port,
-    'NODE_IP_ADDRESS'  => $node_ip_address
+  $admin_enable                        = $rabbitmq::admin_enable
+  $cluster_node_type                   = $rabbitmq::cluster_node_type
+  $cluster_nodes                       = $rabbitmq::cluster_nodes
+  $config                              = $rabbitmq::config
+  $config_cluster                      = $rabbitmq::config_cluster
+  $config_path                         = $rabbitmq::config_path
+  $config_ranch                        = $rabbitmq::config_ranch
+  $config_stomp                        = $rabbitmq::config_stomp
+  $config_shovel                       = $rabbitmq::config_shovel
+  $config_shovel_statics               = $rabbitmq::config_shovel_statics
+  $default_user                        = $rabbitmq::default_user
+  $default_pass                        = $rabbitmq::default_pass
+  $env_config                          = $rabbitmq::env_config
+  $env_config_path                     = $rabbitmq::env_config_path
+  $erlang_cookie                       = $rabbitmq::erlang_cookie
+  $interface                           = $rabbitmq::interface
+  $management_port                     = $rabbitmq::management_port
+  $management_ssl                      = $rabbitmq::management_ssl
+  $management_hostname                 = $rabbitmq::management_hostname
+  $node_ip_address                     = $rabbitmq::node_ip_address
+  $rabbitmq_user                       = $rabbitmq::rabbitmq_user
+  $rabbitmq_group                      = $rabbitmq::rabbitmq_group
+  $rabbitmq_home                       = $rabbitmq::rabbitmq_home
+  $port                                = $rabbitmq::port
+  $tcp_keepalive                       = $rabbitmq::tcp_keepalive
+  $tcp_backlog                         = $rabbitmq::tcp_backlog
+  $tcp_sndbuf                          = $rabbitmq::tcp_sndbuf
+  $tcp_recbuf                          = $rabbitmq::tcp_recbuf
+  $heartbeat                           = $rabbitmq::heartbeat
+  $service_name                        = $rabbitmq::service_name
+  $ssl                                 = $rabbitmq::ssl
+  $ssl_only                            = $rabbitmq::ssl_only
+  $ssl_cacert                          = $rabbitmq::ssl_cacert
+  $ssl_cert                            = $rabbitmq::ssl_cert
+  $ssl_key                             = $rabbitmq::ssl_key
+  $ssl_depth                           = $rabbitmq::ssl_depth
+  $ssl_cert_password                   = $rabbitmq::ssl_cert_password
+  $ssl_port                            = $rabbitmq::ssl_port
+  $ssl_interface                       = $rabbitmq::ssl_interface
+  $ssl_management_port                 = $rabbitmq::ssl_management_port
+  $ssl_management_verify               = $rabbitmq::ssl_management_verify
+  $ssl_management_fail_if_no_peer_cert = $rabbitmq::ssl_management_fail_if_no_peer_cert
+  $ssl_stomp_port                      = $rabbitmq::ssl_stomp_port
+  $ssl_verify                          = $rabbitmq::ssl_verify
+  $ssl_fail_if_no_peer_cert            = $rabbitmq::ssl_fail_if_no_peer_cert
+  $ssl_secure_renegotiate              = $rabbitmq::ssl_secure_renegotiate
+  $ssl_reuse_sessions                  = $rabbitmq::ssl_reuse_sessions
+  $ssl_honor_cipher_order              = $rabbitmq::ssl_honor_cipher_order
+  $ssl_dhfile                          = $rabbitmq::ssl_dhfile
+  $ssl_versions                        = $rabbitmq::ssl_versions
+  $ssl_ciphers                         = $rabbitmq::ssl_ciphers
+  $stomp_port                          = $rabbitmq::stomp_port
+  $stomp_ssl_only                      = $rabbitmq::stomp_ssl_only
+  $ldap_auth                           = $rabbitmq::ldap_auth
+  $ldap_server                         = $rabbitmq::ldap_server
+  $ldap_user_dn_pattern                = $rabbitmq::ldap_user_dn_pattern
+  $ldap_other_bind                     = $rabbitmq::ldap_other_bind
+  $ldap_use_ssl                        = $rabbitmq::ldap_use_ssl
+  $ldap_port                           = $rabbitmq::ldap_port
+  $ldap_log                            = $rabbitmq::ldap_log
+  $ldap_config_variables               = $rabbitmq::ldap_config_variables
+  $wipe_db_on_cookie_change            = $rabbitmq::wipe_db_on_cookie_change
+  $config_variables                    = $rabbitmq::config_variables
+  $config_kernel_variables             = $rabbitmq::config_kernel_variables
+  $config_management_variables         = $rabbitmq::config_management_variables
+  $config_additional_variables         = $rabbitmq::config_additional_variables
+  $auth_backends                       = $rabbitmq::auth_backends
+  $cluster_partition_handling          = $rabbitmq::cluster_partition_handling
+  $file_limit                          = $rabbitmq::file_limit
+  $collect_statistics_interval         = $rabbitmq::collect_statistics_interval
+  $ipv6                                = $rabbitmq::ipv6
+  $inetrc_config                       = $rabbitmq::inetrc_config
+  $inetrc_config_path                  = $rabbitmq::inetrc_config_path
+  $ssl_erl_dist                        = $rabbitmq::ssl_erl_dist
+
+  if $ssl_only {
+    $default_ssl_env_variables = {}
+  } else {
+    $default_ssl_env_variables = {
+      'NODE_PORT'        => $port,
+      'NODE_IP_ADDRESS'  => $node_ip_address,
+    }
+  }
+
+  # This seems like a sensible default, and I think we have to assign it here
+  # to be safe. Use $node_ip_address (which can also be undef) if
+  # $management_ip_address is not set.
+  if $rabbitmq::management_ip_address {
+    $management_ip_address = $rabbitmq::management_ip_address
+  } else {
+    $management_ip_address = $rabbitmq::node_ip_address
   }
 
+  $inetrc_env = {'export ERL_INETRC' => $inetrc_config_path}
+
   # Handle env variables.
-  $environment_variables = merge($default_env_variables, $rabbitmq::environment_variables)
+  $_environment_variables = $default_ssl_env_variables + $inetrc_env + $rabbitmq::environment_variables
+
+  if $ipv6 or $ssl_erl_dist {
+    # must append "-proto_dist inet6_tcp" to any provided ERL_ARGS for
+    # both the server and rabbitmqctl, being careful not to mess up
+    # quoting. If both IPv6 and TLS are enabled, we must use "inet6_tls".
+    # Finally, if only TLS is enabled (no IPv6), the -proto_dist value to use
+    # is "inet_tls".
+    if $ipv6 and $ssl_erl_dist {
+      $proto_dist = 'inet6_tls'
+      $ssl_path = " -pa ${::erl_ssl_path} "
+    } elsif $ssl_erl_dist {
+      $proto_dist = 'inet_tls'
+      $ssl_path = " -pa ${::erl_ssl_path} "
+    } else {
+      $proto_dist = 'inet6_tcp'
+      $ssl_path = ''
+    }
+    $ipv6_or_tls_env = ['SERVER', 'CTL'].reduce({}) |$memo, $item| {
+      $orig = $_environment_variables["RABBITMQ_${item}_ERL_ARGS"]
+      $munged = $orig ? {
+        # already quoted, keep quoting
+        /^([\'\"])(.*)\1/ => "${1}${2}${ssl_path} -proto_dist ${proto_dist}${1}",
+        # unset, add our own quoted value
+        undef             => "\"${ssl_path}-proto_dist ${proto_dist}\"",
+        # previously unquoted value, add quoting
+        default           => "\"${orig}${ssl_path} -proto_dist ${proto_dist}\"",
+      }
+
+      merge($memo, {"RABBITMQ_${item}_ERL_ARGS" => $munged})
+    }
+
+    $environment_variables = $_environment_variables + $ipv6_or_tls_env
+  } else {
+    $environment_variables = $_environment_variables
+  }
 
   file { '/etc/rabbitmq':
     ensure => directory,
     owner  => '0',
     group  => '0',
-    mode   => '0644',
+    mode   => '0755',
   }
 
   file { '/etc/rabbitmq/ssl':
     ensure => directory,
     owner  => '0',
     group  => '0',
-    mode   => '0644',
+    mode   => '0755',
   }
 
   file { 'rabbitmq.config':
@@ -79,8 +155,8 @@ class rabbitmq::config {
     path    => $config_path,
     content => template($config),
     owner   => '0',
-    group   => '0',
-    mode    => '0644',
+    group   => $rabbitmq_group,
+    mode    => '0640',
     notify  => Class['rabbitmq::service'],
   }
 
@@ -89,8 +165,18 @@ class rabbitmq::config {
     path    => $env_config_path,
     content => template($env_config),
     owner   => '0',
-    group   => '0',
-    mode    => '0644',
+    group   => $rabbitmq_group,
+    mode    => '0640',
+    notify  => Class['rabbitmq::service'],
+  }
+
+  file { 'rabbitmq-inetrc':
+    ensure  => file,
+    path    => $inetrc_config_path,
+    content => template($inetrc_config),
+    owner   => '0',
+    group   => $rabbitmq_group,
+    mode    => '0640',
     notify  => Class['rabbitmq::service'],
   }
 
@@ -100,14 +186,35 @@ class rabbitmq::config {
       path    => '/etc/rabbitmq/rabbitmqadmin.conf',
       content => template('rabbitmq/rabbitmqadmin.conf.erb'),
       owner   => '0',
-      group   => '0',
-      mode    => '0644',
+      group   => $rabbitmq_group,
+      mode    => '0640',
       require => File['/etc/rabbitmq'],
     }
   }
 
-  case $::osfamily {
+  case $facts['os']['family'] {
     'Debian': {
+      if versioncmp($facts['os']['release']['full'], '16.04') >= 0 {
+        file { '/etc/systemd/system/rabbitmq-server.service.d':
+          ensure                  => directory,
+          owner                   => '0',
+          group                   => '0',
+          mode                    => '0755',
+          selinux_ignore_defaults => true,
+        }
+        -> file { '/etc/systemd/system/rabbitmq-server.service.d/limits.conf':
+          content => template('rabbitmq/rabbitmq-server.service.d/limits.conf'),
+          owner   => '0',
+          group   => '0',
+          mode    => '0644',
+          notify  => Exec['rabbitmq-systemd-reload'],
+        }
+        exec { 'rabbitmq-systemd-reload':
+          command     => '/bin/systemctl daemon-reload',
+          notify      => Class['Rabbitmq::Service'],
+          refreshonly => true,
+        }
+      }
       file { '/etc/default/rabbitmq-server':
         ensure  => file,
         content => template('rabbitmq/default.erb'),
@@ -118,15 +225,15 @@ class rabbitmq::config {
       }
     }
     'RedHat': {
-      if versioncmp($::operatingsystemmajrelease, '7') >= 0 {
+      if versioncmp($facts['os']['release']['major'], '7') >= 0 {
         file { '/etc/systemd/system/rabbitmq-server.service.d':
           ensure                  => directory,
           owner                   => '0',
           group                   => '0',
           mode                    => '0755',
           selinux_ignore_defaults => true,
-        } ->
-        file { '/etc/systemd/system/rabbitmq-server.service.d/limits.conf':
+        }
+        -> file { '/etc/systemd/system/rabbitmq-server.service.d/limits.conf':
           content => template('rabbitmq/rabbitmq-server.service.d/limits.conf'),
           owner   => '0',
           group   => '0',
@@ -134,39 +241,56 @@ class rabbitmq::config {
           notify  => Exec['rabbitmq-systemd-reload'],
         }
         exec { 'rabbitmq-systemd-reload':
-          command     => '/usr/bin/systemctl daemon-reload',
+          command     => '/bin/systemctl daemon-reload',
           notify      => Class['Rabbitmq::Service'],
           refreshonly => true,
         }
-      } else {
-        file { '/etc/security/limits.d/rabbitmq-server.conf':
-          content => template('rabbitmq/limits.conf'),
-          owner   => '0',
-          group   => '0',
-          mode    => '0644',
-          notify  => Class['Rabbitmq::Service'],
-        }
+      }
+      file { '/etc/security/limits.d/rabbitmq-server.conf':
+        content => template('rabbitmq/limits.conf'),
+        owner   => '0',
+        group   => '0',
+        mode    => '0644',
+        notify  => Class['Rabbitmq::Service'],
+      }
+    }
+    'Archlinux': {
+      file { '/etc/systemd/system/rabbitmq.service.d':
+        ensure                  => directory,
+        owner                   => '0',
+        group                   => '0',
+        mode                    => '0755',
+        selinux_ignore_defaults => true,
+      }
+      -> file { '/etc/systemd/system/rabbitmq.service.d/limits.conf':
+        content => template('rabbitmq/rabbitmq-server.service.d/limits.conf'),
+        owner   => '0',
+        group   => '0',
+        mode    => '0644',
+        notify  => Exec['rabbitmq-systemd-reload'],
+      }
+      exec { 'rabbitmq-systemd-reload':
+        command     => '/bin/systemctl daemon-reload',
+        notify      => Class['Rabbitmq::Service'],
+        refreshonly => true,
       }
     }
     default: {
     }
   }
 
-  if $config_cluster {
-
-    if $erlang_cookie == undef {
-      fail('You must set the $erlang_cookie value in order to configure clustering.')
-    } else {
-      rabbitmq_erlang_cookie { "${rabbitmq_home}/.erlang.cookie":
-        content        => $erlang_cookie,
-        force          => $wipe_db_on_cookie_change,
-        rabbitmq_user  => $rabbitmq_user,
-        rabbitmq_group => $rabbitmq_group,
-        rabbitmq_home  => $rabbitmq_home,
-        service_name   => $service_name,
-        before         => File['rabbitmq.config'],
-        notify         => Class['rabbitmq::service'],
-      }
+  if $erlang_cookie == undef and $config_cluster {
+    fail('You must set the $erlang_cookie value in order to configure clustering.')
+  } elsif $erlang_cookie != undef {
+    rabbitmq_erlang_cookie { "${rabbitmq_home}/.erlang.cookie":
+      content        => $erlang_cookie,
+      force          => $wipe_db_on_cookie_change,
+      rabbitmq_user  => $rabbitmq_user,
+      rabbitmq_group => $rabbitmq_group,
+      rabbitmq_home  => $rabbitmq_home,
+      service_name   => $service_name,
+      before         => File['rabbitmq.config'],
+      notify         => Class['rabbitmq::service'],
     }
   }
 }
index 4e115f9..12b0bd7 100644 (file)
-# Main rabbitmq class
+# rabbitmq
+#
+# @summary A module to manage RabbitMQ
+#
+# @example Basic usage
+#  include rabbitmq
+#
+# @example rabbitmq class
+#  class { 'rabbitmq':
+#    service_manage    => false,
+#    port              => '5672',
+#    delete_guest_user => true,
+#  }
+#
+# @example Offline installation from local mirror:
+#
+#  class { 'rabbitmq':
+#    key_content     => template('openstack/rabbit.pub.key'),
+#    package_gpg_key => '/tmp/rabbit.pub.key',
+#  }
+#
+# @example Use external package key source for any (apt/rpm) package provider:
+#  class { 'rabbitmq':
+#    package_gpg_key => 'http://www.some_site.some_domain/some_key.pub.key',
+#  }
+#
+# @example To use RabbitMQ Environment Variables, use the parameters `environment_variables` e.g.:
+#
+#  class { 'rabbitmq':
+#    port                  => '5672',
+#    environment_variables => {
+#      'NODENAME'    => 'node01',
+#      'SERVICENAME' => 'RabbitMQ'
+#    }
+#  }
+#
+# @example Change RabbitMQ Config Variables in rabbitmq.config:
+#
+#  class { 'rabbitmq':
+#    port             => '5672',
+#    config_variables => {
+#      'hipe_compile' => true,
+#      'frame_max'    => 131072,
+#      'log_levels'   => "[{connection, info}]"
+#    }
+#  }
+#
+# @example Change Erlang Kernel Config Variables in rabbitmq.config
+#  class { 'rabbitmq':
+#    port                    => '5672',
+#    config_kernel_variables => {
+#      'inet_dist_listen_min' => 9100,
+#      'inet_dist_listen_max' => 9105,
+#    }
+#  }
+# @example Change Management Plugin Config Variables in rabbitmq.config
+#  class { 'rabbitmq':
+#    config_management_variables => {
+#      'rates_mode' => 'basic',
+#    }
+#  }
+#
+# @example Change Additional Config Variables in rabbitmq.config
+#  class { 'rabbitmq':
+#    config_additional_variables => {
+#      'autocluster' => '[{consul_service, "rabbit"},{cluster_name, "rabbit"}]',
+#      'foo'         => '[{bar, "baz"}]'
+#    }
+#  }
+#  This will result in the following config appended to the config file:
+#  {autocluster, [{consul_service, "rabbit"},{cluster_name, "rabbit"}]},
+#   {foo, [{bar, "baz"}]}
+#  (This is required for the [autocluster plugin](https://github.com/aweber/rabbitmq-autocluster)
+#
+# @example Use RabbitMQ clustering facilities
+#  class { 'rabbitmq':
+#    config_cluster           => true,
+#    cluster_nodes            => ['rabbit1', 'rabbit2'],
+#    cluster_node_type        => 'ram',
+#    erlang_cookie            => 'A_SECRET_COOKIE_STRING',
+#    wipe_db_on_cookie_change => true,
+#  }
+#
+# @param admin_enable If enabled sets up the management interface/plugin for RabbitMQ.
+# @param auth_backends An array specifying authorization/authentication backend to use. Single quotes should be placed around array entries, ex. ['{foo, baz}', 'baz'] Defaults to [rabbit_auth_backend_internal], and if using LDAP defaults to [rabbit_auth_backend_internal, rabbit_auth_backend_ldap].
+# @param cluster_node_type Choose between disc and ram nodes.
+# @param cluster_nodes An array of nodes for clustering.
+# @param cluster_partition_handling Value to set for `cluster_partition_handling` RabbitMQ configuration variable.
+# @param collect_statistics_interval Set the collect_statistics_interval in rabbitmq.config
+# @param config The file to use as the rabbitmq.config template.
+# @param config_additional_variables Additional config variables in rabbitmq.config
+# @param config_cluster Enable or disable clustering support.
+# @param config_kernel_variables Hash of Erlang kernel configuration variables to set (see [Variables Configurable in rabbitmq.config](#variables-configurable-in-rabbitmq.config)).
+# @param config_path The path to write the RabbitMQ configuration file to.
+# @param config_management_variables Hash of configuration variables for the [Management Plugin](https://www.rabbitmq.com/management.html).
+# @param config_stomp Enable or disable stomp.
+# @param config_shovel Enable or disable shovel.
+# @param config_shovel_statics Hash of static shovel configurations
+# @param config_variables To set config variables in rabbitmq.config
+# @param default_user Username to set for the `default_user` in rabbitmq.config.
+# @param default_pass Password to set for the `default_user` in rabbitmq.config.
+# @param delete_guest_user Controls whether default guest user is deleted.
+# @param env_config The template file to use for rabbitmq_env.config.
+# @param env_config_path The path to write the rabbitmq_env.config file to.
+# @param environment_variables RabbitMQ Environment Variables in rabbitmq_env.config
+# @param erlang_cookie The erlang cookie to use for clustering - must be the same between all nodes. This value has no default and must be
+#  set explicitly if using clustering. If you run Pacemaker and you don't want to use RabbitMQ buildin cluster, you can set config_cluster
+#  to 'False' and set 'erlang_cookie'.
+# @param file_limit Set rabbitmq file ulimit. Defaults to 16384. Only available on systems with `$::osfamily == 'Debian'` or
+#  `$::osfamily == 'RedHat'`.
+# @param heartbeat Set the heartbeat timeout interval, default is unset which uses the builtin server defaults of 60 seconds. Setting this
+# @param inetrc_config Template to use for the inetrc config
+# @param inetrc_config_path Path of the file to push the inetrc config to.
+# @param ipv6 Whether to listen on ipv6
+# @param interface Interface to bind to (sets tcp_listeners parameter). By default, bind to all interfaces
+#  to `0` will disable heartbeats.
+# @param key_content Uses content method for Debian OS family. Should be a template for apt::source class. Overrides `package_gpg_key`
+#  behavior, if enabled. Undefined by default.
+# @param ldap_auth Set to true to enable LDAP auth.
+# @param ldap_server LDAP server to use for auth.
+# @param ldap_user_dn_pattern User DN pattern for LDAP auth.
+# @param ldap_other_bind How to bind to the LDAP server. Defaults to 'anon'.
+# @param ldap_config_variables Hash of other LDAP config variables.
+# @param ldap_use_ssl Set to true to use SSL for the LDAP server.
+# @param ldap_port Numeric port for LDAP server.
+# @param ldap_log Set to true to log LDAP auth.
+# @param manage_python If enabled, on platforms that don't provide a Python 2 package by default, ensure that the python package is
+#  installed (for rabbitmqadmin). This will only apply if `admin_enable` and `service_manage` are set.
+# @param management_hostname The hostname for the RabbitMQ management interface.
+# @param management_port The port for the RabbitMQ management interface.
+# @param management_ip_address Allows you to set the IP for management interface to bind to separately. Set to 127.0.0.1 to bind to
+#  localhost only, or 0.0.0.0 to bind to all interfaces.
+# @param management_ssl Enable/Disable SSL for the management port. Has an effect only if ssl => true.
+# @param node_ip_address Allows you to set the IP for RabbitMQ service to bind to. Set to 127.0.0.1 to bind to localhost only, or 0.0.0.0
+#  to bind to all interfaces.
+# @param package_apt_pin Whether to pin the package to a particular source
+# @param package_ensure Determines the ensure state of the package.  Set to installed by default, but could be changed to latest.
+# @param package_gpg_key RPM package GPG key to import. Uses source method. Should be a URL for Debian/RedHat OS family, or a file name for
+#  RedHat OS family. Set to https://packagecloud.io/gpg.key by default. Note, that `key_content`, if specified, would override this
+#  parameter for Debian OS family.
+# @param package_name Name(s) of the package(s) to install
+# @param port The RabbitMQ port.
+# @param repos_ensure Ensure that a repo with the official (and newer) RabbitMQ package is configured, along with its signing key.
+#  Defaults to false (use system packages). This does not ensure that soft dependencies (like EPEL on RHEL systems) are present.
+# @param service_ensure The state of the service.
+# @param service_manage Determines if the service is managed.
+# @param service_name The name of the service to manage.
+# @param ssl Configures the service for using SSL.
+#  port => UNSET
+# @param ssl_cacert CA cert path to use for SSL.
+# @param ssl_cert Cert to use for SSL.
+# @param ssl_cert_password Password used when generating CSR.
+# @param ssl_depth SSL verification depth.
+# @param ssl_dhfile Use this dhparam file [example: generate with `openssl dhparam -out /etc/rabbitmq/ssl/dhparam.pem 2048`
+# @param ssl_erl_dist Whether to use the erlang package's SSL (relies on the ssl_erl_path fact)
+# @param ssl_honor_cipher_order Force use of server cipher order
+# @param ssl_interface Interface for SSL listener to bind to
+# @param ssl_key Key to use for SSL.
+# @param ssl_only Configures the service to only use SSL.  No cleartext TCP listeners will be created. Requires that ssl => true and
+# @param ssl_management_port SSL management port.
+# @param ssl_port SSL port for RabbitMQ
+# @param ssl_reuse_sessions Reuse ssl sessions
+# @param ssl_secure_renegotiate Use ssl secure renegotiate
+# @param ssl_stomp_port SSL stomp port.
+# @param ssl_verify rabbitmq.config SSL verify setting.
+# @param ssl_fail_if_no_peer_cert rabbitmq.config `fail_if_no_peer_cert` setting.
+# @param ssl_management_verify rabbitmq.config SSL verify setting for rabbitmq_management.
+# @param ssl_manaagement_fail_if_no_peer_cert rabbitmq.config `fail_if_no_peer_cert` setting for rabbitmq_management.
+# @param ssl_versions Choose which SSL versions to enable. Example: `['tlsv1.2', 'tlsv1.1']` Note that it is recommended to disable `sslv3
+#  and `tlsv1` to prevent against POODLE and BEAST attacks. Please see the [RabbitMQ SSL](https://www.rabbitmq.com/ssl.html) documentation
+#  for more information.
+# @param ssl_ciphers Support only a given list of SSL ciphers. Example: `['dhe_rsa,aes_256_cbc,sha','dhe_dss,aes_256_cbc,sha',
+#  'ecdhe_rsa,aes_256_cbc,sha']`. Supported ciphers in your install can be listed with: rabbitmqctl eval 'ssl:cipher_suites().'
+#  Functionality can be tested with cipherscan or similar tool: https://github.com/jvehent/cipherscan.git
+# @param stomp_port The port to use for Stomp.
+# @param stomp_ssl_only Configures STOMP to only use SSL.  No cleartext STOMP TCP listeners will be created. Requires setting
+#  ssl_stomp_port also.
+# @param stomp_ensure Enable to install the stomp plugin.
+# @param tcp_backlog The size of the backlog on TCP connections.
+# @param tcp_keepalive Enable TCP connection keepalive for RabbitMQ service.
+# @param tcp_recbuf Corresponds to recbuf in RabbitMQ `tcp_listen_options`
+# @param tcp_sndbuf Integer, corresponds to sndbuf in RabbitMQ `tcp_listen_options`
+# @param wipe_db_on_cookie_change Boolean to determine if we should DESTROY AND DELETE the RabbitMQ database.
+# @param rabbitmq_user OS dependent, default defined in param.pp. The system user the rabbitmq daemon runs as.
+# @param rabbitmq_group OS dependent, default defined in param.pp. The system group the rabbitmq daemon runs as.
+# @param rabbitmq_home OS dependent. default defined in param.pp. The home directory of the rabbitmq deamon.
+# @param $rabbitmqadmin_package OS dependent. default defined in param.pp. If undef: install rabbitmqadmin via archive, otherwise via package
+# @param $archive_options. default defined in param.pp.  Extra options to Archive resource to download rabbitmqadmin file
 class rabbitmq(
-  $admin_enable               = $rabbitmq::params::admin_enable,
-  $cluster_node_type          = $rabbitmq::params::cluster_node_type,
-  $cluster_nodes              = $rabbitmq::params::cluster_nodes,
-  $config                     = $rabbitmq::params::config,
-  $config_cluster             = $rabbitmq::params::config_cluster,
-  $config_path                = $rabbitmq::params::config_path,
-  $config_stomp               = $rabbitmq::params::config_stomp,
-  $default_user               = $rabbitmq::params::default_user,
-  $default_pass               = $rabbitmq::params::default_pass,
-  $delete_guest_user          = $rabbitmq::params::delete_guest_user,
-  $env_config                 = $rabbitmq::params::env_config,
-  $env_config_path            = $rabbitmq::params::env_config_path,
-  $erlang_cookie              = $rabbitmq::params::erlang_cookie,
-  $interface                  = $rabbitmq::params::interface,
-  $management_port            = $rabbitmq::params::management_port,
-  $node_ip_address            = $rabbitmq::params::node_ip_address,
-  $package_apt_pin            = $rabbitmq::params::package_apt_pin,
-  $package_ensure             = $rabbitmq::params::package_ensure,
-  $package_gpg_key            = $rabbitmq::params::package_gpg_key,
-  $package_name               = $rabbitmq::params::package_name,
-  $package_provider           = $rabbitmq::params::package_provider,
-  $package_source             = undef,
-  $repos_ensure               = $rabbitmq::params::repos_ensure,
-  $manage_repos               = $rabbitmq::params::manage_repos,
-  $plugin_dir                 = $rabbitmq::params::plugin_dir,
-  $rabbitmq_user              = $rabbitmq::params::rabbitmq_user,
-  $rabbitmq_group             = $rabbitmq::params::rabbitmq_group,
-  $rabbitmq_home              = $rabbitmq::params::rabbitmq_home,
-  $port                       = $rabbitmq::params::port,
-  $tcp_keepalive              = $rabbitmq::params::tcp_keepalive,
-  $service_ensure             = $rabbitmq::params::service_ensure,
-  $service_manage             = $rabbitmq::params::service_manage,
-  $service_name               = $rabbitmq::params::service_name,
-  $ssl                        = $rabbitmq::params::ssl,
-  $ssl_only                   = $rabbitmq::params::ssl_only,
-  $ssl_cacert                 = $rabbitmq::params::ssl_cacert,
-  $ssl_cert                   = $rabbitmq::params::ssl_cert,
-  $ssl_key                    = $rabbitmq::params::ssl_key,
-  $ssl_port                   = $rabbitmq::params::ssl_port,
-  $ssl_interface              = $rabbitmq::params::ssl_interface,
-  $ssl_management_port        = $rabbitmq::params::ssl_management_port,
-  $ssl_stomp_port             = $rabbitmq::params::ssl_stomp_port,
-  $ssl_verify                 = $rabbitmq::params::ssl_verify,
-  $ssl_fail_if_no_peer_cert   = $rabbitmq::params::ssl_fail_if_no_peer_cert,
-  $ssl_versions               = $rabbitmq::params::ssl_versions,
-  $ssl_ciphers                = $rabbitmq::params::ssl_ciphers,
-  $stomp_ensure               = $rabbitmq::params::stomp_ensure,
-  $ldap_auth                  = $rabbitmq::params::ldap_auth,
-  $ldap_server                = $rabbitmq::params::ldap_server,
-  $ldap_user_dn_pattern       = $rabbitmq::params::ldap_user_dn_pattern,
-  $ldap_other_bind            = $rabbitmq::params::ldap_other_bind,
-  $ldap_use_ssl               = $rabbitmq::params::ldap_use_ssl,
-  $ldap_port                  = $rabbitmq::params::ldap_port,
-  $ldap_log                   = $rabbitmq::params::ldap_log,
-  $ldap_config_variables      = $rabbitmq::params::ldap_config_variables,
-  $stomp_port                 = $rabbitmq::params::stomp_port,
-  $version                    = $rabbitmq::params::version,
-  $wipe_db_on_cookie_change   = $rabbitmq::params::wipe_db_on_cookie_change,
-  $cluster_partition_handling = $rabbitmq::params::cluster_partition_handling,
-  $file_limit                 = $rabbitmq::params::file_limit,
-  $environment_variables      = $rabbitmq::params::environment_variables,
-  $config_variables           = $rabbitmq::params::config_variables,
-  $config_kernel_variables    = $rabbitmq::params::config_kernel_variables,
-  $key_content                = undef,
+  Boolean $admin_enable                                            = $rabbitmq::params::admin_enable,
+  Enum['ram', 'disk', 'disc'] $cluster_node_type                   = $rabbitmq::params::cluster_node_type,
+  Array $cluster_nodes                                             = $rabbitmq::params::cluster_nodes,
+  String $config                                                   = $rabbitmq::params::config,
+  Boolean $config_cluster                                          = $rabbitmq::params::config_cluster,
+  Stdlib::Absolutepath $config_path                                = $rabbitmq::params::config_path,
+  Boolean $config_ranch                                            = $rabbitmq::params::config_ranch,
+  Boolean $config_stomp                                            = $rabbitmq::params::config_stomp,
+  Boolean $config_shovel                                           = $rabbitmq::params::config_shovel,
+  Hash $config_shovel_statics                                      = $rabbitmq::params::config_shovel_statics,
+  String $default_user                                             = $rabbitmq::params::default_user,
+  String $default_pass                                             = $rabbitmq::params::default_pass,
+  Boolean $delete_guest_user                                       = $rabbitmq::params::delete_guest_user,
+  String $env_config                                               = $rabbitmq::params::env_config,
+  Stdlib::Absolutepath $env_config_path                            = $rabbitmq::params::env_config_path,
+  Optional[String] $erlang_cookie                                  = undef,
+  Optional[String] $interface                                      = undef,
+  Optional[String] $management_ip_address                          = undef,
+  Integer[1, 65535] $management_port                               = $rabbitmq::params::management_port,
+  Boolean $management_ssl                                          = $rabbitmq::params::management_ssl,
+  Optional[String] $management_hostname                            = undef,
+  Optional[String] $node_ip_address                                = undef,
+  Optional[Variant[Numeric, String]] $package_apt_pin              = undef,
+  String $package_ensure                                           = $rabbitmq::params::package_ensure,
+  Optional[String] $package_gpg_key                                = $rabbitmq::params::package_gpg_key,
+  Variant[String, Array] $package_name                             = $rabbitmq::params::package_name,
+  Optional[String] $package_source                                 = undef,
+  Optional[String] $package_provider                               = undef,
+  Boolean $repos_ensure                                            = $rabbitmq::params::repos_ensure,
+  Boolean $manage_python                                           = $rabbitmq::params::manage_python,
+  String $rabbitmq_user                                            = $rabbitmq::params::rabbitmq_user,
+  String $rabbitmq_group                                           = $rabbitmq::params::rabbitmq_group,
+  Stdlib::Absolutepath $rabbitmq_home                              = $rabbitmq::params::rabbitmq_home,
+  Integer $port                                                    = $rabbitmq::params::port,
+  Boolean $tcp_keepalive                                           = $rabbitmq::params::tcp_keepalive,
+  Integer $tcp_backlog                                             = $rabbitmq::params::tcp_backlog,
+  Optional[Integer] $tcp_sndbuf                                    = undef,
+  Optional[Integer] $tcp_recbuf                                    = undef,
+  Optional[Integer] $heartbeat                                     = undef,
+  Enum['running', 'stopped'] $service_ensure                       = $rabbitmq::params::service_ensure,
+  Boolean $service_manage                                          = $rabbitmq::params::service_manage,
+  String $service_name                                             = $rabbitmq::params::service_name,
+  Boolean $ssl                                                     = $rabbitmq::params::ssl,
+  Boolean $ssl_only                                                = $rabbitmq::params::ssl_only,
+  Optional[Stdlib::Absolutepath] $ssl_cacert                       = undef,
+  Optional[Stdlib::Absolutepath] $ssl_cert                         = undef,
+  Optional[Stdlib::Absolutepath] $ssl_key                          = undef,
+  Optional[Integer] $ssl_depth                                     = undef,
+  Optional[String] $ssl_cert_password                              = undef,
+  Integer[1, 65535] $ssl_port                                      = $rabbitmq::params::ssl_port,
+  Optional[String] $ssl_interface                                  = undef,
+  Integer[1, 65535] $ssl_management_port                           = $rabbitmq::params::ssl_management_port,
+  Integer[1, 65535] $ssl_stomp_port                                = $rabbitmq::params::ssl_stomp_port,
+  Enum['verify_none','verify_peer'] $ssl_verify                    = $rabbitmq::params::ssl_verify,
+  Boolean $ssl_fail_if_no_peer_cert                                = $rabbitmq::params::ssl_fail_if_no_peer_cert,
+  Enum['verify_none','verify_peer'] $ssl_management_verify         = $rabbitmq::params::ssl_management_verify,
+  Boolean $ssl_management_fail_if_no_peer_cert                     = $rabbitmq::params::ssl_management_fail_if_no_peer_cert,
+  Optional[Array] $ssl_versions                                    = undef,
+  Boolean $ssl_secure_renegotiate                                  = $rabbitmq::params::ssl_secure_renegotiate,
+  Boolean $ssl_reuse_sessions                                      = $rabbitmq::params::ssl_reuse_sessions,
+  Boolean $ssl_honor_cipher_order                                  = $rabbitmq::params::ssl_honor_cipher_order,
+  Optional[Stdlib::Absolutepath] $ssl_dhfile                       = undef,
+  Array $ssl_ciphers                                               = $rabbitmq::params::ssl_ciphers,
+  Boolean $stomp_ensure                                            = $rabbitmq::params::stomp_ensure,
+  Boolean $ldap_auth                                               = $rabbitmq::params::ldap_auth,
+  String $ldap_server                                              = $rabbitmq::params::ldap_server,
+  Optional[String] $ldap_user_dn_pattern                           = $rabbitmq::params::ldap_user_dn_pattern,
+  String $ldap_other_bind                                          = $rabbitmq::params::ldap_other_bind,
+  Boolean $ldap_use_ssl                                            = $rabbitmq::params::ldap_use_ssl,
+  Integer[1, 65535] $ldap_port                                     = $rabbitmq::params::ldap_port,
+  Boolean $ldap_log                                                = $rabbitmq::params::ldap_log,
+  Hash $ldap_config_variables                                      = $rabbitmq::params::ldap_config_variables,
+  Integer[1, 65535] $stomp_port                                    = $rabbitmq::params::stomp_port,
+  Boolean $stomp_ssl_only                                          = $rabbitmq::params::stomp_ssl_only,
+  Boolean $wipe_db_on_cookie_change                                = $rabbitmq::params::wipe_db_on_cookie_change,
+  String $cluster_partition_handling                               = $rabbitmq::params::cluster_partition_handling,
+  Variant[Integer[-1,], Enum['unlimited', 'infinity']] $file_limit = $rabbitmq::params::file_limit,
+  Hash $environment_variables                                      = $rabbitmq::params::environment_variables,
+  Hash $config_variables                                           = $rabbitmq::params::config_variables,
+  Hash $config_kernel_variables                                    = $rabbitmq::params::config_kernel_variables,
+  Hash $config_management_variables                                = $rabbitmq::params::config_management_variables,
+  Hash $config_additional_variables                                = $rabbitmq::params::config_additional_variables,
+  Optional[Array] $auth_backends                                   = undef,
+  Optional[String] $key_content                                    = undef,
+  Optional[Integer] $collect_statistics_interval                   = undef,
+  Boolean $ipv6                                                    = $rabbitmq::params::ipv6,
+  String $inetrc_config                                            = $rabbitmq::params::inetrc_config,
+  Stdlib::Absolutepath $inetrc_config_path                         = $rabbitmq::params::inetrc_config_path,
+  Boolean $ssl_erl_dist                                            = $rabbitmq::params::ssl_erl_dist,
+  Optional[String] $rabbitmqadmin_package                          = $rabbitmq::params::rabbitmqadmin_package,
+  Array $archive_options                                           = $rabbitmq::params::archive_options,
 ) inherits rabbitmq::params {
 
-  validate_bool($admin_enable)
-  # Validate install parameters.
-  validate_re($package_apt_pin, '^(|\d+)$')
-  validate_string($package_ensure)
-  validate_string($package_gpg_key)
-  validate_string($package_name)
-  validate_string($package_provider)
-  validate_bool($repos_ensure)
-  validate_re($version, '^\d+\.\d+\.\d+(-\d+)*$') # Allow 3 digits and optional -n postfix.
-  # Validate config parameters.
-  validate_re($cluster_node_type, '^(ram|disc|disk)$') # Both disc and disk are valid http://www.rabbitmq.com/clustering.html
-  validate_array($cluster_nodes)
-  validate_string($config)
-  validate_absolute_path($config_path)
-  validate_bool($config_cluster)
-  validate_bool($config_stomp)
-  validate_string($default_user)
-  validate_string($default_pass)
-  validate_bool($delete_guest_user)
-  validate_string($env_config)
-  validate_absolute_path($env_config_path)
-  validate_string($erlang_cookie)
-  if ! is_integer($management_port) {
-    validate_re($management_port, '\d+')
-  }
-  validate_string($node_ip_address)
-  validate_absolute_path($plugin_dir)
-  if ! is_integer($port) {
-    validate_re($port, ['\d+','UNSET'])
-  }
-  if ! is_integer($stomp_port) {
-    validate_re($stomp_port, '\d+')
-  }
-  validate_bool($wipe_db_on_cookie_change)
-  validate_bool($tcp_keepalive)
-  if ! is_integer($file_limit) {
-    validate_re($file_limit, '^(unlimited|infinity)$', '$file_limit must be an integer, \'unlimited\', or \'infinity\'.')
-  }
-  # Validate service parameters.
-  validate_re($service_ensure, '^(running|stopped)$')
-  validate_bool($service_manage)
-  validate_string($service_name)
-  validate_bool($ssl)
-  validate_bool($ssl_only)
-  validate_string($ssl_cacert)
-  validate_string($ssl_cert)
-  validate_string($ssl_key)
-  validate_array($ssl_ciphers)
-  if ! is_integer($ssl_port) {
-    validate_re($ssl_port, '\d+')
-  }
-  if ! is_integer($ssl_management_port) {
-    validate_re($ssl_management_port, '\d+')
-  }
-  if ! is_integer($ssl_stomp_port) {
-    validate_re($ssl_stomp_port, '\d+')
-  }
-  validate_bool($stomp_ensure)
-  validate_bool($ldap_auth)
-  validate_string($ldap_server)
-  validate_string($ldap_user_dn_pattern)
-  validate_string($ldap_other_bind)
-  validate_hash($ldap_config_variables)
-  validate_bool($ldap_use_ssl)
-  validate_re($ldap_port, '\d+')
-  validate_bool($ldap_log)
-  validate_hash($environment_variables)
-  validate_hash($config_variables)
-  validate_hash($config_kernel_variables)
-
   if $ssl_only and ! $ssl {
     fail('$ssl_only => true requires that $ssl => true')
   }
 
-  if $config_stomp and $ssl_stomp_port and ! $ssl {
-    warning('$ssl_stomp_port requires that $ssl => true and will be ignored')
+  if $config_stomp and $stomp_ssl_only and ! $ssl_stomp_port  {
+    fail('$stomp_ssl_only requires that $ssl_stomp_port be set')
   }
 
   if $ssl_versions {
-    if $ssl {
-      validate_array($ssl_versions)
-    } else {
+    unless $ssl {
       fail('$ssl_versions requires that $ssl => true')
     }
   }
 
-  # This needs to happen here instead of params.pp because
-  # $package_source needs to override the constructed value in params.pp
-  if $package_source { # $package_source was specified by user so use that one
-    $real_package_source = $package_source
-  # NOTE(bogdando) do not enforce the source value for yum provider #MODULES-1631
-  } elsif $package_provider != 'yum' {
-    # package_source was not specified, so construct it, unless the provider is 'yum'
-    case $::osfamily {
-      'RedHat', 'SUSE': {
-        $base_version   = regsubst($version,'^(.*)-\d$','\1')
-        $real_package_source = "http://www.rabbitmq.com/releases/rabbitmq-server/v${base_version}/rabbitmq-server-${version}.noarch.rpm"
-      }
-      default: { # Archlinux and Debian
-        $real_package_source = ''
+  if $repos_ensure {
+    case $facts['os']['family'] {
+      'RedHat': {
+        contain rabbitmq::repo::rhel
+        Class['rabbitmq::repo::rhel'] -> Class['rabbitmq::install']
       }
-    }
-  } else { # for yum provider, use the source as is
-    $real_package_source = $package_source
-  }
-
-  include '::rabbitmq::install'
-  include '::rabbitmq::config'
-  include '::rabbitmq::service'
-  include '::rabbitmq::management'
-
-  if $manage_repos != undef {
-    warning('$manage_repos is now deprecated. Please use $repos_ensure instead')
-  }
-
-  if $manage_repos != false {
-    case $::osfamily {
-      'RedHat', 'SUSE':
-        { include '::rabbitmq::repo::rhel' }
       'Debian': {
-        class { '::rabbitmq::repo::apt' :
-          key_source  => $package_gpg_key,
-          key_content => $key_content,
-        }
+        contain rabbitmq::repo::apt
+        Class['rabbitmq::repo::apt'] -> Class['rabbitmq::install']
+      }
+      default: {
       }
-      default:
-        { }
     }
   }
 
+  contain rabbitmq::install
+  contain rabbitmq::config
+  contain rabbitmq::service
+  contain rabbitmq::management
+
   if $admin_enable and $service_manage {
-    include '::rabbitmq::install::rabbitmqadmin'
+    include 'rabbitmq::install::rabbitmqadmin'
 
     rabbitmq_plugin { 'rabbitmq_management':
-      ensure  => present,
-      require => Class['rabbitmq::install'],
-      notify  => Class['rabbitmq::service'],
+      ensure   => present,
+      notify   => Class['rabbitmq::service'],
+      provider => 'rabbitmqplugins',
     }
 
-    Class['::rabbitmq::service'] -> Class['::rabbitmq::install::rabbitmqadmin']
-    Class['::rabbitmq::install::rabbitmqadmin'] -> Rabbitmq_exchange<| |>
+    Class['rabbitmq::service'] -> Class['rabbitmq::install::rabbitmqadmin']
+    Class['rabbitmq::install::rabbitmqadmin'] -> Rabbitmq_exchange<| |>
   }
 
   if $stomp_ensure {
     rabbitmq_plugin { 'rabbitmq_stomp':
-      ensure  => present,
-      require => Class['rabbitmq::install'],
-      notify  => Class['rabbitmq::service'],
+      ensure => present,
+      notify => Class['rabbitmq::service'],
     }
   }
 
   if ($ldap_auth) {
     rabbitmq_plugin { 'rabbitmq_auth_backend_ldap':
-      ensure  => present,
-      require => Class['rabbitmq::install'],
-      notify  => Class['rabbitmq::service'],
+      ensure => present,
+      notify => Class['rabbitmq::service'],
     }
   }
 
-  anchor { 'rabbitmq::begin': }
-  anchor { 'rabbitmq::end': }
+  if ($config_shovel) {
+    rabbitmq_plugin { 'rabbitmq_shovel':
+      ensure   => present,
+      notify   => Class['rabbitmq::service'],
+      provider => 'rabbitmqplugins',
+    }
+
+    if ($admin_enable) {
+      rabbitmq_plugin { 'rabbitmq_shovel_management':
+        ensure   => present,
+        notify   => Class['rabbitmq::service'],
+        provider => 'rabbitmqplugins',
+      }
+    }
+  }
 
-  Anchor['rabbitmq::begin'] -> Class['::rabbitmq::install']
-    -> Class['::rabbitmq::config'] ~> Class['::rabbitmq::service']
-    -> Class['::rabbitmq::management'] -> Anchor['rabbitmq::end']
+  Class['rabbitmq::install']
+  -> Class['rabbitmq::config']
+  ~> Class['rabbitmq::service']
+  -> Class['rabbitmq::management']
 
   # Make sure the various providers have their requirements in place.
-  Class['::rabbitmq::install'] -> Rabbitmq_plugin<| |>
+  Class['rabbitmq::install'] -> Rabbitmq_plugin<| |>
 
 }
index f2df83a..6c236e0 100644 (file)
@@ -1,23 +1,23 @@
 # Class rabbitmq::install
-# Ensures the rabbitmq-server exists
+# Ensures that rabbitmq-server exists
 class rabbitmq::install {
 
   $package_ensure   = $rabbitmq::package_ensure
   $package_name     = $rabbitmq::package_name
-  $package_provider = $rabbitmq::package_provider
-  $package_source   = $rabbitmq::real_package_source
+  $rabbitmq_group   = $rabbitmq::rabbitmq_group
 
-  package { 'rabbitmq-server':
-    ensure   => $package_ensure,
-    name     => $package_name,
-    provider => $package_provider,
-    notify   => Class['rabbitmq::service'],
+  package { $package_name:
+    ensure => $package_ensure,
+    notify => Class['rabbitmq::service'],
   }
 
-  if $package_source {
-    Package['rabbitmq-server'] {
-      source  => $package_source,
+  if $rabbitmq::environment_variables['MNESIA_BASE'] {
+    file { $rabbitmq::environment_variables['MNESIA_BASE']:
+      ensure  => 'directory',
+      owner   => 'root',
+      group   => $rabbitmq_group,
+      mode    => '0775',
+      require => Package[$package_name],
     }
   }
-
 }
index bf545ee..408d2a1 100644 (file)
@@ -1,35 +1,67 @@
 #
 class rabbitmq::install::rabbitmqadmin {
 
-  if($rabbitmq::ssl) {
-    $management_port = $rabbitmq::ssl_management_port
-  }
-  else {
-    $management_port = $rabbitmq::management_port
-  }
+  if $rabbitmq::rabbitmqadmin_package {
+    package{'rabbitmqadmin':
+      ensure => 'present',
+      name   => $rabbitmq::rabbitmqadmin_package,
+    }
+  } else {
 
-  $default_user = $rabbitmq::default_user
-  $default_pass = $rabbitmq::default_pass
-  $protocol = $rabbitmq::ssl ? { false => 'http', default => 'https' }
+    $python_package = $rabbitmq::params::python_package
+    # Some systems (e.g., Ubuntu 16.04) don't ship Python 2 by default
+    if $rabbitmq::manage_python {
+      ensure_packages([$python_package])
+      $rabbitmqadmin_require = [Archive['rabbitmqadmin'], Package[$python_package]]
+    } else {
+      $rabbitmqadmin_require = Archive['rabbitmqadmin']
+    }
 
-  staging::file { 'rabbitmqadmin':
-    target      => "${rabbitmq::rabbitmq_home}/rabbitmqadmin",
-    source      => "${protocol}://${default_user}:${default_pass}@localhost:${management_port}/cli/rabbitmqadmin",
-    curl_option => '-k --noproxy localhost --retry 30 --retry-delay 6',
-    timeout     => '180',
-    wget_option => '--no-proxy',
-    require     => [
-      Class['rabbitmq::service'],
-      Rabbitmq_plugin['rabbitmq_management']
-    ],
-  }
+    if($rabbitmq::ssl and $rabbitmq::management_ssl) {
+      $management_port = $rabbitmq::ssl_management_port
+      $protocol        = 'https'
+    } else {
+      $management_port = $rabbitmq::management_port
+      $protocol        = 'http'
+    }
 
-  file { '/usr/local/bin/rabbitmqadmin':
-    owner   => 'root',
-    group   => '0',
-    source  => "${rabbitmq::rabbitmq_home}/rabbitmqadmin",
-    mode    => '0755',
-    require => Staging::File['rabbitmqadmin'],
-  }
+    $default_user = $rabbitmq::default_user
+    $default_pass = $rabbitmq::default_pass
+    $management_ip_address = $rabbitmq::management_ip_address
+    $archive_options = $rabbitmq::archive_options
 
+    if !($management_ip_address) {
+      # Pull from localhost if we don't have an explicit bind address
+      $curl_prefix = ''
+      $sanitized_ip = '127.0.0.1'
+    } elsif is_ipv6_address($management_ip_address) {
+      $curl_prefix  = "--noproxy ${management_ip_address} -g -6"
+      $sanitized_ip = join(enclose_ipv6(any2array($management_ip_address)), ',')
+    } else {
+      $curl_prefix  = "--noproxy ${management_ip_address}"
+      $sanitized_ip = $management_ip_address
+    }
+
+    archive { 'rabbitmqadmin':
+      path             => "${rabbitmq::rabbitmq_home}/rabbitmqadmin",
+      source           => "${protocol}://${sanitized_ip}:${management_port}/cli/rabbitmqadmin",
+      username         => $default_user,
+      password         => $default_pass,
+      allow_insecure   => true,
+      download_options => $archive_options,
+      cleanup          => false,
+      require          => [
+        Class['rabbitmq::service'],
+        Rabbitmq_plugin['rabbitmq_management']
+      ],
+    }
+
+    file { '/usr/local/bin/rabbitmqadmin':
+      owner   => 'root',
+      group   => '0',
+      source  => "${rabbitmq::rabbitmq_home}/rabbitmqadmin",
+      mode    => '0755',
+      require => $rabbitmqadmin_require,
+    }
+  }
 }
index 7366d95..efd9ea9 100644 (file)
-  # Class: rabbitmq::params
+# rabbitmq::params
 #
-#   The RabbitMQ Module configuration settings.
+# @summary OS Specific parameters and other settings
 #
 class rabbitmq::params {
 
-  case $::osfamily {
+  case $facts['os']['family'] {
     'Archlinux': {
-      $package_ensure   = 'installed'
-      $package_name     = 'rabbitmq'
-      $service_name     = 'rabbitmq'
-      $version          = '3.1.3-1'
-      $rabbitmq_user    = 'rabbitmq'
-      $rabbitmq_group   = 'rabbitmq'
-      $rabbitmq_home    = '/var/lib/rabbitmq'
-      $plugin_dir       = "/usr/lib/rabbitmq/lib/rabbitmq_server-${version}/plugins"
+      $manage_python         = true
+      $python_package        = 'python2'
+      $package_ensure        = 'installed'
+      $package_name          = 'rabbitmq'
+      $service_name          = 'rabbitmq'
+      $rabbitmq_user         = 'rabbitmq'
+      $rabbitmq_group        = 'rabbitmq'
+      $rabbitmq_home         = '/var/lib/rabbitmq'
+      $package_gpg_key       = undef
+      $rabbitmqadmin_package = 'rabbitmqadmin'
     }
     'Debian': {
-      $package_ensure   = 'installed'
-      $package_name     = 'rabbitmq-server'
-      $service_name     = 'rabbitmq-server'
-      $package_provider = 'apt'
-      $version          = '3.1.5'
-      $rabbitmq_user    = 'rabbitmq'
-      $rabbitmq_group   = 'rabbitmq'
-      $rabbitmq_home    = '/var/lib/rabbitmq'
-      $plugin_dir       = "/usr/lib/rabbitmq/lib/rabbitmq_server-${version}/plugins"
+      $manage_python         = true
+      $python_package        = 'python'
+      $package_ensure        = 'installed'
+      $package_name          = 'rabbitmq-server'
+      $service_name          = 'rabbitmq-server'
+      $rabbitmq_user         = 'rabbitmq'
+      $rabbitmq_group        = 'rabbitmq'
+      $rabbitmq_home         = '/var/lib/rabbitmq'
+      $package_gpg_key       = 'https://packagecloud.io/gpg.key'
+      $rabbitmqadmin_package = undef
     }
     'OpenBSD': {
-      $package_ensure   = 'installed'
-      $package_name     = 'rabbitmq'
-      $service_name     = 'rabbitmq'
-      $version          = '3.4.2'
-      $rabbitmq_user    = '_rabbitmq'
-      $rabbitmq_group   = '_rabbitmq'
-      $rabbitmq_home    = '/var/rabbitmq'
-      $plugin_dir       = '/usr/local/lib/rabbitmq/plugins'
+      $manage_python         = true
+      $python_package        = 'python2'
+      $package_ensure        = 'installed'
+      $package_name          = 'rabbitmq'
+      $service_name          = 'rabbitmq'
+      $rabbitmq_user         = '_rabbitmq'
+      $rabbitmq_group        = '_rabbitmq'
+      $rabbitmq_home         = '/var/rabbitmq'
+      $package_gpg_key       = undef
+      $rabbitmqadmin_package = undef
+    }
+    'FreeBSD': {
+      $manage_python         = true
+      $python_package        = 'python2'
+      $package_ensure        = 'installed'
+      $package_name          = 'rabbitmq'
+      $service_name          = 'rabbitmq'
+      $rabbitmq_user         = 'rabbitmq'
+      $rabbitmq_group        = 'rabbitmq'
+      $rabbitmq_home         = '/var/db/rabbitmq'
+      $package_gpg_key       = undef
+      $rabbitmqadmin_package = undef
     }
     'RedHat': {
-      $package_ensure   = 'installed'
-      $package_name     = 'rabbitmq-server'
-      $service_name     = 'rabbitmq-server'
-      $package_provider = 'rpm'
-      $version          = '3.1.5-1'
-      $rabbitmq_user    = 'rabbitmq'
-      $rabbitmq_group   = 'rabbitmq'
-      $rabbitmq_home    = '/var/lib/rabbitmq'
-      $plugin_dir       = "/usr/lib/rabbitmq/lib/rabbitmq_server-${version}/plugins"
+      $manage_python         = true
+      $python_package        = 'python'
+      $package_ensure        = 'installed'
+      $package_name          = 'rabbitmq-server'
+      $service_name          = 'rabbitmq-server'
+      $rabbitmq_user         = 'rabbitmq'
+      $rabbitmq_group        = 'rabbitmq'
+      $rabbitmq_home         = '/var/lib/rabbitmq'
+      $package_gpg_key       = 'https://www.rabbitmq.com/rabbitmq-release-signing-key.asc'
+      $rabbitmqadmin_package = undef
     }
     'SUSE': {
-      $package_ensure   = 'installed'
-      $package_name     = 'rabbitmq-server'
-      $service_name     = 'rabbitmq-server'
-      $package_provider = 'zypper'
-      $version          = '3.1.5-1'
-      $rabbitmq_user    = 'rabbitmq'
-      $rabbitmq_group   = 'rabbitmq'
-      $rabbitmq_home    = '/var/lib/rabbitmq'
-      $plugin_dir       = "/usr/lib/rabbitmq/lib/rabbitmq_server-${version}/plugins"
+      $manage_python         = true
+      $python_package        = 'python'
+      $package_ensure        = 'installed'
+      $package_name          = ['rabbitmq-server', 'rabbitmq-server-plugins']
+      $service_name          = 'rabbitmq-server'
+      $rabbitmq_user         = 'rabbitmq'
+      $rabbitmq_group        = 'rabbitmq'
+      $rabbitmq_home         = '/var/lib/rabbitmq'
+      $package_gpg_key       = undef
+      $rabbitmqadmin_package = undef
     }
     default: {
-      fail("The ${module_name} module is not supported on an ${::osfamily} based system.")
+      fail("The ${module_name} module is not supported on an ${facts['os']['family']} based system.")
     }
   }
 
   #install
-  $admin_enable               = true
-  $management_port            = '15672'
-  $package_apt_pin            = ''
-  $package_gpg_key            = 'http://www.rabbitmq.com/rabbitmq-signing-key-public.asc'
-  $repos_ensure               = true
-  $manage_repos               = undef
-  $service_ensure             = 'running'
-  $service_manage             = true
+  $admin_enable                        = true
+  $management_port                     = 15672
+  $management_ssl                      = true
+  $repos_ensure                        = false
+  $service_ensure                      = 'running'
+  $service_manage                      = true
   #config
-  $cluster_node_type          = 'disc'
-  $cluster_nodes              = []
-  $config                     = 'rabbitmq/rabbitmq.config.erb'
-  $config_cluster             = false
-  $config_path                = '/etc/rabbitmq/rabbitmq.config'
-  $config_stomp               = false
-  $default_user               = 'guest'
-  $default_pass               = 'guest'
-  $delete_guest_user          = false
-  $env_config                 = 'rabbitmq/rabbitmq-env.conf.erb'
-  $env_config_path            = '/etc/rabbitmq/rabbitmq-env.conf'
-  $erlang_cookie              = undef
-  $interface                  = 'UNSET'
-  $node_ip_address            = 'UNSET'
-  $port                       = '5672'
-  $tcp_keepalive              = false
-  $ssl                        = false
-  $ssl_only                   = false
-  $ssl_cacert                 = 'UNSET'
-  $ssl_cert                   = 'UNSET'
-  $ssl_key                    = 'UNSET'
-  $ssl_port                   = '5671'
-  $ssl_interface              = 'UNSET'
-  $ssl_management_port        = '15671'
-  $ssl_stomp_port             = '6164'
-  $ssl_verify                 = 'verify_none'
-  $ssl_fail_if_no_peer_cert   = false
-  $ssl_versions               = undef
-  $ssl_ciphers                = []
-  $stomp_ensure               = false
-  $ldap_auth                  = false
-  $ldap_server                = 'ldap'
-  $ldap_user_dn_pattern       = 'cn=username,ou=People,dc=example,dc=com'
-  $ldap_other_bind            = 'anon'
-  $ldap_use_ssl               = false
-  $ldap_port                  = '389'
-  $ldap_log                   = false
-  $ldap_config_variables      = {}
-  $stomp_port                 = '6163'
-  $wipe_db_on_cookie_change   = false
-  $cluster_partition_handling = 'ignore'
-  $environment_variables      = {}
-  $config_variables           = {}
-  $config_kernel_variables    = {}
-  $file_limit                 = 16384
+  $cluster_node_type                   = 'disc'
+  $cluster_nodes                       = []
+  $config                              = 'rabbitmq/rabbitmq.config.erb'
+  $config_cluster                      = false
+  $config_path                         = '/etc/rabbitmq/rabbitmq.config'
+  $config_ranch                        = true
+  $config_stomp                        = false
+  $config_shovel                       = false
+  $config_shovel_statics               = {}
+  $default_user                        = 'guest'
+  $default_pass                        = 'guest'
+  $delete_guest_user                   = false
+  $env_config                          = 'rabbitmq/rabbitmq-env.conf.erb'
+  $env_config_path                     = '/etc/rabbitmq/rabbitmq-env.conf'
+  $port                                = 5672
+  $tcp_keepalive                       = false
+  $tcp_backlog                         = 128
+  $ssl                                 = false
+  $ssl_ciphers                         = []
+  $ssl_erl_dist                        = false
+  $ssl_fail_if_no_peer_cert            = false
+  $ssl_honor_cipher_order              = true
+  $ssl_management_port                 = 15671
+  $ssl_only                            = false
+  $ssl_port                            = 5671
+  $ssl_reuse_sessions                  = true
+  $ssl_secure_renegotiate              = true
+  $ssl_stomp_port                      = 6164
+  $ssl_verify                          = 'verify_none'
+  $ssl_versions                        = undef
+  $ssl_management_verify               = 'verify_none'
+  $ssl_management_fail_if_no_peer_cert = false
+  $stomp_ensure                        = false
+  $stomp_port                          = 6163
+  $stomp_ssl_only                      = false
+  $ldap_auth                           = false
+  $ldap_server                         = 'ldap'
+  $ldap_user_dn_pattern                = undef
+  $ldap_other_bind                     = 'anon'
+  $ldap_use_ssl                        = false
+  $ldap_port                           = 389
+  $ldap_log                            = false
+  $ldap_config_variables               = {}
+  $wipe_db_on_cookie_change            = false
+  $cluster_partition_handling          = 'ignore'
+  $environment_variables               = {}
+  $config_variables                    = {}
+  $config_kernel_variables             = {}
+  $config_management_variables         = {}
+  $config_additional_variables         = {}
+  $file_limit                          = 16384
+  $ipv6                                = false
+  $inetrc_config                       = 'rabbitmq/inetrc.erb'
+  $inetrc_config_path                  = '/etc/rabbitmq/inetrc'
+  $archive_options                     = []
 }
index 0902e2c..651e4e3 100644 (file)
@@ -2,40 +2,40 @@
 #   puppetlabs-apt
 #   puppetlabs-stdlib
 class rabbitmq::repo::apt(
-  $location    = 'http://www.rabbitmq.com/debian/',
-  $release     = 'testing',
-  $repos       = 'main',
-  $include_src = false,
-  $key         = 'F78372A06FF50C80464FC1B4F7B8CEA6056E8E56',
-  $key_source  = 'http://www.rabbitmq.com/rabbitmq-signing-key-public.asc',
-  $key_content = undef,
+  String $location               = 'https://packagecloud.io/rabbitmq/rabbitmq-server',
+  String $repos                  = 'main',
+  Boolean $include_src           = false,
+  String $key                    = '418A7F2FB0E1E6E7EABF6FE8C2E73424D59097AB',
+  String $key_source             = $rabbitmq::package_gpg_key,
+  Optional[String] $key_content  = $rabbitmq::key_content,
+  Optional[String] $architecture = undef,
   ) {
 
   $pin = $rabbitmq::package_apt_pin
 
-  Class['rabbitmq::repo::apt'] -> Package<| title == 'rabbitmq-server' |>
-
-  $ensure_source = $rabbitmq::repos_ensure ? {
-    false   => 'absent',
-    default => 'present',
-  }
+  # ordering / ensure to get the last version of repository
+  Class['rabbitmq::repo::apt']
+  -> Class['apt::update']
 
+  $osname = downcase($facts['os']['name'])
   apt::source { 'rabbitmq':
-    ensure      => $ensure_source,
-    location    => $location,
-    release     => $release,
-    repos       => $repos,
-    include_src => $include_src,
-    key         => $key,
-    key_source  => $key_source,
-    key_content => $key_content,
+    ensure       => present,
+    location     => "${location}/${osname}",
+    repos        => $repos,
+    include      => { 'src' => $include_src },
+    key          => {
+      'id'      => $key,
+      'source'  => $key_source,
+      'content' =>  $key_content,
+    },
+    architecture => $architecture,
   }
 
-  if $pin != '' {
-    validate_re($pin, '\d\d\d')
+  if $pin {
     apt::pin { 'rabbitmq':
-      packages => 'rabbitmq-server',
+      packages => '*',
       priority => $pin,
+      origin   => 'packagecloud.io',
     }
   }
 }
index 2849099..093f607 100644 (file)
@@ -1,16 +1,23 @@
 # Class: rabbitmq::repo::rhel
-# Imports the gpg key if it doesn't already exist.
-class rabbitmq::repo::rhel {
+# Makes sure that the Packagecloud repo is installed
+class rabbitmq::repo::rhel(
+    $location          = "https://packagecloud.io/rabbitmq/rabbitmq-server/el/${facts['os'][release][major]}/\$basearch",
+    String $key_source = $rabbitmq::package_gpg_key,
+  ) {
 
-  if $rabbitmq::repos_ensure {
-
-    $package_gpg_key = $rabbitmq::package_gpg_key
-
-    Class['rabbitmq::repo::rhel'] -> Package<| title == 'rabbitmq-server' |>
+  yumrepo { 'rabbitmq':
+    ensure   => present,
+    name     => 'rabbitmq_rabbitmq-server',
+    baseurl  => $location,
+    gpgkey   => $key_source,
+    enabled  => 1,
+    gpgcheck => 1,
+  }
 
-    exec { "rpm --import ${package_gpg_key}":
-      path   => ['/bin','/usr/bin','/sbin','/usr/sbin'],
-      unless => 'rpm -q gpg-pubkey-056e8e56-468e43f2 2>/dev/null',
-    }
+  # This may still be needed to prevent warnings
+  # packagecloud key is gpg-pubkey-d59097ab-52d46e88
+  exec { "rpm --import ${key_source}":
+    path   => ['/bin','/usr/bin','/sbin','/usr/sbin'],
+    unless => 'rpm -q gpg-pubkey-6026dfca-573adfde 2>/dev/null',
   }
 }
index 05de184..e7f1708 100644 (file)
@@ -5,7 +5,7 @@
 # Parameters:
 #  [*port*] - port where rabbitmq server is hosted
 #  [*delete_guest_user*] - rather or not to delete the default user
-#  [*version*] - version of rabbitmq-server to install
+#  [*version*] - deprecated -- does nothing
 #  [*package_name*] - name of rabbitmq package
 #  [*service_name*] - name of rabbitmq service
 #  [*service_ensure*] - desired ensure state for service
@@ -36,7 +36,6 @@ class rabbitmq::server(
   $port                     = $rabbitmq::params::port,
   $delete_guest_user        = $rabbitmq::params::delete_guest_user,
   $package_name             = $rabbitmq::params::package_name,
-  $version                  = $rabbitmq::params::version,
   $service_name             = $rabbitmq::params::service_name,
   $service_ensure           = $rabbitmq::params::service_ensure,
   $service_manage           = $rabbitmq::params::service_manage,
@@ -52,19 +51,10 @@ class rabbitmq::server(
   $wipe_db_on_cookie_change = $rabbitmq::params::wipe_db_on_cookie_change,
 ) inherits rabbitmq::params {
 
-  anchor {'before::rabbimq::class':
-    before => Class['rabbitmq'],
-  }
-
-  anchor {'after::rabbimq::class':
-    require => Class['rabbitmq'],
-  }
-
   class { 'rabbitmq':
     port                     => $port,
     delete_guest_user        => $delete_guest_user,
     package_name             => $package_name,
-    version                  => $version,
     service_name             => $service_name,
     service_ensure           => $service_ensure,
     service_manage           => $service_manage,
@@ -79,4 +69,5 @@ class rabbitmq::server(
     erlang_cookie            => $erlang_cookie,
     wipe_db_on_cookie_change => $wipe_db_on_cookie_change,
   }
+  contain rabbitmq
 }
index c01aa64..dc80701 100644 (file)
 # Sample Usage:
 #
 class rabbitmq::service(
-  $service_ensure = $rabbitmq::service_ensure,
-  $service_manage = $rabbitmq::service_manage,
-  $service_name   = $rabbitmq::service_name,
+  Enum['running', 'stopped'] $service_ensure  = $rabbitmq::service_ensure,
+  Boolean $service_manage                     = $rabbitmq::service_manage,
+  $service_name                               = $rabbitmq::service_name,
 ) inherits rabbitmq {
 
-  validate_re($service_ensure, '^(running|stopped)$')
-  validate_bool($service_manage)
-
   if ($service_manage) {
     if $service_ensure == 'running' {
       $ensure_real = 'running'
index 945a26f..37b9b21 100644 (file)
@@ -1,55 +1,78 @@
 {
-  "name": "puppetlabs-rabbitmq",
-  "version": "5.2.1",
-  "author": "puppetlabs",
+  "name": "puppet-rabbitmq",
+  "version": "8.2.0",
+  "author": "voxpupuli",
   "summary": "Installs, configures, and manages RabbitMQ.",
   "license": "Apache-2.0",
-  "source": "https://github.com/puppetlabs/puppetlabs-rabbitmq",
-  "project_page": "https://github.com/puppetlabs/puppetlabs-rabbitmq",
-  "issues_url": "https://tickets.puppetlabs.com/browse/MODULES",
+  "source": "https://github.com/voxpupuli/puppet-rabbitmq",
+  "project_page": "https://github.com/voxpupuli/puppet-rabbitmq",
+  "issues_url": "https://github.com/voxpupuli/puppet-rabbitmq/issues",
+  "dependencies": [
+    {
+      "name": "puppetlabs/stdlib",
+      "version_requirement": ">= 4.13.1 < 5.0.0"
+    },
+    {
+      "name": "puppet/archive",
+      "version_requirement": ">= 1.0.0 < 3.0.0"
+    }
+  ],
+  "data_provider": null,
   "operatingsystem_support": [
     {
       "operatingsystem": "RedHat",
       "operatingsystemrelease": [
-        "5",
-        "6"
+        "6",
+        "7"
       ]
     },
     {
       "operatingsystem": "CentOS",
       "operatingsystemrelease": [
-        "5",
-        "6"
+        "6",
+        "7"
       ]
     },
     {
       "operatingsystem": "Debian",
       "operatingsystemrelease": [
-        "6",
-        "7"
+        "8"
       ]
     },
     {
       "operatingsystem": "Ubuntu",
       "operatingsystemrelease": [
-        "12.04",
-        "14.04"
+        "14.04",
+        "16.04"
       ]
+    },
+    {
+      "operatingsystem": "SLES",
+      "operatingsystemrelease": [
+        "11"
+      ]
+    },
+    {
+      "operatingsystem": "FreeBSD"
+    },
+    {
+      "operatingsystem": "OpenBSD"
+    },
+    {
+      "operatingsystem": "Archlinux"
     }
   ],
   "requirements": [
-    {
-      "name": "pe",
-      "version_requirement": "3.x"
-    },
     {
       "name": "puppet",
-      "version_requirement": "3.x"
+      "version_requirement": ">= 4.7.1 < 6.0.0"
     }
   ],
-  "dependencies": [
-    {"name":"puppetlabs/stdlib","version_requirement":">=3.0.0 <5.0.0"},
-    {"name":"puppetlabs/apt","version_requirement":">=1.8.0 <2.0.0"},
-    {"name":"nanliu/staging","version_requirement":">=0.3.1 <2.0.0"}
+  "tags": [
+    "rabbitmq",
+    "ampq",
+    "messaging",
+    "stomp",
+    "queue"
   ]
 }
index b5b50cd..bfb70e0 100644 (file)
@@ -1,7 +1,7 @@
 require 'spec_helper_acceptance'
 
 describe 'rabbitmq class:' do
-  case fact('osfamily')
+  case fact('os.family')
   when 'RedHat'
     package_name = 'rabbitmq-server'
     service_name = 'rabbitmq-server'
@@ -16,80 +16,199 @@ describe 'rabbitmq class:' do
     service_name = 'rabbitmq'
   end
 
-  context "default class inclusion" do
-    it 'should run successfully' do
-      pp = <<-EOS
+  context 'default class inclusion' do
+    let(:pp) do
+      <<-EOS
       class { 'rabbitmq': }
-      if $::osfamily == 'RedHat' {
+      if $facts['os']['family'] == 'RedHat' {
         class { 'erlang': epel_enable => true}
         Class['erlang'] -> Class['rabbitmq']
       }
       EOS
-
-      # Apply twice to ensure no errors the second time.
-      apply_manifest(pp, :catch_failures => true)
-      expect(apply_manifest(pp, :catch_changes => true).exit_code).to be_zero
     end
 
+    it_behaves_like 'an idempotent resource'
+
     describe package(package_name) do
-      it { should be_installed }      
+      it { is_expected.to be_installed }
     end
 
     describe service(service_name) do
-      it { should be_enabled }
-      it { should be_running }
+      it { is_expected.to be_enabled }
+      it { is_expected.to be_running }
     end
   end
 
-  context "disable and stop service" do
-    it 'should run successfully' do
-      pp = <<-EOS
-      class { 'rabbitmq':
-        service_ensure => 'stopped',
-      }
-      if $::osfamily == 'RedHat' {
-        class { 'erlang': epel_enable => true}
-        Class['erlang'] -> Class['rabbitmq']
-      }
+  context 'disable and stop service' do
+    let(:pp) do
+      <<-EOS
+        class { 'rabbitmq':
+          service_ensure => 'stopped',
+        }
+        if $facts['os']['family'] == 'RedHat' {
+          class { 'erlang': epel_enable => true}
+          Class['erlang'] -> Class['rabbitmq']
+        }
       EOS
-
-      apply_manifest(pp, :catch_failures => true)
     end
 
+    it_behaves_like 'an idempotent resource'
+
     describe service(service_name) do
-      it { should_not be_enabled }
-      it { should_not be_running }
+      it { is_expected.not_to be_enabled }
+      it { is_expected.not_to be_running }
     end
   end
 
-  context "service is unmanaged" do
-    it 'should run successfully' do
+  context 'service is unmanaged' do
+    it 'runs successfully' do
       pp_pre = <<-EOS
-      class { 'rabbitmq': }
-      if $::osfamily == 'RedHat' {
-        class { 'erlang': epel_enable => true}
-        Class['erlang'] -> Class['rabbitmq']
-      }
+        class { 'rabbitmq': }
+        if $facts['os']['family'] == 'RedHat' {
+          class { 'erlang': epel_enable => true}
+          Class['erlang'] -> Class['rabbitmq']
+        }
       EOS
 
       pp = <<-EOS
+        class { 'rabbitmq':
+          service_manage => false,
+          service_ensure  => 'stopped',
+        }
+        if $facts['os']['family'] == 'RedHat' {
+          class { 'erlang': epel_enable => true}
+          Class['erlang'] -> Class['rabbitmq']
+        }
+      EOS
+
+      apply_manifest(pp_pre, catch_failures: true)
+      apply_manifest(pp, catch_failures: true)
+    end
+
+    describe service(service_name) do
+      it { is_expected.to be_enabled }
+      it { is_expected.to be_running }
+    end
+  end
+
+  context 'binding on all interfaces' do
+    let(:pp) do
+      <<-EOS
       class { 'rabbitmq':
-        service_manage => false,
-        service_ensure  => 'stopped',
-      }
-      if $::osfamily == 'RedHat' {
-        class { 'erlang': epel_enable => true}
-        Class['erlang'] -> Class['rabbitmq']
+        service_manage    => true,
+        port              => 5672,
+        admin_enable      => true,
+        node_ip_address   => '0.0.0.0'
       }
       EOS
+    end
+
+    it_behaves_like 'an idempotent resource'
 
-      apply_manifest(pp_pre, :catch_failures => true)
-      apply_manifest(pp, :catch_failures => true)
+    describe service(service_name) do
+      it { is_expected.to be_running }
+    end
+    describe port(5672) do
+      it { is_expected.to be_listening.on('0.0.0.0').with('tcp') }
+    end
+    describe port(15_672) do
+      it { is_expected.to be_listening.on('0.0.0.0').with('tcp') }
     end
+    describe port(25_672) do
+      xit 'Is on 55672 instead on older rmq versions' do
+        is_expected.to be_listening.on('0.0.0.0').with('tcp')
+      end
+    end
+  end
+
+  context 'binding to localhost only' do
+    let(:pp) do
+      <<-EOS
+        class { 'rabbitmq':
+          service_manage    => true,
+          port              => 5672,
+          admin_enable      => true,
+          node_ip_address   => '127.0.0.1'
+        }
+      EOS
+    end
+
+    it_behaves_like 'an idempotent resource'
+
+    describe service(service_name) do
+      it { is_expected.to be_running }
+    end
+    describe port(5672) do
+      it { is_expected.to be_listening.on('127.0.0.1').with('tcp') }
+    end
+    describe port(15_672) do
+      it { is_expected.to be_listening.on('127.0.0.1').with('tcp') }
+    end
+    # This listens on all interfaces regardless of these settings
+    describe port(25_672) do
+      xit 'Is on 55672 instead on older rmq versions' do
+        is_expected.to be_listening.on('0.0.0.0').with('tcp')
+      end
+    end
+  end
+
+  context 'ssl enabled' do
+    let(:pp) do
+      <<-EOS
+        class { 'rabbitmq':
+          service_manage  => true,
+          admin_enable    => true,
+          node_ip_address => '0.0.0.0',
+          ssl_interface   => '0.0.0.0',
+          ssl             => true,
+          ssl_cacert      => '/tmp/cacert.crt',
+          ssl_cert        => '/tmp/rabbitmq.crt',
+          ssl_key         => '/tmp/rabbitmq.key',
+        }
+      EOS
+    end
+
+    it_behaves_like 'an idempotent resource'
 
     describe service(service_name) do
-      it { should be_enabled }
-      it { should be_running }
+      it { is_expected.to be_running }
+    end
+    describe port(5671) do
+      it { is_expected.to be_listening.on('0.0.0.0').with('tcp') }
+    end
+    describe port(15_671) do
+      it { is_expected.to be_listening.on('0.0.0.0').with('tcp') }
+    end
+  end
+
+  context 'different management_ip_address and node_ip_address' do
+    let(:pp) do
+      <<-EOS
+        class { 'rabbitmq':
+          service_manage        => true,
+          port                  => 5672,
+          admin_enable          => true,
+          node_ip_address       => '0.0.0.0',
+          management_ip_address => '127.0.0.1'
+        }
+      EOS
+    end
+
+    it_behaves_like 'an idempotent resource'
+
+    describe service(service_name) do
+      it { is_expected.to be_running }
+    end
+    describe port(5672) do
+      it { is_expected.to be_listening.on('0.0.0.0').with('tcp') }
+    end
+    describe port(15_672) do
+      it { is_expected.to be_listening.on('127.0.0.1').with('tcp') }
+    end
+    describe port(25_672) do
+      xit 'Is on 55672 instead on older rmq versions' do
+        is_expected.to be_listening.on('0.0.0.0').with('tcp')
+      end
     end
   end
 end
index 438c65b..204eef0 100644 (file)
@@ -2,59 +2,58 @@ require 'spec_helper_acceptance'
 
 describe 'rabbitmq clustering' do
   context 'rabbitmq::wipe_db_on_cookie_change => false' do
-    it 'should run successfully' do
+    it 'runs successfully' do
       pp = <<-EOS
-      class { 'rabbitmq': 
+      class { 'rabbitmq':
         config_cluster           => true,
         cluster_nodes            => ['rabbit1', 'rabbit2'],
         cluster_node_type        => 'ram',
         erlang_cookie            => 'TESTCOOKIE',
         wipe_db_on_cookie_change => false,
       }
-      if $::osfamily == 'RedHat' {
+      if $facts['os']['family'] == 'RedHat' {
         class { 'erlang': epel_enable => true}
         Class['erlang'] -> Class['rabbitmq']
       }
       EOS
 
-      apply_manifest(pp, :expect_failures => true)
+      apply_manifest(pp, expect_failures: true)
     end
 
     describe file('/var/lib/rabbitmq/.erlang.cookie') do
-      it { should_not contain 'TESTCOOKIE' }
+      it { is_expected.not_to contain 'TESTCOOKIE' }
     end
-
   end
   context 'rabbitmq::wipe_db_on_cookie_change => true' do
-    it 'should run successfully' do
+    it 'runs successfully' do
       pp = <<-EOS
-      class { 'rabbitmq': 
+      class { 'rabbitmq':
         config_cluster           => true,
         cluster_nodes            => ['rabbit1', 'rabbit2'],
         cluster_node_type        => 'ram',
         erlang_cookie            => 'TESTCOOKIE',
         wipe_db_on_cookie_change => true,
       }
-      if $::osfamily == 'RedHat' {
+      if $facts['os']['family'] == 'RedHat' {
         class { 'erlang': epel_enable => true}
         Class['erlang'] -> Class['rabbitmq']
       }
       EOS
 
-      apply_manifest(pp, :catch_failures => true)
+      apply_manifest(pp, catch_failures: true)
     end
 
     describe file('/etc/rabbitmq/rabbitmq.config') do
-      it { should be_file }
-      it { should contain 'cluster_nodes' }
-      it { should contain 'rabbit@rabbit1' }
-      it { should contain 'rabbit@rabbit2' }
-      it { should contain 'ram' }
+      it { is_expected.to be_file }
+      it { is_expected.to contain 'cluster_nodes' }
+      it { is_expected.to contain 'rabbit@rabbit1' }
+      it { is_expected.to contain 'rabbit@rabbit2' }
+      it { is_expected.to contain 'ram' }
     end
 
     describe file('/var/lib/rabbitmq/.erlang.cookie') do
-      it { should be_file }
-      it { should contain 'TESTCOOKIE' }
+      it { is_expected.to be_file }
+      it { is_expected.to contain 'TESTCOOKIE' }
     end
   end
 end
index d480e88..f8a6bc0 100644 (file)
@@ -2,25 +2,25 @@ require 'spec_helper_acceptance'
 
 describe 'rabbitmq with delete_guest_user' do
   context 'delete_guest_user' do
-    it 'should run successfully' do
+    it 'runs successfully' do
       pp = <<-EOS
-      class { 'rabbitmq': 
-        port              => '5672',
+      class { 'rabbitmq':
+        port              => 5672,
         delete_guest_user => true,
       }
-      if $::osfamily == 'RedHat' {
+      if $facts['os']['family'] == 'RedHat' {
         class { 'erlang': epel_enable => true}
         Class['erlang'] -> Class['rabbitmq']
       }
       EOS
 
-      apply_manifest(pp, :catch_failures => true)
+      apply_manifest(pp, catch_failures: true)
       shell('rabbitmqctl list_users > /tmp/rabbitmqctl_users')
     end
 
     describe file('/tmp/rabbitmqctl_users') do
-      it { should be_file }
-      it { should_not contain 'guest' }
+      it { is_expected.to be_file }
+      it { is_expected.not_to contain 'guest' }
     end
   end
 end
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/archlinux-2-x64.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/archlinux-2-x64.yml
new file mode 100644 (file)
index 0000000..89b6300
--- /dev/null
@@ -0,0 +1,13 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+  archlinux-2-x64:
+    roles:
+      - master
+    platform: archlinux-2-x64
+    box: archlinux/archlinux
+    hypervisor: vagrant
+CONFIG:
+  type: foss
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/centos-511-x64.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/centos-511-x64.yml
new file mode 100644 (file)
index 0000000..089d646
--- /dev/null
@@ -0,0 +1,15 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+  centos-511-x64:
+    roles:
+      - master
+    platform: el-5-x86_64
+    box: puppetlabs/centos-5.11-64-nocm
+    hypervisor: vagrant
+CONFIG:
+  type: foss
+...
+# vim: syntax=yaml
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/centos-59-x64.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/centos-59-x64.yml
deleted file mode 100644 (file)
index 2ad90b8..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-HOSTS:
-  centos-59-x64:
-    roles:
-      - master
-    platform: el-5-x86_64
-    box : centos-59-x64-vbox4210-nocm
-    box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-59-x64-vbox4210-nocm.box
-    hypervisor : vagrant
-CONFIG:
-  type: git
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/centos-6-x64-vcloud.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/centos-6-x64-vcloud.yml
deleted file mode 100644 (file)
index 9c5a3d0..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-HOSTS:
-  'centos-6-vcloud':
-    roles:
-      - master
-    platform: el-6-x86_64
-    hypervisor: vcloud
-    template: centos-6-x86_64
-CONFIG:
-  type: foss
-  ssh:
-    keys: "~/.ssh/id_rsa-acceptance"
-  datastore: instance0
-  folder: Delivery/Quality Assurance/Enterprise/Dynamic
-  resourcepool: delivery/Quality Assurance/Enterprise/Dynamic
-  pooling_api: http://vcloud.delivery.puppetlabs.net/
-
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/centos-6-x64.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/centos-6-x64.yml
new file mode 100644 (file)
index 0000000..16abc8f
--- /dev/null
@@ -0,0 +1,15 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+  centos-6-x64:
+    roles:
+      - master
+    platform: el-6-x86_64
+    box: centos/6
+    hypervisor: vagrant
+CONFIG:
+  type: aio
+...
+# vim: syntax=yaml
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/centos-64-x64-pe.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/centos-64-x64-pe.yml
deleted file mode 100644 (file)
index 7d9242f..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-HOSTS:
-  centos-64-x64:
-    roles:
-      - master
-      - database
-      - dashboard
-    platform: el-6-x86_64
-    box : centos-64-x64-vbox4210-nocm
-    box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box
-    hypervisor : vagrant
-CONFIG:
-  type: pe
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/centos-65-x64.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/centos-65-x64.yml
deleted file mode 100644 (file)
index 4e2cb80..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-HOSTS:
-  centos-65-x64:
-    roles:
-      - master
-    platform: el-6-x86_64
-    box : centos-65-x64-vbox436-nocm
-    box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box
-    hypervisor : vagrant
-CONFIG:
-  type: foss
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/centos-66-x64-pe.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/centos-66-x64-pe.yml
new file mode 100644 (file)
index 0000000..1e7aea6
--- /dev/null
@@ -0,0 +1,17 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+  centos-66-x64:
+    roles:
+      - master
+      - database
+      - dashboard
+    platform: el-6-x86_64
+    box: puppetlabs/centos-6.6-64-puppet-enterprise
+    hypervisor: vagrant
+CONFIG:
+  type: pe
+...
+# vim: syntax=yaml
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/centos-7-x64.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/centos-7-x64.yml
new file mode 100644 (file)
index 0000000..e05a3ae
--- /dev/null
@@ -0,0 +1,15 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+  centos-7-x64:
+    roles:
+      - master
+    platform: el-7-x86_64
+    box: centos/7
+    hypervisor: vagrant
+CONFIG:
+  type: aio
+...
+# vim: syntax=yaml
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/debian-7-x64-vcloud.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/debian-7-x64-vcloud.yml
deleted file mode 100644 (file)
index 6082c18..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-HOSTS:
-  'debian-7-vcloud':
-    roles:
-      - master
-    platform: debian-7-x86_64
-    hypervisor: vcloud
-    template: debian-7-x86_64
-CONFIG:
-  type: foss
-  ssh:
-    keys: "~/.ssh/id_rsa-acceptance"
-  datastore: instance0
-  folder: Delivery/Quality Assurance/Enterprise/Dynamic
-  resourcepool: delivery/Quality Assurance/Enterprise/Dynamic
-  pooling_api: http://vcloud.delivery.puppetlabs.net/
-
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/debian-78-x64.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/debian-78-x64.yml
new file mode 100644 (file)
index 0000000..6ef6de8
--- /dev/null
@@ -0,0 +1,15 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+  debian-78-x64:
+    roles:
+      - master
+    platform: debian-7-amd64
+    box: puppetlabs/debian-7.8-64-nocm
+    hypervisor: vagrant
+CONFIG:
+  type: foss
+...
+# vim: syntax=yaml
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/debian-8-x64.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/debian-8-x64.yml
new file mode 100644 (file)
index 0000000..fef6e63
--- /dev/null
@@ -0,0 +1,10 @@
+HOSTS:
+  debian-8-x64:
+    roles:
+      - agent
+      - default
+    platform: debian-8-amd64
+    hypervisor: vagrant
+    box: puppetlabs/debian-8.2-64-nocm
+CONFIG:
+  type: foss
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/debian-82-x64.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/debian-82-x64.yml
new file mode 100644 (file)
index 0000000..9897a8f
--- /dev/null
@@ -0,0 +1,15 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+  debian-82-x64:
+    roles:
+      - master
+    platform: debian-8-amd64
+    box: puppetlabs/debian-8.2-64-nocm
+    hypervisor: vagrant
+CONFIG:
+  type: foss
+...
+# vim: syntax=yaml
index ce47212..dba339c 100644 (file)
@@ -1,11 +1,10 @@
 HOSTS:
-  centos-64-x64:
+  ubuntu-1404-x64:
     roles:
-      - master
-    platform: el-6-x86_64
-    box : centos-64-x64-vbox4210-nocm
-    box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box
-    hypervisor : vagrant
+      - agent
+      - default
+    platform: ubuntu-14.04-amd64
+    hypervisor: vagrant
+    box: puppetlabs/ubuntu-14.04-64-nocm
 CONFIG:
-  log_level: debug
-  type: git
+  type: foss
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/docker/centos-5.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/docker/centos-5.yml
new file mode 100644 (file)
index 0000000..c17bc3d
--- /dev/null
@@ -0,0 +1,19 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+  centos-5-x64:
+    platform: el-5-x86_64
+    hypervisor: docker
+    image: centos:5
+    docker_preserve_image: true
+    docker_cmd: '["/sbin/init"]'
+    docker_image_commands:
+      - 'yum install -y crontabs initscripts iproute openssl sysvinit-tools tar wget which'
+      - 'sed -i -e "/mingetty/d" /etc/inittab'
+CONFIG:
+  trace_limit: 200
+  masterless: true
+...
+# vim: syntax=yaml
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/docker/centos-6.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/docker/centos-6.yml
new file mode 100644 (file)
index 0000000..d93f884
--- /dev/null
@@ -0,0 +1,20 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+  centos-6-x64:
+    platform: el-6-x86_64
+    hypervisor: docker
+    image: centos:6
+    docker_preserve_image: true
+    docker_cmd: '["/sbin/init"]'
+    docker_image_commands:
+      - 'rm -rf /var/run/network/*'
+      - 'yum install -y crontabs initscripts iproute openssl sysvinit-tools tar wget which'
+      - 'rm /etc/init/tty.conf'
+CONFIG:
+  trace_limit: 200
+  masterless: true
+...
+# vim: syntax=yaml
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/docker/centos-7.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/docker/centos-7.yml
new file mode 100644 (file)
index 0000000..41e924b
--- /dev/null
@@ -0,0 +1,19 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+  centos-7-x64:
+    platform: el-7-x86_64
+    hypervisor: docker
+    image: centos:7
+    docker_preserve_image: true
+    docker_cmd: '["/usr/sbin/init"]'
+    docker_image_commands:
+      - 'yum install -y crontabs initscripts iproute openssl sysvinit-tools tar wget which ss'
+      - 'systemctl mask getty@tty1.service'
+CONFIG:
+  trace_limit: 200
+  masterless: true
+...
+# vim: syntax=yaml
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/docker/debian-7.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/docker/debian-7.yml
new file mode 100644 (file)
index 0000000..41b284d
--- /dev/null
@@ -0,0 +1,18 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+  debian-7-x64:
+    platform: debian-7-amd64
+    hypervisor: docker
+    image: debian:7
+    docker_preserve_image: true
+    docker_cmd: '["/sbin/init"]'
+    docker_image_commands:
+      - 'apt-get update && apt-get install -y cron locales-all net-tools wget'
+CONFIG:
+  trace_limit: 200
+  masterless: true
+...
+# vim: syntax=yaml
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/docker/debian-8.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/docker/debian-8.yml
new file mode 100644 (file)
index 0000000..a630b7e
--- /dev/null
@@ -0,0 +1,20 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+  debian-8-x64:
+    platform: debian-8-amd64
+    hypervisor: docker
+    image: debian:8
+    docker_preserve_image: true
+    docker_cmd: '["/sbin/init"]'
+    docker_image_commands:
+      - 'apt-get update && apt-get install -y cron locales-all net-tools wget'
+      - 'rm -f /usr/sbin/policy-rc.d'
+      - 'systemctl mask getty@tty1.service getty-static.service'
+CONFIG:
+  trace_limit: 200
+  masterless: true
+...
+# vim: syntax=yaml
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/docker/debian-9.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/docker/debian-9.yml
new file mode 100644 (file)
index 0000000..dfc8e9c
--- /dev/null
@@ -0,0 +1,20 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/theforeman/foreman-installer-modulesync
+HOSTS:
+  debian-9-x64:
+    platform: debian-9-amd64
+    hypervisor: docker
+    image: debian:9
+    docker_preserve_image: true
+    docker_cmd: '["/sbin/init"]'
+    docker_image_commands:
+      - 'apt-get update && apt-get install -y cron locales-all net-tools wget systemd-sysv'
+      - 'rm -f /usr/sbin/policy-rc.d'
+      - 'systemctl mask getty@tty1.service getty-static.service'
+CONFIG:
+  trace_limit: 200
+  masterless: true
+...
+# vim: syntax=yaml
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/docker/ubuntu-12.04.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/docker/ubuntu-12.04.yml
new file mode 100644 (file)
index 0000000..ab77cda
--- /dev/null
@@ -0,0 +1,19 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+  ubuntu-1204-x64:
+    platform: ubuntu-12.04-amd64
+    hypervisor: docker
+    image: ubuntu:12.04
+    docker_preserve_image: true
+    docker_cmd: '["/sbin/init"]'
+    docker_image_commands:
+      - 'apt-get install -y net-tools wget'
+      - 'locale-gen en_US.UTF-8'
+CONFIG:
+  trace_limit: 200
+  masterless: true
+...
+# vim: syntax=yaml
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/docker/ubuntu-14.04.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/docker/ubuntu-14.04.yml
new file mode 100644 (file)
index 0000000..ae45304
--- /dev/null
@@ -0,0 +1,21 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+  ubuntu-1404-x64:
+    platform: ubuntu-14.04-amd64
+    hypervisor: docker
+    image: ubuntu:14.04
+    docker_preserve_image: true
+    docker_cmd: '["/sbin/init"]'
+    docker_image_commands:
+      - 'rm /usr/sbin/policy-rc.d'
+      - 'rm /sbin/initctl; dpkg-divert --rename --remove /sbin/initctl'
+      - 'apt-get install -y net-tools wget apt-transport-https'
+      - 'locale-gen en_US.UTF-8'
+CONFIG:
+  trace_limit: 200
+  masterless: true
+...
+# vim: syntax=yaml
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/docker/ubuntu-16.04.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/docker/ubuntu-16.04.yml
new file mode 100644 (file)
index 0000000..2d173c5
--- /dev/null
@@ -0,0 +1,19 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+  ubuntu-1604-x64:
+    platform: ubuntu-16.04-amd64
+    hypervisor: docker
+    image: ubuntu:16.04
+    docker_preserve_image: true
+    docker_cmd: '["/sbin/init"]'
+    docker_image_commands:
+      - 'apt-get install -y net-tools wget locales apt-transport-https'
+      - 'locale-gen en_US.UTF-8'
+CONFIG:
+  trace_limit: 200
+  masterless: true
+...
+# vim: syntax=yaml
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml
new file mode 100644 (file)
index 0000000..19dd43e
--- /dev/null
@@ -0,0 +1,31 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+#
+# Additional ~/.fog config file with AWS EC2 credentials
+# required.
+#
+# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md
+#
+# Amazon Linux is not a RHEL clone.
+#
+HOSTS:
+  amazonlinux-2016091-x64:
+    roles:
+      - master
+    platform: centos-6-x86_64
+    hypervisor: ec2
+    # refers to image_tempaltes.yaml AMI[vmname] entry:
+    vmname: amazonlinux-2016091-eu-central-1
+    # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]:
+    snapshot: aio
+    # t2.micro is free tier eligible (https://aws.amazon.com/en/free/):
+    amisize: t2.micro
+    # required so that beaker sanitizes sshd_config and root authorized_keys:
+    user: ec2-user
+CONFIG:
+  type: aio
+  :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml
+...
+# vim: syntax=yaml
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/ec2/image_templates.yaml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/ec2/image_templates.yaml
new file mode 100644 (file)
index 0000000..e50593e
--- /dev/null
@@ -0,0 +1,34 @@
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+#
+# see also: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md
+#
+# Hint: image IDs (ami-*) for the same image are different per location.
+#
+AMI:
+  # Amazon Linux AMI 2016.09.1 (HVM), SSD Volume Type
+  amazonlinux-2016091-eu-central-1:
+    :image:
+      :aio: ami-af0fc0c0
+    :region: eu-central-1
+  # Red Hat Enterprise Linux 7.3 (HVM), SSD Volume Type
+  rhel-73-eu-central-1:
+    :image:
+      :aio: ami-e4c63e8b
+    :region: eu-central-1
+  # SUSE Linux Enterprise Server 12 SP2 (HVM), SSD Volume Type
+  sles-12sp2-eu-central-1:
+    :image:
+      :aio: ami-c425e4ab
+    :region: eu-central-1
+  # Ubuntu Server 16.04 LTS (HVM), SSD Volume Type
+  ubuntu-1604-eu-central-1:
+    :image:
+      :aio: ami-fe408091
+    :region: eu-central-1
+  # Microsoft Windows Server 2016 Base
+  windows-2016-base-eu-central-1:
+    :image:
+      :aio: ami-88ec20e7
+    :region: eu-central-1
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/ec2/rhel-73-x64.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/ec2/rhel-73-x64.yml
new file mode 100644 (file)
index 0000000..7fac823
--- /dev/null
@@ -0,0 +1,29 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+#
+# Additional ~/.fog config file with AWS EC2 credentials
+# required.
+#
+# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md
+#
+HOSTS:
+  rhel-73-x64:
+    roles:
+      - master
+    platform: el-7-x86_64
+    hypervisor: ec2
+    # refers to image_tempaltes.yaml AMI[vmname] entry:
+    vmname: rhel-73-eu-central-1
+    # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]:
+    snapshot: aio
+    # t2.micro is free tier eligible (https://aws.amazon.com/en/free/):
+    amisize: t2.micro
+    # required so that beaker sanitizes sshd_config and root authorized_keys:
+    user: ec2-user
+CONFIG:
+  type: aio
+  :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml
+...
+# vim: syntax=yaml
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml
new file mode 100644 (file)
index 0000000..8542154
--- /dev/null
@@ -0,0 +1,29 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+#
+# Additional ~/.fog config file with AWS EC2 credentials
+# required.
+#
+# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md
+#
+HOSTS:
+  sles-12sp2-x64:
+    roles:
+      - master
+    platform: sles-12-x86_64
+    hypervisor: ec2
+    # refers to image_tempaltes.yaml AMI[vmname] entry:
+    vmname: sles-12sp2-eu-central-1
+    # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]:
+    snapshot: aio
+    # t2.micro is free tier eligible (https://aws.amazon.com/en/free/):
+    amisize: t2.micro
+    # required so that beaker sanitizes sshd_config and root authorized_keys:
+    user: ec2-user
+CONFIG:
+  type: aio
+  :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml
+...
+# vim: syntax=yaml
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml
new file mode 100644 (file)
index 0000000..9cf59d5
--- /dev/null
@@ -0,0 +1,29 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+#
+# Additional ~/.fog config file with AWS EC2 credentials
+# required.
+#
+# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md
+#
+HOSTS:
+  ubuntu-1604-x64:
+    roles:
+      - master
+    platform: ubuntu-16.04-amd64
+    hypervisor: ec2
+    # refers to image_tempaltes.yaml AMI[vmname] entry:
+    vmname: ubuntu-1604-eu-central-1
+    # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]:
+    snapshot: aio
+    # t2.micro is free tier eligible (https://aws.amazon.com/en/free/):
+    amisize: t2.micro
+    # required so that beaker sanitizes sshd_config and root authorized_keys:
+    user: ubuntu
+CONFIG:
+  type: aio
+  :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml
+...
+# vim: syntax=yaml
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml
new file mode 100644 (file)
index 0000000..0932e29
--- /dev/null
@@ -0,0 +1,29 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+#
+# Additional ~/.fog config file with AWS EC2 credentials
+# required.
+#
+# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md
+#
+HOSTS:
+  windows-2016-base-x64:
+    roles:
+      - master
+    platform: windows-2016-64
+    hypervisor: ec2
+    # refers to image_tempaltes.yaml AMI[vmname] entry:
+    vmname: windows-2016-base-eu-central-1
+    # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]:
+    snapshot: aio
+    # t2.micro is free tier eligible (https://aws.amazon.com/en/free/):
+    amisize: t2.micro
+    # required so that beaker sanitizes sshd_config and root authorized_keys:
+    user: ec2-user
+CONFIG:
+  type: aio
+  :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml
+...
+# vim: syntax=yaml
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/fedora-24-x64.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/fedora-24-x64.yml
new file mode 100644 (file)
index 0000000..820b62d
--- /dev/null
@@ -0,0 +1,15 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+  fedora-24-x64:
+    roles:
+      - master
+    platform: fedora-24-x86_64
+    box: fedora/24-cloud-base
+    hypervisor: vagrant
+CONFIG:
+  type: aio
+...
+# vim: syntax=yaml
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/fedora-25-x64.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/fedora-25-x64.yml
new file mode 100644 (file)
index 0000000..54dd330
--- /dev/null
@@ -0,0 +1,16 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+#
+HOSTS:
+  fedora-25-x64:
+    roles:
+      - master
+    platform: fedora-25-x86_64
+    box: fedora/25-cloud-base
+    hypervisor: vagrant
+CONFIG:
+  type: aio
+...
+# vim: syntax=yaml
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/fedora-26-x64.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/fedora-26-x64.yml
new file mode 100644 (file)
index 0000000..598822b
--- /dev/null
@@ -0,0 +1,16 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+#
+HOSTS:
+  fedora-26-x64:
+    roles:
+      - master
+    platform: fedora-26-x86_64
+    box: fedora/26-cloud-base
+    hypervisor: vagrant
+CONFIG:
+  type: aio
+...
+# vim: syntax=yaml
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/fedora-27-x64.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/fedora-27-x64.yml
new file mode 100644 (file)
index 0000000..c2b61eb
--- /dev/null
@@ -0,0 +1,18 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+#
+# platform is fedora 26 because there is no puppet-agent
+# for fedora 27 as of 2017-11-17
+HOSTS:
+  fedora-27-x64:
+    roles:
+      - master
+    platform: fedora-26-x86_64
+    box: fedora/27-cloud-base
+    hypervisor: vagrant
+CONFIG:
+  type: aio
+...
+# vim: syntax=yaml
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml
deleted file mode 100644 (file)
index 5ca1514..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-HOSTS:
-  ubuntu-server-10044-x64:
-    roles:
-      - master
-    platform: ubuntu-10.04-amd64
-    box : ubuntu-server-10044-x64-vbox4210-nocm
-    box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-10044-x64-vbox4210-nocm.box
-    hypervisor : vagrant
-CONFIG:
-  type: foss
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml
new file mode 100644 (file)
index 0000000..29102c5
--- /dev/null
@@ -0,0 +1,15 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+  ubuntu-server-1204-x64:
+    roles:
+      - master
+    platform: ubuntu-12.04-amd64
+    box: puppetlabs/ubuntu-12.04-64-nocm
+    hypervisor: vagrant
+CONFIG:
+  type: foss
+...
+# vim: syntax=yaml
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml
deleted file mode 100644 (file)
index d065b30..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-HOSTS:
-  ubuntu-server-12042-x64:
-    roles:
-      - master
-    platform: ubuntu-12.04-amd64
-    box : ubuntu-server-12042-x64-vbox4210-nocm
-    box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box
-    hypervisor : vagrant
-CONFIG:
-  type: foss
index cba1cd0..054e658 100644 (file)
@@ -1,11 +1,15 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
 HOSTS:
   ubuntu-server-1404-x64:
     roles:
       - master
     platform: ubuntu-14.04-amd64
-    box : puppetlabs/ubuntu-14.04-64-nocm
-    box_url : https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm
-    hypervisor : vagrant
+    box: puppetlabs/ubuntu-14.04-64-nocm
+    hypervisor: vagrant
 CONFIG:
-  log_level   : debug
-  type: git
+  type: foss
+...
+# vim: syntax=yaml
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml b/3rdparty/modules/rabbitmq/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml
new file mode 100644 (file)
index 0000000..bc85e0e
--- /dev/null
@@ -0,0 +1,15 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+  ubuntu-server-1604-x64:
+    roles:
+      - master
+    platform: ubuntu-16.04-amd64
+    box: puppetlabs/ubuntu-16.04-64-nocm
+    hypervisor: vagrant
+CONFIG:
+  type: foss
+...
+# vim: syntax=yaml
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/parameter_spec.rb b/3rdparty/modules/rabbitmq/spec/acceptance/parameter_spec.rb
new file mode 100644 (file)
index 0000000..a2bcdd9
--- /dev/null
@@ -0,0 +1,48 @@
+require 'spec_helper_acceptance'
+
+describe 'rabbitmq parameter on a vhost:' do
+  context 'create parameter resource' do
+    it 'runs successfully' do
+      pp = <<-EOS
+      if $facts['os']['family'] == 'RedHat' {
+        class { 'erlang': epel_enable => true }
+        Class['erlang'] -> Class['rabbitmq']
+      }
+      class { 'rabbitmq':
+        service_manage    => true,
+        port              => 5672,
+        delete_guest_user => true,
+        admin_enable      => true,
+      }
+
+      rabbitmq_plugin { [ 'rabbitmq_federation_management', 'rabbitmq_federation' ]:
+        ensure => present
+      } ~> Service['rabbitmq-server']
+
+      rabbitmq_vhost { 'fedhost':
+        ensure => present,
+      } ->
+
+      rabbitmq_parameter { 'documentumFed@fedhost':
+        component_name => 'federation-upstream',
+        value          => {
+          'uri'    => 'amqp://server',
+          'expires' => '3600000',
+        },
+      }
+      EOS
+
+      apply_manifest(pp, catch_failures: true)
+      apply_manifest(pp, catch_changes: true)
+    end
+
+    # rubocop:disable RSpec/MultipleExpectations
+    it 'has the parameter' do
+      shell('rabbitmqctl list_parameters -p fedhost') do |r|
+        expect(r.stdout).to match(%r{federation-upstream.*documentumFed.*expires.*3600000})
+        expect(r.exit_code).to be_zero
+      end
+    end
+    # rubocop:enable RSpec/MultipleExpectations
+  end
+end
index 26858ec..91161a4 100644 (file)
@@ -1,18 +1,16 @@
 require 'spec_helper_acceptance'
 
 describe 'rabbitmq policy on a vhost:' do
-
-
-  context "create policy resource" do
-    it 'should run successfully' do
+  context 'create policy resource' do
+    it 'runs successfully' do
       pp = <<-EOS
-      if $::osfamily == 'RedHat' {
+      if $facts['os']['family'] == 'RedHat' {
         class { 'erlang': epel_enable => true }
-        Class['erlang'] -> Class['::rabbitmq']
+        Class['erlang'] -> Class['rabbitmq']
       }
-      class { '::rabbitmq':
+      class { 'rabbitmq':
         service_manage    => true,
-        port              => '5672',
+        port              => 5672,
         delete_guest_user => true,
         admin_enable      => true,
       } ->
@@ -30,18 +28,33 @@ describe 'rabbitmq policy on a vhost:' do
           'ha-sync-mode' => 'automatic',
         },
       }
+
+      rabbitmq_policy { 'eu-federation@myhost':
+        pattern    => '^eu\\.',
+        priority   => 0,
+        applyto    => 'all',
+        definition => {
+          'federation-upstream-set' => 'all',
+        },
+      }
       EOS
 
-      apply_manifest(pp, :catch_failures => true)
-      apply_manifest(pp, :catch_changes => true)
+      apply_manifest(pp, catch_failures: true)
+      apply_manifest(pp, catch_changes: true)
+
+      # Apply twice to ensure no changes the second time.
+      apply_manifest(pp, catch_failures: true)
+      expect(apply_manifest(pp, catch_changes: true).exit_code).to be_zero
     end
 
-    it 'should have the policy' do
+    # rubocop:disable RSpec/MultipleExpectations
+    it 'has the policy' do
       shell('rabbitmqctl list_policies -p myhost') do |r|
-        expect(r.stdout).to match(/myhost.*ha-all.*ha-sync-mode/)
+        expect(r.stdout).to match(%r{myhost.*ha-all.*ha-sync-mode})
+        expect(r.stdout).to match(%r{myhost.*eu-federation})
         expect(r.exit_code).to be_zero
       end
     end
-
+    # rubocop:enable RSpec/MultipleExpectations
   end
 end
index a1643a6..a5ed1d1 100644 (file)
@@ -1,18 +1,16 @@
 require 'spec_helper_acceptance'
 
 describe 'rabbitmq binding:' do
-
-
-  context "create binding and queue resources when rabbit using default management port" do
-    it 'should run successfully' do
+  context 'create binding and queue resources when using default management port' do
+    it 'runs successfully' do
       pp = <<-EOS
-      if $::osfamily == 'RedHat' {
+      if $facts['os']['family'] == 'RedHat' {
         class { 'erlang': epel_enable => true }
-        Class['erlang'] -> Class['::rabbitmq']
+        Class['erlang'] -> Class['rabbitmq']
       }
-      class { '::rabbitmq':
+      class { 'rabbitmq':
         service_manage    => true,
-        port              => '5672',
+        port              => 5672,
         delete_guest_user => true,
         admin_enable      => true,
       } ->
@@ -22,7 +20,7 @@ describe 'rabbitmq binding:' do
         password => 'bar',
         tags     => ['monitoring', 'tag1'],
       } ->
-      
+
       rabbitmq_user_permissions { 'dan@host1':
         configure_permission => '.*',
         read_permission      => '.*',
@@ -55,40 +53,131 @@ describe 'rabbitmq binding:' do
         routing_key      => '#',
         ensure           => present,
       }
-      
+
       EOS
 
-      apply_manifest(pp, :catch_failures => true)
-      apply_manifest(pp, :catch_changes => true)
+      apply_manifest(pp, catch_failures: true)
+      apply_manifest(pp, catch_changes: true)
     end
 
-    it 'should have the binding' do
+    # rubocop:disable RSpec/MultipleExpectations
+    it 'has the binding' do
       shell('rabbitmqctl list_bindings -q -p host1') do |r|
-        expect(r.stdout).to match(/exchange1\sexchange\squeue1\squeue\s#/)
+        expect(r.stdout).to match(%r{exchange1\sexchange\squeue1\squeue\s#})
         expect(r.exit_code).to be_zero
       end
     end
-    
-    it 'should have the queue' do
+
+    it 'has the queue' do
       shell('rabbitmqctl list_queues -q -p host1') do |r|
-        expect(r.stdout).to match(/queue1/)
+        expect(r.stdout).to match(%r{queue1})
         expect(r.exit_code).to be_zero
       end
     end
+    # rubocop:enable RSpec/MultipleExpectations
+  end
+
+  context 'create multiple bindings when same source / destination / vhost but different routing keys' do
+    it 'runs successfully' do
+      pp = <<-EOS
+      if $facts['os']['family'] == 'RedHat' {
+        class { 'erlang': epel_enable => true }
+        Class['erlang'] -> Class['rabbitmq']
+      }
+      class { 'rabbitmq':
+        service_manage    => true,
+        port              => 5672,
+        delete_guest_user => true,
+        admin_enable      => true,
+      } ->
+
+      rabbitmq_user { 'dan':
+        admin    => true,
+        password => 'bar',
+        tags     => ['monitoring', 'tag1'],
+      } ->
+
+      rabbitmq_user_permissions { 'dan@host1':
+        configure_permission => '.*',
+        read_permission      => '.*',
+        write_permission     => '.*',
+      }
+
+      rabbitmq_vhost { 'host1':
+        ensure => present,
+      } ->
+
+      rabbitmq_exchange { 'exchange1@host1':
+        user     => 'dan',
+        password => 'bar',
+        type     => 'topic',
+        ensure   => present,
+      } ->
 
+      rabbitmq_queue { 'queue1@host1':
+        user        => 'dan',
+        password    => 'bar',
+        durable     => true,
+        auto_delete => false,
+        ensure      => present,
+      } ->
+
+      rabbitmq_binding { 'binding 1':
+        source           => 'exchange1',
+        destination      => 'queue1',
+        user             => 'dan',
+        vhost            => 'host1',
+        password         => 'bar',
+        destination_type => 'queue',
+        routing_key      => 'test1',
+        ensure           => present,
+      } ->
+
+      rabbitmq_binding { 'binding 2':
+        source           => 'exchange1',
+        destination      => 'queue1',
+        user             => 'dan',
+        vhost            => 'host1',
+        password         => 'bar',
+        destination_type => 'queue',
+        routing_key      => 'test2',
+        ensure           => present,
+      }
+
+      EOS
+
+      apply_manifest(pp, catch_failures: true)
+      apply_manifest(pp, catch_changes: true)
+    end
+
+    # rubocop:disable RSpec/MultipleExpectations
+    it 'has the bindings' do
+      shell('rabbitmqctl list_bindings -q -p host1') do |r|
+        expect(r.stdout).to match(%r{exchange1\sexchange\squeue1\squeue\stest1})
+        expect(r.stdout).to match(%r{exchange1\sexchange\squeue1\squeue\stest2})
+        expect(r.exit_code).to be_zero
+      end
+    end
+    # rubocop:enable RSpec/MultipleExpectations
+
+    it 'puppet resource shows a binding' do
+      shell('puppet resource rabbitmq_binding') do |r|
+        expect(r.stdout).to match(%r{source\s+=>\s+'exchange1',})
+      end
+    end
   end
-  
-  context "create binding and queue resources when rabbit using a non-default management port" do
-    it 'should run successfully' do
+
+  context 'create binding and queue resources when using a non-default management port' do
+    it 'runs successfully' do
       pp = <<-EOS
-      if $::osfamily == 'RedHat' {
+      if $facts['os']['family'] == 'RedHat' {
         class { 'erlang': epel_enable => true }
-        Class['erlang'] -> Class['::rabbitmq']
+        Class['erlang'] -> Class['rabbitmq']
       }
-      class { '::rabbitmq':
+      class { 'rabbitmq':
         service_manage    => true,
-        port              => '5672',
-        management_port   => '11111',
+        port              => 5672,
+        management_port   => 11111,
         delete_guest_user => true,
         admin_enable      => true,
       } ->
@@ -98,7 +187,7 @@ describe 'rabbitmq binding:' do
         password => 'bar',
         tags     => ['monitoring', 'tag1'],
       } ->
-      
+
       rabbitmq_user_permissions { 'dan@host2':
         configure_permission => '.*',
         read_permission      => '.*',
@@ -131,27 +220,27 @@ describe 'rabbitmq binding:' do
         routing_key      => '#',
         ensure           => present,
       }
-     
+
       EOS
 
-      apply_manifest(pp, :catch_failures => true)
-      apply_manifest(pp, :catch_changes => true)
+      apply_manifest(pp, catch_failures: true)
+      apply_manifest(pp, catch_changes: true)
     end
 
-    it 'should have the binding' do
+    # rubocop:disable RSpec/MultipleExpectations
+    it 'has the binding' do
       shell('rabbitmqctl list_bindings -q -p host2') do |r|
-        expect(r.stdout).to match(/exchange2\sexchange\squeue2\squeue\s#/)
+        expect(r.stdout).to match(%r{exchange2\sexchange\squeue2\squeue\s#})
         expect(r.exit_code).to be_zero
       end
     end
-    
-    it 'should have the queue' do
+
+    it 'has the queue' do
       shell('rabbitmqctl list_queues -q -p host2') do |r|
-        expect(r.stdout).to match(/queue2/)
+        expect(r.stdout).to match(%r{queue2})
         expect(r.exit_code).to be_zero
       end
     end
-
+    # rubocop:enable RSpec/MultipleExpectations
   end
-  
 end
index e9d619c..149e423 100644 (file)
@@ -1,51 +1,51 @@
 require 'spec_helper_acceptance'
 
 describe 'rabbitmq::install::rabbitmqadmin class' do
-  context 'does nothing if service is unmanaged' do
-    it 'should run successfully' do
+  context 'downloads the cli tools' do
+    it 'runs successfully' do
       pp = <<-EOS
       class { 'rabbitmq':
         admin_enable   => true,
-        service_manage => false,
+        service_manage => true,
       }
-      if $::osfamily == 'RedHat' {
+      if $facts['os']['family'] == 'RedHat' {
         class { 'erlang': epel_enable => true}
         Class['erlang'] -> Class['rabbitmq']
       }
       EOS
 
-      shell('rm -f /var/lib/rabbitmq/rabbitmqadmin')
-      apply_manifest(pp, :catch_failures => true)
+      apply_manifest(pp, catch_failures: true)
     end
 
     describe file('/var/lib/rabbitmq/rabbitmqadmin') do
-      it { should_not be_file }
+      it { is_expected.to be_file }
     end
   end
 
-  context 'downloads the cli tools' do
-    it 'should run successfully' do
+  context 'does nothing if service is unmanaged' do
+    it 'runs successfully' do
       pp = <<-EOS
       class { 'rabbitmq':
         admin_enable   => true,
-        service_manage => true,
+        service_manage => false,
       }
-      if $::osfamily == 'RedHat' {
+      if $facts['os']['family'] == 'RedHat' {
         class { 'erlang': epel_enable => true}
         Class['erlang'] -> Class['rabbitmq']
       }
       EOS
 
-      apply_manifest(pp, :catch_failures => true)
+      shell('rm -f /var/lib/rabbitmq/rabbitmqadmin')
+      apply_manifest(pp, catch_failures: true)
     end
 
     describe file('/var/lib/rabbitmq/rabbitmqadmin') do
-      it { should be_file }
+      it { is_expected.not_to be_file }
     end
   end
 
   context 'works with specified default credentials' do
-    it 'should run successfully' do
+    it 'runs successfully' do
       # make sure credential change takes effect before admin_enable
       pp_pre = <<-EOS
       class { 'rabbitmq':
@@ -53,7 +53,7 @@ describe 'rabbitmq::install::rabbitmqadmin class' do
         default_user   => 'foobar',
         default_pass   => 'bazblam',
       }
-      if $::osfamily == 'RedHat' {
+      if $facts['os']['family'] == 'RedHat' {
         class { 'erlang': epel_enable => true}
         Class['erlang'] -> Class['rabbitmq']
       }
@@ -66,20 +66,19 @@ describe 'rabbitmq::install::rabbitmqadmin class' do
         default_user   => 'foobar',
         default_pass   => 'bazblam',
       }
-      if $::osfamily == 'RedHat' {
+      if $facts['os']['family'] == 'RedHat' {
         class { 'erlang': epel_enable => true}
         Class['erlang'] -> Class['rabbitmq']
       }
       EOS
 
       shell('rm -f /var/lib/rabbitmq/rabbitmqadmin')
-      apply_manifest(pp_pre, :catch_failures => true)
-      apply_manifest(pp, :catch_failures => true)
+      apply_manifest(pp_pre, catch_failures: true)
+      apply_manifest(pp, catch_failures: true)
     end
 
     describe file('/var/lib/rabbitmq/rabbitmqadmin') do
-      it { should be_file }
+      it { is_expected.to be_file }
     end
   end
-
 end
index d99f995..5ac29bf 100644 (file)
@@ -1,7 +1,7 @@
 require 'spec_helper_acceptance'
 
 describe 'rabbitmq server:' do
-  case fact('osfamily')
+  case fact('os.family')
   when 'RedHat'
     package_name = 'rabbitmq-server'
     service_name = 'rabbitmq-server'
@@ -16,57 +16,57 @@ describe 'rabbitmq server:' do
     service_name = 'rabbitmq'
   end
 
-  context "default class inclusion" do
-    it 'should run successfully' do
+  context 'default class inclusion' do
+    it 'runs successfully' do
       pp = <<-EOS
       class { 'rabbitmq::server': }
-      if $::osfamily == 'RedHat' {
+      if $facts['os']['family'] == 'RedHat' {
         class { 'erlang': epel_enable => true}
         Class['erlang'] -> Class['rabbitmq::server']
       }
       EOS
 
       # Apply twice to ensure no errors the second time.
-      apply_manifest(pp, :catch_failures => true)
-      expect(apply_manifest(pp, :catch_changes => true).exit_code).to be_zero
+      apply_manifest(pp, catch_failures: true)
+      expect(apply_manifest(pp, catch_changes: true).exit_code).to be_zero
     end
 
     describe package(package_name) do
-      it { should be_installed }      
+      it { is_expected.to be_installed }
     end
 
     describe service(service_name) do
-      it { should be_enabled }
-      it { should be_running }
+      it { is_expected.to be_enabled }
+      it { is_expected.to be_running }
     end
   end
 
-  context "disable and stop service" do
-    it 'should run successfully' do
+  context 'disable and stop service' do
+    it 'runs successfully' do
       pp = <<-EOS
       class { 'rabbitmq::server':
         service_ensure => 'stopped',
       }
-      if $::osfamily == 'RedHat' {
+      if $facts['os']['family'] == 'RedHat' {
         class { 'erlang': epel_enable => true}
         Class['erlang'] -> Class['rabbitmq::server']
       }
       EOS
 
-      apply_manifest(pp, :catch_failures => true)
+      apply_manifest(pp, catch_failures: true)
     end
 
     describe service(service_name) do
-      it { should_not be_enabled }
-      it { should_not be_running }
+      it { is_expected.not_to be_enabled }
+      it { is_expected.not_to be_running }
     end
   end
 
-  context "service is unmanaged" do
-    it 'should run successfully' do
+  context 'service is unmanaged' do
+    it 'runs successfully' do
       pp_pre = <<-EOS
       class { 'rabbitmq::server': }
-      if $::osfamily == 'RedHat' {
+      if $facts['os']['family'] == 'RedHat' {
         class { 'erlang': epel_enable => true}
         Class['erlang'] -> Class['rabbitmq::server']
       }
@@ -77,20 +77,19 @@ describe 'rabbitmq server:' do
         service_manage => false,
         service_ensure  => 'stopped',
       }
-      if $::osfamily == 'RedHat' {
+      if $facts['os']['family'] == 'RedHat' {
         class { 'erlang': epel_enable => true}
         Class['erlang'] -> Class['rabbitmq::server']
       }
       EOS
 
-      
-      apply_manifest(pp_pre, :catch_failures => true)
-      apply_manifest(pp, :catch_failures => true)
+      apply_manifest(pp_pre, catch_failures: true)
+      apply_manifest(pp, catch_failures: true)
     end
 
     describe service(service_name) do
-      it { should be_enabled }
-      it { should be_running }
+      it { is_expected.to be_enabled }
+      it { is_expected.to be_running }
     end
   end
 end
index 6aab665..beff492 100644 (file)
@@ -1,18 +1,16 @@
 require 'spec_helper_acceptance'
 
 describe 'rabbitmq user:' do
-
-
-  context "create user resource" do
-    it 'should run successfully' do
+  context 'create user resource' do
+    it 'runs successfully' do
       pp = <<-EOS
-      if $::osfamily == 'RedHat' {
+      if $facts['os']['family'] == 'RedHat' {
         class { 'erlang': epel_enable => true }
-        Class['erlang'] -> Class['::rabbitmq']
+        Class['erlang'] -> Class['rabbitmq']
       }
-      class { '::rabbitmq':
+      class { 'rabbitmq':
         service_manage    => true,
-        port              => '5672',
+        port              => 5672,
         delete_guest_user => true,
         admin_enable      => true,
       } ->
@@ -23,16 +21,36 @@ describe 'rabbitmq user:' do
       }
       EOS
 
-      apply_manifest(pp, :catch_failures => true)
-      apply_manifest(pp, :catch_changes => true)
+      apply_manifest(pp, catch_failures: true)
+      apply_manifest(pp, catch_changes: true)
     end
 
-    it 'should have the user' do
-      shell('rabbitmqctl list_users') do |r|
-        expect(r.stdout).to match(/dan.*administrator/)
+    # rubocop:disable RSpec/MultipleExpectations
+    it 'has the user' do
+      shell('rabbitmqctl list_users -q') do |r|
+        expect(r.stdout).to match(%r{dan.*administrator})
         expect(r.exit_code).to be_zero
       end
     end
+    # rubocop:enable RSpec/MultipleExpectations
+  end
+
+  context 'destroy user resource' do
+    it 'runs successfully' do
+      pp = <<-EOS
+      rabbitmq_user { 'dan':
+        ensure => absent,
+      }
+      EOS
+
+      apply_manifest(pp, catch_failures: true)
+      apply_manifest(pp, catch_changes: true)
+    end
 
+    it 'does not have the user' do
+      shell('rabbitmqctl list_users -q') do |r|
+        expect(r.stdout).not_to match(%r{dan\s+})
+      end
+    end
   end
 end
index ef1c2a3..fc3722a 100644 (file)
@@ -1,18 +1,16 @@
 require 'spec_helper_acceptance'
 
 describe 'rabbitmq vhost:' do
-
-
-  context "create vhost resource" do
-    it 'should run successfully' do
+  context 'create vhost resource' do
+    it 'runs successfully' do
       pp = <<-EOS
-      if $::osfamily == 'RedHat' {
+      if $facts['os']['family'] == 'RedHat' {
         class { 'erlang': epel_enable => true }
-        Class['erlang'] -> Class['::rabbitmq']
+        Class['erlang'] -> Class['rabbitmq']
       }
-      class { '::rabbitmq':
+      class { 'rabbitmq':
         service_manage    => true,
-        port              => '5672',
+        port              => 5672,
         delete_guest_user => true,
         admin_enable      => true,
       } ->
@@ -22,16 +20,17 @@ describe 'rabbitmq vhost:' do
       }
       EOS
 
-      apply_manifest(pp, :catch_failures => true)
-      apply_manifest(pp, :catch_changes => true)
+      apply_manifest(pp, catch_failures: true)
+      apply_manifest(pp, catch_changes: true)
     end
 
-    it 'should have the vhost' do
+    # rubocop:disable RSpec/MultipleExpectations
+    it 'has the vhost' do
       shell('rabbitmqctl list_vhosts') do |r|
-        expect(r.stdout).to match(/myhost/)
+        expect(r.stdout).to match(%r{myhost})
         expect(r.exit_code).to be_zero
       end
     end
-
+    # rubocop:enable RSpec/MultipleExpectations
   end
 end
diff --git a/3rdparty/modules/rabbitmq/spec/acceptance/zz281_spec.rb b/3rdparty/modules/rabbitmq/spec/acceptance/zz281_spec.rb
deleted file mode 100644 (file)
index 05e5ef4..0000000
+++ /dev/null
@@ -1,213 +0,0 @@
-require 'spec_helper_acceptance'
-#
-# beacuse of some serious issues with upgrading and downgrading rabbitmq on RedHat,
-# we need to run all of the 2.8.1 tests last.
-#
-# NOTE that this is only tested on RedHat and probably only works there. But I can't seem
-# to get 'confine' to work...
-#
-
-describe 'rabbitmq class with 2.8.1:' do
-  case fact('osfamily')
-  when 'RedHat'
-    package_name   = 'rabbitmq-server'
-    service_name   = 'rabbitmq-server'
-    package_source = "http://www.rabbitmq.com/releases/rabbitmq-server/v2.8.1/rabbitmq-server-2.8.1-1.noarch.rpm"
-    package_ensure = '2.8.1-1'
-  when 'SUSE'
-    package_name   = 'rabbitmq-server'
-    service_name   = 'rabbitmq-server'
-    package_source = "http://www.rabbitmq.com/releases/rabbitmq-server/v2.8.1/rabbitmq-server-2.8.1-1.noarch.rpm"
-    package_ensure = '2.8.1-1'
-  when 'Debian'
-    package_name   = 'rabbitmq-server'
-    service_name   = 'rabbitmq-server'
-    package_source = ''
-    package_ensure = '2.8.1'
-  when 'Archlinux'
-    package_name   = 'rabbitmq'
-    service_name   = 'rabbitmq'
-    package_source = ''
-    package_ensure = '2.8.1'
-  end
-
-  context "default class inclusion" do
-    it 'should run successfully' do
-      pp = <<-EOS
-      class { 'rabbitmq':
-        version          => '2.8.1-1',
-        package_source   => '#{package_source}',
-        package_ensure   => '#{package_ensure}',
-        package_provider => 'rpm',
-        management_port  => '55672',
-      }
-      if $::osfamily == 'RedHat' {
-        class { 'erlang': epel_enable => true}
-        Class['erlang'] -> Class['rabbitmq']
-      }
-      EOS
-
-      # clean up previous 3.x install - can't be ungraded cleanly via RPM
-      shell('service rabbitmq-server stop')
-      shell('yum -y erase rabbitmq-server')
-      shell('rm -Rf /var/lib/rabbitmq/mnesia /etc/rabbitmq /var/lib/rabbitmq/rabbitmqadmin')
-      # Apply twice to ensure no errors the second time.
-      apply_manifest(pp, :catch_failures => true)
-      expect(apply_manifest(pp, :catch_changes => true).exit_code).to be_zero
-      # DEBUG
-      shell('netstat -lntp')
-    end
-
-    describe command('rabbitmqctl status') do
-      its(:stdout) { should match /{rabbit,"RabbitMQ","2.8.1"}/ }
-    end
-
-    describe package(package_name) do
-      it { should be_installed }
-    end
-
-    describe service(service_name) do
-      it { should be_enabled }
-      it { should be_running }
-    end
-  end
-
-  context "disable and stop service" do
-    it 'should run successfully' do
-      pp = <<-EOS
-      class { 'rabbitmq':
-        version          => '2.8.1-1',
-        package_source   => '#{package_source}',
-        package_ensure   => '#{package_ensure}',
-        package_provider => 'rpm',
-        management_port  => '55672',
-        service_ensure   => 'stopped',
-        admin_enable     => false,
-      }
-      if $::osfamily == 'RedHat' {
-        class { 'erlang': epel_enable => true}
-        Class['erlang'] -> Class['rabbitmq']
-      }
-      EOS
-
-      apply_manifest(pp, :catch_failures => true)
-    end
-
-    describe service(service_name) do
-      it { should_not be_enabled }
-      it { should_not be_running }
-    end
-  end
-
-  context "service is unmanaged" do
-    it 'should run successfully' do
-      pp_pre = <<-EOS
-      class { 'rabbitmq':
-        version          => '2.8.1-1',
-        package_source   => '#{package_source}',
-        package_ensure   => '#{package_ensure}',
-        package_provider => 'rpm',
-        management_port  => '55672',
-      }
-      if $::osfamily == 'RedHat' {
-        class { 'erlang': epel_enable => true}
-        Class['erlang'] -> Class['rabbitmq']
-      }
-      EOS
-
-      pp = <<-EOS
-      class { 'rabbitmq':
-        service_manage => false,
-        service_ensure  => 'stopped',
-      }
-      if $::osfamily == 'RedHat' {
-        class { 'erlang': epel_enable => true}
-        Class['erlang'] -> Class['rabbitmq']
-      }
-      EOS
-
-      apply_manifest(pp_pre, :catch_failures => true)
-      apply_manifest(pp, :catch_failures => true)
-    end
-
-    describe service(service_name) do
-      it { should be_enabled }
-      it { should be_running }
-    end
-  end
-
-  context 'rabbitmqadmin' do
-    #confine :to, :platform => 'el-6-x86'
-
-    it 'should run successfully' do
-      pp = <<-EOS
-      class { 'rabbitmq':
-        admin_enable     => true,
-        service_manage   => true,
-        version          => '2.8.1-1',
-        package_source   => '#{package_source}',
-        package_ensure   => '#{package_ensure}',
-        package_provider => 'rpm',
-        management_port  => '55672',
-      }
-      if $::osfamily == 'RedHat' {
-        class { 'erlang': epel_enable => true}
-        Class['erlang'] -> Class['rabbitmq']
-      }
-      EOS
-
-      shell('rm -f /var/lib/rabbitmq/rabbitmqadmin')
-      apply_manifest(pp, :catch_failures => true)
-    end
-
-    # since serverspec (used by beaker-rspec) can only tell present/absent for packages
-    describe file('/var/lib/rabbitmq/rabbitmqadmin') do
-      it { should be_file }
-    end
-    
-    describe command('/usr/local/bin/rabbitmqadmin --help') do
-      its(:exit_status) { should eq 0 }
-    end
-
-  end
-
-  context 'rabbitmqadmin with specified default credentials' do
-
-    it 'should run successfully' do
-      # make sure credential change takes effect before admin_enable
-      pp = <<-EOS
-      class { 'rabbitmq':
-        admin_enable     => true,
-        service_manage   => true,
-        version          => '2.8.1-1',
-        package_source   => '#{package_source}',
-        package_ensure   => '#{package_ensure}',
-        package_provider => 'rpm',
-        management_port  => '55672',
-        default_user     => 'foobar',
-        default_pass     => 'bazblam',
-      }
-      if $::osfamily == 'RedHat' {
-        class { 'erlang': epel_enable => true}
-        Class['erlang'] -> Class['rabbitmq']
-      }
-      EOS
-
-      # next 3 lines - see MODULES-1085
-      shell('service rabbitmq-server stop')
-      shell('rm -Rf /var/lib/rabbitmq/mnesia /var/lib/rabbitmq/rabbitmqadmin')
-      apply_manifest(pp, :catch_failures => true)
-    end
-
-    # since serverspec (used by beaker-rspec) can only tell present/absent for packages
-    describe file('/var/lib/rabbitmq/rabbitmqadmin') do
-      it { should be_file }
-    end
-
-    describe command('/usr/local/bin/rabbitmqadmin --help') do
-      its(:exit_status) { should eq 0 }
-    end
-
-  end
-
-end
diff --git a/3rdparty/modules/rabbitmq/spec/classes/coverage_spec.rb b/3rdparty/modules/rabbitmq/spec/classes/coverage_spec.rb
new file mode 100644 (file)
index 0000000..de44654
--- /dev/null
@@ -0,0 +1,4 @@
+require 'rspec-puppet'
+
+at_exit { RSpec::Puppet::Coverage.report! }
+# vim: syntax=ruby
index 675a875..4c2a5be 100644 (file)
 require 'spec_helper'
 
 describe 'rabbitmq' do
-
   context 'on unsupported distributions' do
-    let(:facts) {{ :osfamily => 'Unsupported' }}
-
-    it 'we fail' do
-      expect { catalogue }.to raise_error(Puppet::Error, /not supported on an Unsupported/)
-    end
-  end
-
-  context 'on Debian' do
-    let(:facts) {{ :osfamily => 'Debian', :lsbdistid => 'Debian', :lsbdistcodename => 'squeeze' }}
-    it 'includes rabbitmq::repo::apt' do
-      should contain_class('rabbitmq::repo::apt')
-    end
-
-    describe 'apt::source default values' do
-      it 'should add a repo with defaults values' do
-        should contain_apt__source('rabbitmq').with( {
-          :ensure   => 'present',
-          :location => 'http://www.rabbitmq.com/debian/',
-          :release  => 'testing',
-          :repos    => 'main',
-        })
-      end
-    end
-  end
-
-  context 'on Debian' do
-    let(:params) {{ :manage_repos => false }}
-    let(:facts) {{ :osfamily => 'Debian', :lsbdistid => 'Debian', :lsbdistcodename => 'squeeze' }}
-    it 'does ensure rabbitmq apt::source is absent when manage_repos is false' do
-      should_not contain_apt__source('rabbitmq')
-    end
-  end
-
-  context 'on Debian' do
-    let(:params) {{ :manage_repos => true }}
-    let(:facts) {{ :osfamily => 'Debian', :lsbdistid => 'Debian', :lsbdistcodename => 'squeeze' }}
-
-    it 'includes rabbitmq::repo::apt' do
-      should contain_class('rabbitmq::repo::apt')
+    let(:facts) do
+      {
+        os: { family: 'Unsupported' }
+      }
     end
 
-    describe 'apt::source default values' do
-      it 'should add a repo with defaults values' do
-        should contain_apt__source('rabbitmq').with( {
-          :ensure   => 'present',
-          :location => 'http://www.rabbitmq.com/debian/',
-          :release  => 'testing',
-          :repos    => 'main',
-        })
-      end
+    it 'we fail' do
+      expect { catalogue }.to raise_error(Puppet::Error, %r{not supported on an Unsupported})
     end
   end
 
-  context 'on Debian' do
-    let(:params) {{ :repos_ensure => false }}
-    let(:facts) {{ :osfamily => 'Debian', :lsbdistid => 'Debian', :lsbdistcodename => 'squeeze' }}
-    it 'does ensure rabbitmq apt::source is absent when repos_ensure is false' do
-      should contain_apt__source('rabbitmq').with(
-        'ensure'  => 'absent'
+  # TODO: get Archlinux & OpenBSD facts from facterdb
+
+  on_supported_os.each do |os, facts|
+    context "on #{os}" do
+      let(:facts) { facts }
+
+      packagename = case facts[:osfamily]
+                    when 'Archlinux'
+                      'rabbitmq'
+                    else
+                      'rabbitmq-server'
+                    end
+      has_systemd = (
+        (facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'].to_i >= 7) ||
+        (facts[:os]['family'] == 'Debian' && facts[:os]['release']['full'] == '16.04') ||
+        (facts[:os]['family'] == 'Archlinux')
       )
-    end
-  end
-
-  context 'on Debian' do
-    let(:params) {{ :repos_ensure => true }}
-    let(:facts) {{ :osfamily => 'Debian', :lsbdistid => 'Debian', :lsbdistcodename => 'squeeze' }}
 
-    it 'includes rabbitmq::repo::apt' do
-      should contain_class('rabbitmq::repo::apt')
-    end
+      it { is_expected.to compile.with_all_deps }
+      it { is_expected.to contain_class('rabbitmq::install') }
+      it { is_expected.to contain_class('rabbitmq::config') }
+      it { is_expected.to contain_class('rabbitmq::service') }
 
-    describe 'apt::source default values' do
-      it 'should add a repo with defaults values' do
-        should contain_apt__source('rabbitmq').with( {
-          :ensure   => 'present',
-          :location => 'http://www.rabbitmq.com/debian/',
-          :release  => 'testing',
-          :repos    => 'main',
-        })
+      it { is_expected.to contain_package(packagename).with_ensure('installed').with_name(packagename) }
+      if facts[:os]['family'] == 'Suse'
+        it { is_expected.to contain_package('rabbitmq-server-plugins') }
       end
-    end
-  end
-
-  context 'on Debian' do
-    let(:params) {{ :manage_repos => true, :repos_ensure => false }}
-    let(:facts) {{ :osfamily => 'Debian', :lsbdistid => 'Debian', :lsbdistcodename => 'squeeze' }}
 
-    it 'includes rabbitmq::repo::apt' do
-      should contain_class('rabbitmq::repo::apt')
-    end
-
-    describe 'apt::source default values' do
-      it 'should add a repo with defaults values' do
-        should contain_apt__source('rabbitmq').with( {
-          :ensure => 'absent',
-        })
+      context 'with default params' do
+        it { is_expected.not_to contain_class('rabbitmq::repo::apt') }
+        it { is_expected.not_to contain_apt__source('rabbitmq') }
+        it { is_expected.not_to contain_class('rabbitmq::repo::rhel') }
+        it { is_expected.not_to contain_yumrepo('rabbitmq') }
       end
-    end
-  end
 
-  context 'on Debian' do
-    let(:params) {{ :manage_repos => true, :repos_ensure => true }}
-    let(:facts) {{ :osfamily => 'Debian', :lsbdistid => 'Debian', :lsbdistcodename => 'squeeze' }}
+      context 'with repos_ensure => true' do
+        let(:params) { { repos_ensure: true } }
 
-    it 'includes rabbitmq::repo::apt' do
-      should contain_class('rabbitmq::repo::apt')
-    end
+        if facts[:os]['family'] == 'Debian'
+          it 'includes rabbitmq::repo::apt' do
+            is_expected.to contain_class('rabbitmq::repo::apt').
+              with_key_source('https://packagecloud.io/gpg.key').
+              with_key_content(nil)
+          end
 
-    describe 'apt::source default values' do
-      it 'should add a repo with defaults values' do
-        should contain_apt__source('rabbitmq').with( {
-          :ensure   => 'present',
-          :location => 'http://www.rabbitmq.com/debian/',
-          :release  => 'testing',
-          :repos    => 'main',
-        })
-      end
-    end
-  end
+          it 'adds a repo with default values' do
+            is_expected.to contain_apt__source('rabbitmq').
+              with_ensure('present').
+              with_location("https://packagecloud.io/rabbitmq/rabbitmq-server/#{facts[:os]['name'].downcase}").
+              with_release(nil).
+              with_repos('main')
+          end
+        else
+          it { is_expected.not_to contain_class('rabbitmq::repo::apt') }
+          it { is_expected.not_to contain_apt__souce('rabbitmq') }
+        end
 
-  context 'on Debian' do
-    let(:params) {{ :manage_repos => false, :repos_ensure => true }}
-    let(:facts) {{ :osfamily => 'Debian', :lsbdistid => 'Debian', :lsbdistcodename => 'squeeze' }}
-    it 'does ensure rabbitmq apt::source is absent when manage_repos is false and repos_ensure is true' do
-      should_not contain_apt__source('rabbitmq')
-    end
-  end
+        if facts[:os]['family'] == 'RedHat'
+          it { is_expected.to contain_class('rabbitmq::repo::rhel') }
 
-  context 'on Debian' do
-    let(:facts) {{ :osfamily => 'Debian', :lsbdistid => 'Debian', :lsbdistcodename => 'squeeze' }}
-    context 'with manage_repos => false and repos_ensure => false' do
-      let(:params) {{ :manage_repos => false, :repos_ensure => false }}
-      it 'does ensure rabbitmq apt::source is absent when manage_repos is false and repos_ensure is false' do
-        should_not contain_apt__source('rabbitmq')
+          it 'the repo should be present, and contain the expected values' do
+            is_expected.to contain_yumrepo('rabbitmq').
+              with_ensure('present').
+              with_baseurl(%r{https://packagecloud.io/rabbitmq/rabbitmq-server/el/\d+/\$basearch$}).
+              with_gpgkey('https://www.rabbitmq.com/rabbitmq-release-signing-key.asc')
+          end
+        else
+          it { is_expected.not_to contain_class('rabbitmq::repo::rhel') }
+          it { is_expected.not_to contain_yumrepo('rabbitmq') }
+        end
       end
-    end
 
-    context 'with file_limit => unlimited' do
-      let(:params) {{ :file_limit => 'unlimited' }}
-      it { should contain_file('/etc/default/rabbitmq-server').with_content(/ulimit -n unlimited/) }
-    end
+      context 'with no pin', if: facts[:os]['family'] == 'Debian' do
+        let(:params) { { repos_ensure: true, package_apt_pin: '' } }
 
-    context 'with file_limit => infinity' do
-      let(:params) {{ :file_limit => 'infinity' }}
-      it { should contain_file('/etc/default/rabbitmq-server').with_content(/ulimit -n infinity/) }
-    end
-
-    context 'with file_limit => -1' do
-      let(:params) {{ :file_limit => -1 }}
-      it { should contain_file('/etc/default/rabbitmq-server').with_content(/ulimit -n -1/) }
-    end
-
-    context 'with file_limit => \'1234\'' do
-      let(:params) {{ :file_limit => '1234' }}
-      it { should contain_file('/etc/default/rabbitmq-server').with_content(/ulimit -n 1234/) }
-    end
-
-    context 'with file_limit => foo' do
-      let(:params) {{ :file_limit => 'foo' }}
-      it 'does not compile' do
-        expect { catalogue }.to raise_error(Puppet::Error, /\$file_limit must be an integer, 'unlimited', or 'infinity'/)
+        describe 'it sets up an apt::source' do
+          it {
+            is_expected.to contain_apt__source('rabbitmq').with(
+              'location'    => "https://packagecloud.io/rabbitmq/rabbitmq-server/#{facts[:os]['name'].downcase}",
+              'repos'       => 'main',
+              'key'         => '{"id"=>"418A7F2FB0E1E6E7EABF6FE8C2E73424D59097AB", "source"=>"https://packagecloud.io/gpg.key", "content"=>:undef}'
+            )
+          }
+        end
       end
-    end
-  end
 
-  context 'on Redhat' do
-    let(:facts) {{ :osfamily => 'RedHat' }}
-    it 'includes rabbitmq::repo::rhel' do
-      should contain_class('rabbitmq::repo::rhel')
-      should contain_exec('rpm --import http://www.rabbitmq.com/rabbitmq-signing-key-public.asc')
-    end
-  end
+      context 'with pin', if: facts[:os]['family'] == 'Debian' do
+        let(:params) { { repos_ensure: true, package_apt_pin: '700' } }
 
-  context 'on Redhat' do
-    let(:params) {{ :repos_ensure => false }}
-    let(:facts) {{ :osfamily => 'RedHat' }}
-    it 'does not import repo public key when repos_ensure is false' do
-      should contain_class('rabbitmq::repo::rhel')
-      should_not contain_exec('rpm --import http://www.rabbitmq.com/rabbitmq-signing-key-public.asc')
-    end
-  end
+        describe 'it sets up an apt::source and pin' do
+          it {
+            is_expected.to contain_apt__source('rabbitmq').with(
+              'location'    => "https://packagecloud.io/rabbitmq/rabbitmq-server/#{facts[:os]['name'].downcase}",
+              'repos'       => 'main',
+              'key'         => '{"id"=>"418A7F2FB0E1E6E7EABF6FE8C2E73424D59097AB", "source"=>"https://packagecloud.io/gpg.key", "content"=>:undef}'
+            )
+          }
 
-  context 'on Redhat' do
-    let(:params) {{ :repos_ensure => true }}
-    let(:facts) {{ :osfamily => 'RedHat' }}
-    it 'does import repo public key when repos_ensure is true' do
-      should contain_class('rabbitmq::repo::rhel')
-      should contain_exec('rpm --import http://www.rabbitmq.com/rabbitmq-signing-key-public.asc')
-    end
-  end
+          it {
+            is_expected.to contain_apt__pin('rabbitmq').with(
+              'packages' => '*',
+              'priority' => '700',
+              'origin'   => 'packagecloud.io'
+            )
+          }
+        end
+      end
 
-  context 'on Redhat' do
-    let(:params) {{ :manage_repos => false }}
-    let(:facts) {{ :osfamily => 'RedHat' }}
-    it 'does not import repo public key when manage_repos is false' do
-      should_not contain_class('rabbitmq::repo::rhel')
-      should_not contain_exec('rpm --import http://www.rabbitmq.com/rabbitmq-signing-key-public.asc')
-    end
-  end
+      ['unlimited', 'infinity', -1, 1234].each do |value|
+        context "with file_limit => '#{value}'" do
+          let(:params) { { file_limit: value } }
+
+          if facts[:os]['family'] == 'RedHat'
+            it do
+              is_expected.to contain_file('/etc/security/limits.d/rabbitmq-server.conf').
+                with_owner('0').
+                with_group('0').
+                with_mode('0644').
+                that_notifies('Class[Rabbitmq::Service]').
+                with_content("rabbitmq soft nofile #{value}\nrabbitmq hard nofile #{value}\n")
+            end
+          else
+            it { is_expected.not_to contain_file('/etc/security/limits.d/rabbitmq-server.conf') }
+          end
 
-  context 'on Redhat' do
-    let(:params) {{ :manage_repos => true }}
-    let(:facts) {{ :osfamily => 'RedHat' }}
-    it 'does import repo public key when manage_repos is true' do
-      should contain_class('rabbitmq::repo::rhel')
-      should contain_exec('rpm --import http://www.rabbitmq.com/rabbitmq-signing-key-public.asc')
-    end
-  end
+          if facts[:os]['family'] == 'Debian'
+            it { is_expected.to contain_file('/etc/default/rabbitmq-server').with_content(%r{ulimit -n #{value}}) }
+          else
+            it { is_expected.not_to contain_file('/etc/default/rabbitmq-server') }
+          end
 
-  context 'on Redhat' do
-    let(:params) {{ :manage_repos => false, :repos_ensure => true }}
-    let(:facts) {{ :osfamily => 'RedHat' }}
-    it 'does not import repo public key when manage_repos is false and repos_ensure is true' do
-      should_not contain_class('rabbitmq::repo::rhel')
-      should_not contain_exec('rpm --import http://www.rabbitmq.com/rabbitmq-signing-key-public.asc')
-    end
-  end
+          if has_systemd
+            it do
+              is_expected.to contain_file("/etc/systemd/system/#{packagename}.service.d/limits.conf").
+                with_owner('0').
+                with_group('0').
+                with_mode('0644').
+                that_notifies('Exec[rabbitmq-systemd-reload]').
+                with_content("[Service]\nLimitNOFILE=#{value}\n")
+            end
+          else
+            it { is_expected.not_to contain_file('/etc/systemd/system/rabbitmq-server.service.d/limits.conf') }
+          end
+        end
+      end
 
-  context 'on Redhat' do
-    let(:params) {{ :manage_repos => true, :repos_ensure => true }}
-    let(:facts) {{ :osfamily => 'RedHat' }}
-    it 'does import repo public key when manage_repos is true and repos_ensure is true' do
-      should contain_class('rabbitmq::repo::rhel')
-      should contain_exec('rpm --import http://www.rabbitmq.com/rabbitmq-signing-key-public.asc')
-    end
-  end
+      [-42, '-42', 'foo', '42'].each do |value|
+        context "with file_limit => '#{value}'" do
+          let(:params) { { file_limit: value } }
 
-  context 'on Redhat' do
-    let(:params) {{ :manage_repos => false, :repos_ensure => false }}
-    let(:facts) {{ :osfamily => 'RedHat' }}
-    it 'does not import repo public key when manage_repos is false and repos_ensure is false' do
-      should_not contain_class('rabbitmq::repo::rhel')
-      should_not contain_exec('rpm --import http://www.rabbitmq.com/rabbitmq-signing-key-public.asc')
-    end
-  end
+          it 'does not compile' do
+            expect { catalogue }.to raise_error(Puppet::PreformattedError, %r{Error while evaluating a Resource Statement})
+          end
+        end
+      end
 
-  context 'on Redhat' do
-    let(:params) {{ :manage_repos => true, :repos_ensure => false }}
-    let(:facts) {{ :osfamily => 'RedHat' }}
-    it 'does not import repo public key when manage_repos is true and repos_ensure is false' do
-      should contain_class('rabbitmq::repo::rhel')
-      should_not contain_exec('rpm --import http://www.rabbitmq.com/rabbitmq-signing-key-public.asc')
-    end
-  end
+      context 'on systems with systemd', if: has_systemd do
+        it {
+          is_expected.to contain_file("/etc/systemd/system/#{packagename}.service.d").with(
+            'ensure'                  => 'directory',
+            'owner'                   => '0',
+            'group'                   => '0',
+            'mode'                    => '0755',
+            'selinux_ignore_defaults' => true
+          )
+        }
 
-  context 'on RedHat 7.0 or more' do
-    let(:facts) {{ :osfamily => 'RedHat', :operatingsystemmajrelease => '7' }}
-
-    it { should contain_file('/etc/systemd/system/rabbitmq-server.service.d').with(
-      'ensure'                  => 'directory',
-      'owner'                   => '0',
-      'group'                   => '0',
-      'mode'                    => '0755',
-      'selinux_ignore_defaults' => true
-    ) }
-
-    it { should contain_exec('rabbitmq-systemd-reload').with(
-      'command'     => '/usr/bin/systemctl daemon-reload',
-      'notify'      => 'Class[Rabbitmq::Service]',
-      'refreshonly' => true
-    ) }
-    context 'with file_limit => unlimited' do
-      let(:params) {{ :file_limit => 'unlimited' }}
-      it { should contain_file('/etc/systemd/system/rabbitmq-server.service.d/limits.conf').with(
-        'owner'   => '0',
-        'group'   => '0',
-        'mode'    => '0644',
-        'notify'  => 'Exec[rabbitmq-systemd-reload]',
-        'content' => '[Service]
-LimitNOFILE=unlimited
-'
-      ) }
-    end
+        it { is_expected.to contain_file("/etc/systemd/system/#{packagename}.service.d/limits.conf") }
 
-    context 'with file_limit => infinity' do
-      let(:params) {{ :file_limit => 'infinity' }}
-      it { should contain_file('/etc/systemd/system/rabbitmq-server.service.d/limits.conf').with(
-        'owner'   => '0',
-        'group'   => '0',
-        'mode'    => '0644',
-        'notify'  => 'Exec[rabbitmq-systemd-reload]',
-        'content' => '[Service]
-LimitNOFILE=infinity
-'
-      ) }
-    end
+        it {
+          is_expected.to contain_exec('rabbitmq-systemd-reload').with(
+            command: '/bin/systemctl daemon-reload',
+            notify: 'Class[Rabbitmq::Service]',
+            refreshonly: true
+          )
+        }
+      end
 
-    context 'with file_limit => -1' do
-      let(:params) {{ :file_limit => -1 }}
-      it { should contain_file('/etc/systemd/system/rabbitmq-server.service.d/limits.conf').with(
-        'owner'   => '0',
-        'group'   => '0',
-        'mode'    => '0644',
-        'notify'  => 'Exec[rabbitmq-systemd-reload]',
-        'content' => '[Service]
-LimitNOFILE=-1
-'
-      ) }
-    end
+      context 'on systems without systemd', unless: has_systemd do
+        it { is_expected.not_to contain_file('/etc/systemd/system/rabbitmq-server.service.d') }
+        it { is_expected.not_to contain_file('/etc/systemd/system/rabbitmq-server.service.d/limits.conf') }
+        it { is_expected.not_to contain_exec('rabbitmq-systemd-reload') }
+      end
 
-    context 'with file_limit => \'1234\'' do
-      let(:params) {{ :file_limit => '1234' }}
-      it { should contain_file('/etc/systemd/system/rabbitmq-server.service.d/limits.conf').with(
-        'owner'   => '0',
-        'group'   => '0',
-        'mode'    => '0644',
-        'notify'  => 'Exec[rabbitmq-systemd-reload]',
-        'content' => '[Service]
-LimitNOFILE=1234
-'
-      ) }
-    end
+      context 'with admin_enable set to true' do
+        let(:params) { { admin_enable: true, management_ip_address: '1.1.1.1' } }
 
-    context 'with file_limit => foo' do
-      let(:params) {{ :file_limit => 'foo' }}
-      it 'does not compile' do
-        expect { catalogue }.to raise_error(Puppet::Error, /\$file_limit must be an integer, 'unlimited', or 'infinity'/)
-      end
-    end
-  end
+        context 'with service_manage set to true' do
+          let(:params) { { admin_enable: true, management_ip_address: '1.1.1.1', service_manage: true } }
 
-  context 'on RedHat before 7.0' do
-    let(:facts) {{ :osfamily => 'RedHat', :operatingsystemmajrelease => '6' }}
-
-    context 'with file_limit => unlimited' do
-      let(:params) {{ :file_limit => 'unlimited' }}
-      it { should contain_file('/etc/security/limits.d/rabbitmq-server.conf').with(
-        'owner'   => '0',
-        'group'   => '0',
-        'mode'    => '0644',
-        'notify'  => 'Class[Rabbitmq::Service]',
-        'content' => 'rabbitmq soft nofile unlimited
-rabbitmq hard nofile unlimited
-'
-      ) }
-    end
+          context 'with rabbitmqadmin_package set to blub' do
+            let(:params) { { rabbitmqadmin_package: 'blub' } }
 
-    context 'with file_limit => infinity' do
-      let(:params) {{ :file_limit => 'infinity' }}
-      it { should contain_file('/etc/security/limits.d/rabbitmq-server.conf').with(
-        'owner'   => '0',
-        'group'   => '0',
-        'mode'    => '0644',
-        'notify'  => 'Class[Rabbitmq::Service]',
-        'content' => 'rabbitmq soft nofile infinity
-rabbitmq hard nofile infinity
-'
-      ) }
-    end
+            it 'installs a package called blub' do
+              is_expected.to contain_package('rabbitmqadmin').with_name('blub')
+            end
+          end
+          if facts[:os]['family'] == 'Archlinux'
+            it 'installs a package called rabbitmqadmin' do
+              is_expected.to contain_package('rabbitmqadmin').with_name('rabbitmqadmin')
+            end
+          else
+            it 'we enable the admin interface by default' do
+              is_expected.to contain_class('rabbitmq::install::rabbitmqadmin')
+              is_expected.to contain_rabbitmq_plugin('rabbitmq_management').with(
+                notify: 'Class[Rabbitmq::Service]'
+              )
+              is_expected.to contain_archive('rabbitmqadmin').with_source('http://1.1.1.1:15672/cli/rabbitmqadmin')
+            end
+          end
+          if %w[RedHat Debian SUSE].include?(facts[:os]['family'])
+            it { is_expected.to contain_package('python') }
+          end
+          if %w[FreeBSD OpenBSD].include?(facts[:os]['family'])
+            it { is_expected.to contain_package('python2') }
+          end
+        end
+        context 'with manage_python false' do
+          let(:params) { { manage_python: false } }
 
-    context 'with file_limit => -1' do
-      let(:params) {{ :file_limit => -1 }}
-      it { should contain_file('/etc/security/limits.d/rabbitmq-server.conf').with(
-        'owner'   => '0',
-        'group'   => '0',
-        'mode'    => '0644',
-        'notify'  => 'Class[Rabbitmq::Service]',
-        'content' => 'rabbitmq soft nofile -1
-rabbitmq hard nofile -1
-'
-      ) }
-    end
+          it do
+            is_expected.to contain_class('rabbitmq::install::rabbitmqadmin')
+            is_expected.not_to contain_package('python')
+            is_expected.not_to contain_package('python2')
+          end
+        end
 
-    context 'with file_limit => \'1234\'' do
-      let(:params) {{ :file_limit => '1234' }}
-      it { should contain_file('/etc/security/limits.d/rabbitmq-server.conf').with(
-        'owner'   => '0',
-        'group'   => '0',
-        'mode'    => '0644',
-        'notify'  => 'Class[Rabbitmq::Service]',
-        'content' => 'rabbitmq soft nofile 1234
-rabbitmq hard nofile 1234
-'
-      ) }
-    end
+        context 'with $management_ip_address undef and service_manage set to true', unless: facts[:osfamily] == 'Archlinux' do
+          let(:params) { { admin_enable: true, management_ip_address: :undef } }
 
-    context 'with file_limit => foo' do
-      let(:params) {{ :file_limit => 'foo' }}
-      it 'does not compile' do
-        expect { catalogue }.to raise_error(Puppet::Error, /\$file_limit must be an integer, 'unlimited', or 'infinity'/)
-      end
-    end
-  end
+          it 'we enable the admin interface by default' do
+            is_expected.to contain_class('rabbitmq::install::rabbitmqadmin')
+            is_expected.to contain_rabbitmq_plugin('rabbitmq_management').with(
+              notify: 'Class[Rabbitmq::Service]'
+            )
+            is_expected.to contain_archive('rabbitmqadmin').with_source('http://127.0.0.1:15672/cli/rabbitmqadmin')
+          end
+        end
+        context 'with service_manage set to true, node_ip_address = undef, and default user/pass specified', unless: facts[:osfamily] == 'Archlinux' do
+          let(:params) { { admin_enable: true, default_user: 'foobar', default_pass: 'hunter2', node_ip_address: :undef } }
 
-  ['Debian', 'RedHat', 'SUSE', 'Archlinux'].each do |distro|
-    context "on #{distro}" do
-      let(:facts) {{
-        :osfamily => distro,
-        :lsbdistcodename => 'squeeze',
-        :lsbdistid => 'Debian'
-      }}
+          it 'we use the correct URL to rabbitmqadmin' do
+            is_expected.to contain_archive('rabbitmqadmin').with(
+              source: 'http://127.0.0.1:15672/cli/rabbitmqadmin',
+              username: 'foobar',
+              password: 'hunter2'
+            )
+          end
+        end
+        context 'with service_manage set to true and default user/pass specified', unless: facts[:osfamily] == 'Archlinux' do
+          let(:params) { { admin_enable: true, default_user: 'foobar', default_pass: 'hunter2', management_ip_address: '1.1.1.1' } }
 
-      it { should contain_class('rabbitmq::install') }
-      it { should contain_class('rabbitmq::config') }
-      it { should contain_class('rabbitmq::service') }
+          it 'we use the correct URL to rabbitmqadmin' do
+            is_expected.to contain_archive('rabbitmqadmin').with(
+              source: 'http://1.1.1.1:15672/cli/rabbitmqadmin',
+              username: 'foobar',
+              password: 'hunter2'
+            )
+          end
+        end
+        context 'with service_manage set to true and archive_options set', unless: facts[:osfamily] == 'Archlinux' do
+          let(:params) do
+            {
+              admin_enable: true,
+              management_ip_address: '1.1.1.1',
+              archive_options: %w[fizz pop]
+            }
+          end
 
-     context 'with admin_enable set to true' do
-        let(:params) {{ :admin_enable => true }}
-        context 'with service_manage set to true' do
-          it 'we enable the admin interface by default' do
-            should contain_class('rabbitmq::install::rabbitmqadmin')
-            should contain_rabbitmq_plugin('rabbitmq_management').with(
-              'require' => 'Class[Rabbitmq::Install]',
-              'notify'  => 'Class[Rabbitmq::Service]'
+          it 'we use the correct archive_options to rabbitmqadmin' do
+            is_expected.to contain_archive('rabbitmqadmin').with(
+              source: 'http://1.1.1.1:15672/cli/rabbitmqadmin',
+              download_options: %w[fizz pop]
             )
-            should contain_staging__file('rabbitmqadmin').with_source("http://guest:guest@localhost:15672/cli/rabbitmqadmin")
           end
         end
-        context 'with service_manage set to true and default user/pass specified' do
-          let(:params) {{ :admin_enable => true, :default_user => 'foobar', :default_pass => 'hunter2' }}
+        context 'with service_manage set to true and management port specified', unless: facts[:osfamily] == 'Archlinux' do
+          # note that the 2.x management port is 55672 not 15672
+          let(:params) { { admin_enable: true, management_port: 55_672, management_ip_address: '1.1.1.1' } }
+
           it 'we use the correct URL to rabbitmqadmin' do
-            should contain_staging__file('rabbitmqadmin').with_source("http://foobar:hunter2@localhost:15672/cli/rabbitmqadmin")
+            is_expected.to contain_archive('rabbitmqadmin').with(
+              source: 'http://1.1.1.1:55672/cli/rabbitmqadmin',
+              username: 'guest',
+              password: 'guest'
+            )
           end
         end
-        context 'with service_manage set to true and management port specified' do
+        context 'with ipv6, service_manage set to true and management port specified', unless: facts[:osfamily] == 'Archlinux' do
           # note that the 2.x management port is 55672 not 15672
-          let(:params) {{ :admin_enable => true, :management_port => '55672' }}
+          let(:params) { { admin_enable: true, management_port: 55_672, management_ip_address: '::1' } }
+
           it 'we use the correct URL to rabbitmqadmin' do
-            should contain_staging__file('rabbitmqadmin').with_source("http://guest:guest@localhost:55672/cli/rabbitmqadmin")
+            is_expected.to contain_archive('rabbitmqadmin').with(
+              source: 'http://[::1]:55672/cli/rabbitmqadmin',
+              username: 'guest',
+              password: 'guest'
+            )
           end
         end
         context 'with service_manage set to false' do
-          let(:params) {{ :admin_enable => true, :service_manage => false }}
-          it 'should do nothing' do
-            should_not contain_class('rabbitmq::install::rabbitmqadmin')
-            should_not contain_rabbitmq_plugin('rabbitmq_management')
+          let(:params) { { admin_enable: true, service_manage: false } }
+
+          it 'does nothing' do
+            is_expected.not_to contain_class('rabbitmq::install::rabbitmqadmin')
+            is_expected.not_to contain_rabbitmq_plugin('rabbitmq_management')
           end
         end
       end
 
       describe 'manages configuration directory correctly' do
-        it { should contain_file('/etc/rabbitmq').with(
-          'ensure' => 'directory'
-        )}
+        it {
+          is_expected.to contain_file('/etc/rabbitmq').with(
+            'ensure' => 'directory',
+            'mode'   => '0755'
+          )
+        }
       end
 
       describe 'manages configuration file correctly' do
-        it { should contain_file('rabbitmq.config') }
+        it {
+          is_expected.to contain_file('rabbitmq.config').with(
+            'owner' => '0',
+            'group' => 'rabbitmq',
+            'mode'  => '0640'
+          )
+        }
+      end
+
+      describe 'does not contain pre-ranch settings with default config' do
+        it do
+          is_expected.to contain_file('rabbitmq.config'). \
+            without_content(%r{binary,}).                 \
+            without_content(%r{\{packet,        raw\},}). \
+            without_content(%r{\{reuseaddr,     true\},})
+        end
+      end
+
+      describe 'contains pre-ranch settings with config_ranch set to false' do
+        let(:params) { { config_ranch: false } }
+
+        it do
+          is_expected.to contain_file('rabbitmq.config'). \
+            with_content(%r{binary,}).                 \
+            with_content(%r{\{packet,        raw\},}). \
+            with_content(%r{\{reuseaddr,     true\},})
+        end
       end
 
       context 'configures config_cluster' do
-        let(:facts) {{ :osfamily => distro, :lsbdistid => 'Debian' }}
-        let(:params) {{
-          :config_cluster           => true,
-          :cluster_nodes            => ['hare-1', 'hare-2'],
-          :cluster_node_type        => 'ram',
-          :wipe_db_on_cookie_change => false
-        }}
-
-        describe 'with defaults' do
-          it 'fails' do
-            expect { catalogue }.to raise_error(Puppet::Error, /You must set the \$erlang_cookie value/)
-          end
+        let(:params) do
+          {
+            config_cluster: true,
+            cluster_nodes: ['hare-1', 'hare-2'],
+            cluster_node_type: 'ram',
+            wipe_db_on_cookie_change: false
+          }
         end
 
         describe 'with erlang_cookie set' do
-          let(:params) {{
-            :config_cluster           => true,
-            :cluster_nodes            => ['hare-1', 'hare-2'],
-            :cluster_node_type        => 'ram',
-            :erlang_cookie            => 'TESTCOOKIE',
-            :wipe_db_on_cookie_change => true
-          }}
+          let(:params) do
+            {
+              config_cluster: true,
+              cluster_nodes: ['hare-1', 'hare-2'],
+              cluster_node_type: 'ram',
+              erlang_cookie: 'TESTCOOKIE',
+              wipe_db_on_cookie_change: true
+            }
+          end
+
+          it 'contains the rabbitmq_erlang_cookie' do
+            is_expected.to contain_rabbitmq_erlang_cookie('/var/lib/rabbitmq/.erlang.cookie')
+          end
+        end
+
+        describe 'with erlang_cookie set but without config_cluster' do
+          let(:params) do
+            {
+              config_cluster: false,
+              erlang_cookie: 'TESTCOOKIE'
+            }
+          end
+
           it 'contains the rabbitmq_erlang_cookie' do
-            should contain_rabbitmq_erlang_cookie('/var/lib/rabbitmq/.erlang.cookie')
+            is_expected.to contain_rabbitmq_erlang_cookie('/var/lib/rabbitmq/.erlang.cookie')
+          end
+        end
+
+        describe 'without erlang_cookie and without config_cluster' do
+          let(:params) do
+            {
+              config_cluster: false
+            }
+          end
+
+          it 'contains the rabbitmq_erlang_cookie' do
+            is_expected.not_to contain_rabbitmq_erlang_cookie('/var/lib/rabbitmq/.erlang.cookie')
           end
         end
 
         describe 'and sets appropriate configuration' do
-          let(:params) {{
-            :config_cluster           => true,
-            :cluster_nodes            => ['hare-1', 'hare-2'],
-            :cluster_node_type        => 'ram',
-            :erlang_cookie            => 'ORIGINAL',
-            :wipe_db_on_cookie_change => true
-          }}
-          it 'for cluster_nodes' do
-            should contain_file('rabbitmq.config').with({
-              'content' => /cluster_nodes.*\['rabbit@hare-1', 'rabbit@hare-2'\], ram/,
-            })
+          let(:params) do
+            {
+              config_cluster: true,
+              cluster_nodes: ['hare-1', 'hare-2'],
+              cluster_node_type: 'ram',
+              erlang_cookie: 'ORIGINAL',
+              wipe_db_on_cookie_change: true
+            }
           end
 
+          it 'for cluster_nodes' do
+            is_expected.to contain_file('rabbitmq.config').with('content' => %r{cluster_nodes.*\['rabbit@hare-1', 'rabbit@hare-2'\], ram})
+          end
         end
       end
 
       describe 'rabbitmq-env configuration' do
-        let(:params) {{ :environment_variables => {
-          'NODE_IP_ADDRESS'    => '1.1.1.1',
-          'NODE_PORT'          => '5656',
-          'NODENAME'           => 'HOSTNAME',
-          'SERVICENAME'        => 'RabbitMQ',
-          'CONSOLE_LOG'        => 'RabbitMQ.debug',
-          'CTL_ERL_ARGS'       => 'verbose',
-          'SERVER_ERL_ARGS'    => 'v',
-          'SERVER_START_ARGS'  => 'debug'
-        }}}
-        it 'should set environment variables' do
-          should contain_file('rabbitmq-env.config') \
-            .with_content(/NODE_IP_ADDRESS=1.1.1.1/) \
-            .with_content(/NODE_PORT=5656/) \
-            .with_content(/NODENAME=HOSTNAME/) \
-            .with_content(/SERVICENAME=RabbitMQ/) \
-            .with_content(/CONSOLE_LOG=RabbitMQ.debug/) \
-            .with_content(/CTL_ERL_ARGS=verbose/) \
-            .with_content(/SERVER_ERL_ARGS=v/) \
-            .with_content(/SERVER_START_ARGS=debug/)
+        context 'with default params' do
+          it 'sets environment variables' do
+            is_expected.to contain_file('rabbitmq-env.config'). \
+              with_content(%r{ERL_INETRC=/etc/rabbitmq/inetrc})
+          end
+        end
+
+        context 'with environment_variables set' do
+          let(:params) do
+            { environment_variables: {
+              'NODE_IP_ADDRESS' => '1.1.1.1',
+              'NODE_PORT'          => '5656',
+              'NODENAME'           => 'HOSTNAME',
+              'SERVICENAME'        => 'RabbitMQ',
+              'CONSOLE_LOG'        => 'RabbitMQ.debug',
+              'CTL_ERL_ARGS'       => 'verbose',
+              'SERVER_ERL_ARGS'    => 'v',
+              'SERVER_START_ARGS'  => 'debug'
+            } }
+          end
+
+          it 'sets environment variables' do
+            is_expected.to contain_file('rabbitmq-env.config'). \
+              with_content(%r{NODE_IP_ADDRESS=1.1.1.1}). \
+              with_content(%r{NODE_PORT=5656}). \
+              with_content(%r{NODENAME=HOSTNAME}). \
+              with_content(%r{SERVICENAME=RabbitMQ}). \
+              with_content(%r{CONSOLE_LOG=RabbitMQ.debug}). \
+              with_content(%r{CTL_ERL_ARGS=verbose}). \
+              with_content(%r{SERVER_ERL_ARGS=v}). \
+              with_content(%r{SERVER_START_ARGS=debug})
+          end
         end
       end
 
       context 'delete_guest_user' do
         describe 'should do nothing by default' do
-          it { should_not contain_rabbitmq_user('guest') }
+          it { is_expected.not_to contain_rabbitmq_user('guest') }
         end
 
         describe 'delete user when delete_guest_user set' do
-          let(:params) {{ :delete_guest_user => true }}
+          let(:params) { { delete_guest_user: true } }
+
           it 'removes the user' do
-            should contain_rabbitmq_user('guest').with(
+            is_expected.to contain_rabbitmq_user('guest').with(
               'ensure'   => 'absent',
               'provider' => 'rabbitmqctl'
             )
@@ -530,431 +485,925 @@ rabbitmq hard nofile 1234
 
       context 'configuration setting' do
         describe 'node_ip_address when set' do
-          let(:params) {{ :node_ip_address => '172.0.0.1' }}
-          it 'should set NODE_IP_ADDRESS to specified value' do
-            should contain_file('rabbitmq-env.config').
+          let(:params) { { node_ip_address: '172.0.0.1' } }
+
+          it 'sets NODE_IP_ADDRESS to specified value' do
+            is_expected.to contain_file('rabbitmq-env.config').
               with_content(%r{NODE_IP_ADDRESS=172\.0\.0\.1})
           end
         end
 
         describe 'stomp by default' do
-          it 'should not specify stomp parameters in rabbitmq.config' do
-            should contain_file('rabbitmq.config').without({
-              'content' => /stomp/,})
+          it 'does not specify stomp parameters in rabbitmq.config' do
+            is_expected.to contain_file('rabbitmq.config').without('content' => %r{stomp})
           end
         end
         describe 'stomp when set' do
-          let(:params) {{ :config_stomp => true, :stomp_port => 5679 }}
-          it 'should specify stomp port in rabbitmq.config' do
-            should contain_file('rabbitmq.config').with({
-              'content' => /rabbitmq_stomp.*tcp_listeners, \[5679\]/m,
-            })
+          let(:params) { { config_stomp: true, stomp_port: 5679 } }
+
+          it 'specifies stomp port in rabbitmq.config' do
+            is_expected.to contain_file('rabbitmq.config').with('content' => %r{rabbitmq_stomp.*tcp_listeners, \[5679\]}m)
           end
         end
         describe 'stomp when set ssl port w/o ssl enabled' do
-          let(:params) {{ :config_stomp => true, :stomp_port => 5679, :ssl => false, :ssl_stomp_port => 5680 }}
-          it 'should not configure ssl_listeners in rabbitmq.config' do
-            should contain_file('rabbitmq.config').without({
-              'content' => /rabbitmq_stomp.*ssl_listeners, \[5680\]/m,
-            })
+          let(:params) { { config_stomp: true, stomp_port: 5679, ssl: false, ssl_stomp_port: 5680 } }
+
+          it 'does not configure ssl_listeners in rabbitmq.config' do
+            is_expected.to contain_file('rabbitmq.config').without('content' => %r{rabbitmq_stomp.*ssl_listeners, \[5680\]}m)
           end
         end
         describe 'stomp when set with ssl' do
-          let(:params) {{ :config_stomp => true, :stomp_port => 5679, :ssl => true, :ssl_stomp_port => 5680 }}
-          it 'should specify stomp port and ssl stomp port in rabbitmq.config' do
-            should contain_file('rabbitmq.config').with({
-              'content' => /rabbitmq_stomp.*tcp_listeners, \[5679\].*ssl_listeners, \[5680\]/m,
-            })
+          let(:params) { { config_stomp: true, stomp_port: 5679, ssl: true, ssl_stomp_port: 5680 } }
+
+          it 'specifies stomp port and ssl stomp port in rabbitmq.config' do
+            is_expected.to contain_file('rabbitmq.config').with('content' => %r{rabbitmq_stomp.*tcp_listeners, \[5679\].*ssl_listeners, \[5680\]}m)
           end
         end
       end
 
       describe 'configuring ldap authentication' do
         let :params do
-          { :config_stomp          => true,
-            :ldap_auth             => true,
-            :ldap_server           => 'ldap.example.com',
-            :ldap_user_dn_pattern  => 'ou=users,dc=example,dc=com',
-            :ldap_other_bind       => 'as_user',
-            :ldap_use_ssl          => false,
-            :ldap_port             => '389',
-            :ldap_log              => true,
-            :ldap_config_variables => { 'foo' => 'bar' }
-          }
+          { config_stomp: true,
+            ldap_auth: true,
+            ldap_server: 'ldap.example.com',
+            ldap_user_dn_pattern: 'ou=users,dc=example,dc=com',
+            ldap_other_bind: 'as_user',
+            ldap_use_ssl: false,
+            ldap_port: 389,
+            ldap_log: true,
+            ldap_config_variables: { 'foo' => 'bar' } }
         end
 
-        it { should contain_rabbitmq_plugin('rabbitmq_auth_backend_ldap') }
+        it { is_expected.to contain_rabbitmq_plugin('rabbitmq_auth_backend_ldap') }
 
-        it 'should contain ldap parameters' do
+        it 'contains ldap parameters' do
           verify_contents(catalogue, 'rabbitmq.config',
                           ['[', '  {rabbit, [', '    {auth_backends, [rabbit_auth_backend_internal, rabbit_auth_backend_ldap]},', '  ]}',
-                            '  {rabbitmq_auth_backend_ldap, [', '    {other_bind, as_user},',
-                            '    {servers, ["ldap.example.com"]},',
-                            '    {user_dn_pattern, "ou=users,dc=example,dc=com"},', '    {use_ssl, false},',
-                            '    {port, 389},', '    {foo, bar},', '    {log, true}'])
+                           '  {rabbitmq_auth_backend_ldap, [', '    {other_bind, as_user},',
+                           '    {servers, ["ldap.example.com"]},',
+                           '    {user_dn_pattern, "ou=users,dc=example,dc=com"},', '    {use_ssl, false},',
+                           '    {port, 389},', '    {foo, bar},', '    {log, true}'])
         end
       end
 
       describe 'configuring ldap authentication' do
         let :params do
-          { :config_stomp         => false,
-            :ldap_auth            => true,
-            :ldap_server          => 'ldap.example.com',
-            :ldap_user_dn_pattern => 'ou=users,dc=example,dc=com',
-            :ldap_other_bind      => 'as_user',
-            :ldap_use_ssl         => false,
-            :ldap_port            => '389',
-            :ldap_log             => true,
-            :ldap_config_variables => { 'foo' => 'bar' }
-          }
+          { config_stomp: false,
+            ldap_auth: true,
+            ldap_server: 'ldap.example.com',
+            ldap_user_dn_pattern: 'ou=users,dc=example,dc=com',
+            ldap_other_bind: 'as_user',
+            ldap_use_ssl: false,
+            ldap_port: 389,
+            ldap_log: true,
+            ldap_config_variables: { 'foo' => 'bar' } }
         end
 
-        it { should contain_rabbitmq_plugin('rabbitmq_auth_backend_ldap') }
+        it { is_expected.to contain_rabbitmq_plugin('rabbitmq_auth_backend_ldap') }
 
-        it 'should contain ldap parameters' do
+        it 'contains ldap parameters' do
           verify_contents(catalogue, 'rabbitmq.config',
                           ['[', '  {rabbit, [', '    {auth_backends, [rabbit_auth_backend_internal, rabbit_auth_backend_ldap]},', '  ]}',
-                            '  {rabbitmq_auth_backend_ldap, [', '    {other_bind, as_user},',
-                            '    {servers, ["ldap.example.com"]},',
-                            '    {user_dn_pattern, "ou=users,dc=example,dc=com"},', '    {use_ssl, false},',
-                            '    {port, 389},', '    {foo, bar},', '    {log, true}'])
+                           '  {rabbitmq_auth_backend_ldap, [', '    {other_bind, as_user},',
+                           '    {servers, ["ldap.example.com"]},',
+                           '    {user_dn_pattern, "ou=users,dc=example,dc=com"},', '    {use_ssl, false},',
+                           '    {port, 389},', '    {foo, bar},', '    {log, true}'])
+        end
+      end
+
+      describe 'configuring ldap authentication' do
+        let :params do
+          { config_stomp: false,
+            ldap_auth: true,
+            ldap_server: 'ldap.example.com',
+            ldap_other_bind: 'as_user',
+            ldap_use_ssl: false,
+            ldap_port: 389,
+            ldap_log: true,
+            ldap_config_variables: { 'foo' => 'bar' } }
+        end
+
+        it { is_expected.to contain_rabbitmq_plugin('rabbitmq_auth_backend_ldap') }
+
+        it 'does not set user_dn_pattern when none is specified' do
+          verify_contents(catalogue, 'rabbitmq.config',
+                          ['[', '  {rabbit, [', '    {auth_backends, [rabbit_auth_backend_internal, rabbit_auth_backend_ldap]},', '  ]}',
+                           '  {rabbitmq_auth_backend_ldap, [', '    {other_bind, as_user},',
+                           '    {servers, ["ldap.example.com"]},',
+                           '    {use_ssl, false},',
+                           '    {port, 389},', '    {foo, bar},', '    {log, true}'])
+          content = catalogue.resource('file', 'rabbitmq.config').send(:parameters)[:content]
+          expect(content).not_to include 'user_dn_pattern'
+        end
+      end
+
+      describe 'configuring auth_backends' do
+        let :params do
+          { auth_backends: ['{baz, foo}', 'bar'] }
+        end
+
+        it 'contains auth_backends' do
+          verify_contents(catalogue, 'rabbitmq.config',
+                          ['    {auth_backends, [{baz, foo}, bar]},'])
+        end
+      end
+
+      describe 'auth_backends overrides ldap_auth' do
+        let :params do
+          { auth_backends: ['{baz, foo}', 'bar'],
+            ldap_auth: true }
+        end
+
+        it 'contains auth_backends' do
+          verify_contents(catalogue, 'rabbitmq.config',
+                          ['    {auth_backends, [{baz, foo}, bar]},'])
+        end
+      end
+
+      describe 'configuring shovel plugin' do
+        let :params do
+          {
+            config_shovel: true
+          }
+        end
+
+        it { is_expected.to contain_rabbitmq_plugin('rabbitmq_shovel') }
+
+        it { is_expected.to contain_rabbitmq_plugin('rabbitmq_shovel_management') }
+
+        describe 'with admin_enable false' do
+          let :params do
+            {
+              config_shovel: true,
+              admin_enable: false
+            }
+          end
+
+          it { is_expected.not_to contain_rabbitmq_plugin('rabbitmq_shovel_management') }
+        end
+
+        describe 'with static shovels' do
+          let :params do
+            {
+              config_shovel: true,
+              config_shovel_statics: {
+                'shovel_first' => '{sources,[{broker,"amqp://"}]},
+        {destinations,[{broker,"amqp://site1.example.com"}]},
+        {queue,<<"source_one">>}',
+                'shovel_second' => '{sources,[{broker,"amqp://"}]},
+        {destinations,[{broker,"amqp://site2.example.com"}]},
+        {queue,<<"source_two">>}'
+              }
+            }
+          end
+
+          it 'generates correct configuration' do
+            verify_contents(catalogue, 'rabbitmq.config', [
+                              '  {rabbitmq_shovel,',
+                              '    [{shovels,[',
+                              '      {shovel_first,[{sources,[{broker,"amqp://"}]},',
+                              '        {destinations,[{broker,"amqp://site1.example.com"}]},',
+                              '        {queue,<<"source_one">>}]},',
+                              '      {shovel_second,[{sources,[{broker,"amqp://"}]},',
+                              '        {destinations,[{broker,"amqp://site2.example.com"}]},',
+                              '        {queue,<<"source_two">>}]}',
+                              '    ]}]}'
+                            ])
+          end
+        end
+      end
+
+      describe 'configuring shovel plugin' do
+        let :params do
+          {
+            config_shovel: true
+          }
+        end
+
+        it { is_expected.to contain_rabbitmq_plugin('rabbitmq_shovel') }
+
+        it { is_expected.to contain_rabbitmq_plugin('rabbitmq_shovel_management') }
+
+        describe 'with admin_enable false' do
+          let :params do
+            {
+              config_shovel: true,
+              admin_enable: false
+            }
+          end
+
+          it { is_expected.not_to contain_rabbitmq_plugin('rabbitmq_shovel_management') }
+        end
+
+        describe 'with static shovels' do
+          let :params do
+            {
+              config_shovel: true,
+              config_shovel_statics: {
+                'shovel_first' => '{sources,[{broker,"amqp://"}]},
+        {destinations,[{broker,"amqp://site1.example.com"}]},
+        {queue,<<"source_one">>}',
+                'shovel_second' => '{sources,[{broker,"amqp://"}]},
+        {destinations,[{broker,"amqp://site2.example.com"}]},
+        {queue,<<"source_two">>}'
+              }
+            }
+          end
+
+          it 'generates correct configuration' do
+            verify_contents(catalogue, 'rabbitmq.config', [
+                              '  {rabbitmq_shovel,',
+                              '    [{shovels,[',
+                              '      {shovel_first,[{sources,[{broker,"amqp://"}]},',
+                              '        {destinations,[{broker,"amqp://site1.example.com"}]},',
+                              '        {queue,<<"source_one">>}]},',
+                              '      {shovel_second,[{sources,[{broker,"amqp://"}]},',
+                              '        {destinations,[{broker,"amqp://site2.example.com"}]},',
+                              '        {queue,<<"source_two">>}]}',
+                              '    ]}]}'
+                            ])
+          end
         end
       end
 
       describe 'default_user and default_pass set' do
-        let(:params) {{ :default_user => 'foo', :default_pass => 'bar' }}
-        it 'should set default_user and default_pass to specified values' do
-          should contain_file('rabbitmq.config').with({
-            'content' => /default_user, <<"foo">>.*default_pass, <<"bar">>/m,
-          })
+        let(:params) { { default_user: 'foo', default_pass: 'bar' } }
+
+        it 'sets default_user and default_pass to specified values' do
+          is_expected.to contain_file('rabbitmq.config').with('content' => %r{default_user, <<"foo">>.*default_pass, <<"bar">>}m)
         end
       end
 
       describe 'interfaces option with no ssl' do
-        let(:params) {
-          { :interface => '0.0.0.0',
-        } }
+        let(:params) do
+          { interface: '0.0.0.0' }
+        end
 
-        it 'should set ssl options to specified values' do
-          should contain_file('rabbitmq.config').with_content(%r{tcp_listeners, \[\{"0.0.0.0", 5672\}\]})
+        it 'sets ssl options to specified values' do
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{tcp_listeners, \[\{"0.0.0.0", 5672\}\]})
         end
       end
 
-      describe 'ssl options' do
-        let(:params) {
-          { :ssl => true,
-            :ssl_port => 3141,
-            :ssl_cacert => '/path/to/cacert',
-            :ssl_cert => '/path/to/cert',
-            :ssl_key => '/path/to/key'
-        } }
-
-        it 'should set ssl options to specified values' do
-          should contain_file('rabbitmq.config').with_content(
+      describe 'ssl options and mangament_ssl false' do
+        let(:params) do
+          { ssl: true,
+            ssl_port: 3141,
+            ssl_cacert: '/path/to/cacert',
+            ssl_cert: '/path/to/cert',
+            ssl_key: '/path/to/key',
+            ssl_secure_renegotiate: true,
+            ssl_reuse_sessions: true,
+            ssl_honor_cipher_order: true,
+            ssl_dhfile: :undef,
+            management_ssl: false,
+            management_port: 13_142 }
+        end
+
+        it 'sets ssl options to specified values' do
+          is_expected.to contain_file('rabbitmq.config').with_content(
             %r{ssl_listeners, \[3141\]}
           )
-          should contain_file('rabbitmq.config').with_content(
+          is_expected.to contain_file('rabbitmq.config').with_content(
             %r{ssl_options, \[}
           )
-          should contain_file('rabbitmq.config').with_content(
+          is_expected.to contain_file('rabbitmq.config').with_content(
             %r{cacertfile,"/path/to/cacert"}
           )
-          should contain_file('rabbitmq.config').with_content(
+          is_expected.to contain_file('rabbitmq.config').with_content(
             %r{certfile,"/path/to/cert"}
           )
-          should contain_file('rabbitmq.config').with_content(
+          is_expected.to contain_file('rabbitmq.config').with_content(
             %r{keyfile,"/path/to/key"}
           )
+          is_expected.to contain_file('rabbitmq.config').with_content(
+            %r{secure_renegotiate,true}
+          )
+          is_expected.to contain_file('rabbitmq.config').with_content(
+            %r{reuse_sessions,true}
+          )
+          is_expected.to contain_file('rabbitmq.config').with_content(
+            %r{honor_cipher_order,true}
+          )
+          is_expected.to contain_file('rabbitmq.config').without_content(
+            %r{dhfile,}
+          )
+        end
+        it 'sets non ssl port for management port' do
+          is_expected.to contain_file('rabbitmq.config').with_content(
+            %r{port, 13142}
+          )
+          is_expected.to contain_file('rabbitmqadmin.conf').with_content(
+            %r{port\s=\s13142}
+          )
         end
       end
 
+      describe 'ssl options and mangament_ssl true' do
+        let(:params) do
+          { ssl: true,
+            ssl_port: 3141,
+            ssl_cacert: '/path/to/cacert',
+            ssl_cert: '/path/to/cert',
+            ssl_key: '/path/to/key',
+            ssl_secure_renegotiate: true,
+            ssl_reuse_sessions: true,
+            ssl_honor_cipher_order: true,
+            ssl_dhfile: :undef,
+
+            management_ssl: true,
+            ssl_management_port: 13_141 }
+        end
 
-      describe 'ssl options with ssl_interfaces' do
-        let(:params) {
-          { :ssl => true,
-            :ssl_port => 3141,
-            :ssl_interface => '0.0.0.0',
-            :ssl_cacert => '/path/to/cacert',
-            :ssl_cert => '/path/to/cert',
-            :ssl_key => '/path/to/key'
-        } }
-
-        it 'should set ssl options to specified values' do
-          should contain_file('rabbitmq.config').with_content(%r{ssl_listeners, \[\{"0.0.0.0", 3141\}\]})
-          should contain_file('rabbitmq.config').with_content(%r{cacertfile,"/path/to/cacert"})
-          should contain_file('rabbitmq.config').with_content(%r{certfile,"/path/to/cert"})
-          should contain_file('rabbitmq.config').with_content(%r{keyfile,"/path/to/key})
+        it 'sets ssl options to specified values' do
+          is_expected.to contain_file('rabbitmq.config').with_content(
+            %r{ssl_listeners, \[3141\]}
+          )
+          is_expected.to contain_file('rabbitmq.config').with_content(
+            %r{ssl_opts, }
+          )
+          is_expected.to contain_file('rabbitmq.config').with_content(
+            %r{ssl_options, \[}
+          )
+          is_expected.to contain_file('rabbitmq.config').with_content(
+            %r{cacertfile,"/path/to/cacert"}
+          )
+          is_expected.to contain_file('rabbitmq.config').with_content(
+            %r{certfile,"/path/to/cert"}
+          )
+          is_expected.to contain_file('rabbitmq.config').with_content(
+            %r{keyfile,"/path/to/key"}
+          )
+          is_expected.to contain_file('rabbitmq.config').with_content(
+            %r{secure_renegotiate,true}
+          )
+          is_expected.to contain_file('rabbitmq.config').with_content(
+            %r{reuse_sessions,true}
+          )
+          is_expected.to contain_file('rabbitmq.config').with_content(
+            %r{honor_cipher_order,true}
+          )
+          is_expected.to contain_file('rabbitmq.config').without_content(
+            %r{dhfile,}
+          )
+        end
+        it 'sets ssl managment port to specified values' do
+          is_expected.to contain_file('rabbitmq.config').with_content(
+            %r{port, 13141}
+          )
+        end
+        it 'sets ssl options in the rabbitmqadmin.conf' do
+          is_expected.to contain_file('rabbitmqadmin.conf').with_content(
+            %r{ssl_ca_cert_file\s=\s/path/to/cacert}
+          )
+          is_expected.to contain_file('rabbitmqadmin.conf').with_content(
+            %r{ssl_cert_file\s=\s/path/to/cert}
+          )
+          is_expected.to contain_file('rabbitmqadmin.conf').with_content(
+            %r{ssl_key_file\s=\s/path/to/key}
+          )
+          is_expected.to contain_file('rabbitmqadmin.conf').with_content(
+            %r{hostname\s=\s}
+          )
+          is_expected.to contain_file('rabbitmqadmin.conf').with_content(
+            %r{port\s=\s13141}
+          )
         end
       end
 
+      describe 'ssl options' do
+        let(:params) do
+          { ssl: true,
+            ssl_port: 3141,
+            ssl_cacert: '/path/to/cacert',
+            ssl_cert: '/path/to/cert',
+            ssl_key: '/path/to/key',
+            ssl_secure_renegotiate: true,
+            ssl_reuse_sessions: true,
+            ssl_honor_cipher_order: true,
+            ssl_dhfile: :undef }
+        end
 
+        it 'sets ssl options to specified values' do
+          is_expected.to contain_file('rabbitmq.config').with_content(
+            %r{ssl_listeners, \[3141\]}
+          )
+          is_expected.to contain_file('rabbitmq.config').with_content(
+            %r{ssl_options, \[}
+          )
+          is_expected.to contain_file('rabbitmq.config').with_content(
+            %r{cacertfile,"/path/to/cacert"}
+          )
+          is_expected.to contain_file('rabbitmq.config').with_content(
+            %r{certfile,"/path/to/cert"}
+          )
+          is_expected.to contain_file('rabbitmq.config').with_content(
+            %r{keyfile,"/path/to/key"}
+          )
+          is_expected.to contain_file('rabbitmq.config').with_content(
+            %r{secure_renegotiate,true}
+          )
+          is_expected.to contain_file('rabbitmq.config').with_content(
+            %r{reuse_sessions,true}
+          )
+          is_expected.to contain_file('rabbitmq.config').with_content(
+            %r{honor_cipher_order,true}
+          )
+          is_expected.to contain_file('rabbitmq.config').without_content(
+            %r{dhfile,}
+          )
+        end
+      end
+
+      describe 'ssl options with ssl_interfaces' do
+        let(:params) do
+          { ssl: true,
+            ssl_port: 3141,
+            ssl_interface: '0.0.0.0',
+            ssl_cacert: '/path/to/cacert',
+            ssl_cert: '/path/to/cert',
+            ssl_key: '/path/to/key' }
+        end
+
+        it 'sets ssl options to specified values' do
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{ssl_listeners, \[\{"0.0.0.0", 3141\}\]})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{cacertfile,"/path/to/cacert"})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{certfile,"/path/to/cert"})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{keyfile,"/path/to/key})
+        end
+      end
 
       describe 'ssl options with ssl_only' do
-        let(:params) {
-          { :ssl => true,
-            :ssl_only => true,
-            :ssl_port => 3141,
-            :ssl_cacert => '/path/to/cacert',
-            :ssl_cert => '/path/to/cert',
-            :ssl_key => '/path/to/key'
-        } }
-
-        it 'should set ssl options to specified values' do
-          should contain_file('rabbitmq.config').with_content(%r{tcp_listeners, \[\]})
-          should contain_file('rabbitmq.config').with_content(%r{ssl_listeners, \[3141\]})
-          should contain_file('rabbitmq.config').with_content(%r{ssl_options, \[})
-          should contain_file('rabbitmq.config').with_content(%r{cacertfile,"/path/to/cacert"})
-          should contain_file('rabbitmq.config').with_content(%r{certfile,"/path/to/cert"})
-          should contain_file('rabbitmq.config').with_content(%r{keyfile,"/path/to/key})
+        let(:params) do
+          { ssl: true,
+            ssl_only: true,
+            ssl_port: 3141,
+            ssl_cacert: '/path/to/cacert',
+            ssl_cert: '/path/to/cert',
+            ssl_key: '/path/to/key' }
+        end
+
+        it 'sets ssl options to specified values' do
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{tcp_listeners, \[\]})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{ssl_listeners, \[3141\]})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{ssl_options, \[})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{cacertfile,"/path/to/cacert"})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{certfile,"/path/to/cert"})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{keyfile,"/path/to/key})
+        end
+        it 'does not set TCP listener environment defaults' do
+          is_expected.to contain_file('rabbitmq-env.config'). \
+            without_content(%r{NODE_PORT=}). \
+            without_content(%r{NODE_IP_ADDRESS=})
         end
       end
 
       describe 'ssl options with ssl_only and ssl_interfaces' do
-        let(:params) {
-          { :ssl => true,
-            :ssl_only => true,
-            :ssl_port => 3141,
-            :ssl_interface => '0.0.0.0',
-            :ssl_cacert => '/path/to/cacert',
-            :ssl_cert => '/path/to/cert',
-            :ssl_key => '/path/to/key'
-        } }
-
-        it 'should set ssl options to specified values' do
-          should contain_file('rabbitmq.config').with_content(%r{tcp_listeners, \[\]})
-          should contain_file('rabbitmq.config').with_content(%r{ssl_listeners, \[\{"0.0.0.0", 3141\}\]})
-          should contain_file('rabbitmq.config').with_content(%r{cacertfile,"/path/to/cacert"})
-          should contain_file('rabbitmq.config').with_content(%r{certfile,"/path/to/cert"})
-          should contain_file('rabbitmq.config').with_content(%r{keyfile,"/path/to/key})
+        let(:params) do
+          { ssl: true,
+            ssl_only: true,
+            ssl_port: 3141,
+            ssl_interface: '0.0.0.0',
+            ssl_cacert: '/path/to/cacert',
+            ssl_cert: '/path/to/cert',
+            ssl_key: '/path/to/key' }
         end
-      end
 
-      describe 'ssl options with specific ssl versions' do
-        let(:params) {
-          { :ssl => true,
-            :ssl_port => 3141,
-            :ssl_cacert => '/path/to/cacert',
-            :ssl_cert => '/path/to/cert',
-            :ssl_key => '/path/to/key',
-            :ssl_versions => ['tlsv1.2', 'tlsv1.1']
-        } }
-
-        it 'should set ssl options to specified values' do
-          should contain_file('rabbitmq.config').with_content(%r{ssl_listeners, \[3141\]})
-          should contain_file('rabbitmq.config').with_content(%r{ssl_options, \[})
-          should contain_file('rabbitmq.config').with_content(%r{cacertfile,"/path/to/cacert"})
-          should contain_file('rabbitmq.config').with_content(%r{certfile,"/path/to/cert"})
-          should contain_file('rabbitmq.config').with_content(%r{keyfile,"/path/to/key})
-          should contain_file('rabbitmq.config').with_content(%r{ssl, \[\{versions, \['tlsv1.1', 'tlsv1.2'\]\}\]})
-          should contain_file('rabbitmq.config').with_content(%r{versions, \['tlsv1.1', 'tlsv1.2'\]})
+        it 'sets ssl options to specified values' do
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{tcp_listeners, \[\]})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{ssl_listeners, \[\{"0.0.0.0", 3141\}\]})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{cacertfile,"/path/to/cacert"})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{certfile,"/path/to/cert"})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{keyfile,"/path/to/key})
         end
       end
 
-      describe 'ssl options with invalid ssl_versions type' do
-        let(:params) {
-          { :ssl => true,
-            :ssl_port => 3141,
-            :ssl_cacert => '/path/to/cacert',
-            :ssl_cert => '/path/to/cert',
-            :ssl_key => '/path/to/key',
-            :ssl_versions => 'tlsv1.2, tlsv1.1'
-        } }
+      describe 'ssl options with specific ssl versions' do
+        let(:params) do
+          { ssl: true,
+            ssl_port: 3141,
+            ssl_cacert: '/path/to/cacert',
+            ssl_cert: '/path/to/cert',
+            ssl_key: '/path/to/key',
+            ssl_versions: ['tlsv1.2', 'tlsv1.1'] }
+        end
 
-        it 'fails' do
-          expect { catalogue }.to raise_error(Puppet::Error, /is not an Array/)
+        it 'sets ssl options to specified values' do
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{ssl_listeners, \[3141\]})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{ssl_options, \[})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{cacertfile,"/path/to/cacert"})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{certfile,"/path/to/cert"})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{keyfile,"/path/to/key})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{ssl, \[\{versions, \['tlsv1.1', 'tlsv1.2'\]\}\]})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{versions, \['tlsv1.1', 'tlsv1.2'\]})
         end
       end
 
       describe 'ssl options with ssl_versions and not ssl' do
-        let(:params) {
-          { :ssl => false,
-            :ssl_port => 3141,
-            :ssl_cacert => '/path/to/cacert',
-            :ssl_cert => '/path/to/cert',
-            :ssl_key => '/path/to/key',
-            :ssl_versions => ['tlsv1.2', 'tlsv1.1']
-        } }
+        let(:params) do
+          { ssl: false,
+            ssl_port: 3141,
+            ssl_cacert: '/path/to/cacert',
+            ssl_cert: '/path/to/cert',
+            ssl_key: '/path/to/key',
+            ssl_versions: ['tlsv1.2', 'tlsv1.1'] }
+        end
 
         it 'fails' do
-          expect { catalogue }.to raise_error(Puppet::Error, /\$ssl_versions requires that \$ssl => true/)
+          expect { catalogue }.to raise_error(Puppet::Error, %r{\$ssl_versions requires that \$ssl => true})
         end
       end
 
       describe 'ssl options with ssl ciphers' do
-        let(:params) {
-          { :ssl => true,
-            :ssl_port => 3141,
-            :ssl_cacert => '/path/to/cacert',
-            :ssl_cert => '/path/to/cert',
-            :ssl_key => '/path/to/key',
-            :ssl_ciphers => ['ecdhe_rsa,aes_256_cbc,sha', 'dhe_rsa,aes_256_cbc,sha']
-        } }
-
-        it 'should set ssl ciphers to specified values' do
-          should contain_file('rabbitmq.config').with_content(%r{ciphers,\[[[:space:]]+{dhe_rsa,aes_256_cbc,sha},[[:space:]]+{ecdhe_rsa,aes_256_cbc,sha}[[:space:]]+\]})
+        let(:params) do
+          { ssl: true,
+            ssl_port: 3141,
+            ssl_cacert: '/path/to/cacert',
+            ssl_cert: '/path/to/cert',
+            ssl_key: '/path/to/key',
+            ssl_ciphers: ['ecdhe_rsa,aes_256_cbc,sha', 'dhe_rsa,aes_256_cbc,sha'] }
+        end
+
+        it 'sets ssl ciphers to specified values' do
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{ciphers,\[[[:space:]]+{dhe_rsa,aes_256_cbc,sha},[[:space:]]+{ecdhe_rsa,aes_256_cbc,sha}[[:space:]]+\]})
         end
       end
 
       describe 'ssl admin options with specific ssl versions' do
-        let(:params) {
-          { :ssl => true,
-            :ssl_management_port => 5926,
-            :ssl_cacert => '/path/to/cacert',
-            :ssl_cert => '/path/to/cert',
-            :ssl_key => '/path/to/key',
-            :ssl_versions => ['tlsv1.2', 'tlsv1.1'],
-            :admin_enable => true
-        } }
-
-        it 'should set admin ssl opts to specified values' do
-          should contain_file('rabbitmq.config').with_content(%r{rabbitmq_management, \[})
-          should contain_file('rabbitmq.config').with_content(%r{listener, \[})
-          should contain_file('rabbitmq.config').with_content(%r{port, 5926\}})
-          should contain_file('rabbitmq.config').with_content(%r{ssl, true\}})
-          should contain_file('rabbitmq.config').with_content(%r{ssl_opts, \[\{cacertfile, "/path/to/cacert"\},})
-          should contain_file('rabbitmq.config').with_content(%r{certfile, "/path/to/cert"\},})
-          should contain_file('rabbitmq.config').with_content(%r{keyfile, "/path/to/key"\}})
-          should contain_file('rabbitmq.config').with_content(%r{,\{versions, \['tlsv1.1', 'tlsv1.2'\]\}[\r\n ]*\]\}})
+        let(:params) do
+          { ssl: true,
+            ssl_management_port: 5926,
+            ssl_cacert: '/path/to/cacert',
+            ssl_cert: '/path/to/cert',
+            ssl_key: '/path/to/key',
+            ssl_versions: ['tlsv1.2', 'tlsv1.1'],
+            admin_enable: true }
+        end
+
+        it 'sets admin ssl opts to specified values' do
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{rabbitmq_management, \[})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{listener, \[})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{port, 5926\}})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{ssl, true\}})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{ssl_opts, \[})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{cacertfile, "/path/to/cacert"\},})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{certfile, "/path/to/cert"\},})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{keyfile, "/path/to/key"\}})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{,\{versions, \['tlsv1.1', 'tlsv1.2'\]\}})
+        end
+      end
+
+      describe 'ssl with ssl_dhfile' do
+        let(:params) do
+          { ssl: true,
+            ssl_interface: '0.0.0.0',
+            ssl_dhfile: '/etc/pki/tls/dh-params.pem' }
+        end
+
+        it { is_expected.to contain_file('rabbitmq.config').with_content(%r{dhfile, "/etc/pki/tls/dh-params\.pem}) }
+      end
+
+      describe 'ssl with ssl_dhfile unset' do
+        let(:params) do
+          { ssl: true,
+            ssl_interface: '0.0.0.0',
+            ssl_dhfile: :undef }
         end
+
+        it { is_expected.to contain_file('rabbitmq.config').without_content(%r{dhfile,}) }
+      end
+
+      describe 'ssl with ssl_secure_renegotiate false' do
+        let(:params) do
+          { ssl: true,
+            ssl_interface: '0.0.0.0',
+            ssl_secure_renegotiate: false }
+        end
+
+        it { is_expected.to contain_file('rabbitmq.config').with_content(%r{secure_renegotiate,false}) }
+      end
+
+      describe 'ssl with ssl_reuse_sessions false' do
+        let(:params) do
+          { ssl: true,
+            ssl_interface: '0.0.0.0',
+            ssl_reuse_sessions: false }
+        end
+
+        it { is_expected.to contain_file('rabbitmq.config').with_content(%r{reuse_sessions,false}) }
+      end
+
+      describe 'ssl with ssl_honor_cipher_order false' do
+        let(:params) do
+          { ssl: true,
+            ssl_interface: '0.0.0.0',
+            ssl_honor_cipher_order: false }
+        end
+
+        it { is_expected.to contain_file('rabbitmq.config').with_content(%r{honor_cipher_order,false}) }
       end
 
       describe 'ssl admin options' do
-        let(:params) {
-          { :ssl => true,
-            :ssl_management_port => 3141,
-            :ssl_cacert => '/path/to/cacert',
-            :ssl_cert => '/path/to/cert',
-            :ssl_key => '/path/to/key',
-            :admin_enable => true
-        } }
-
-        it 'should set rabbitmq_management ssl options to specified values' do
-          should contain_file('rabbitmq.config').with_content(%r{rabbitmq_management, \[})
-          should contain_file('rabbitmq.config').with_content(%r{listener, \[})
-          should contain_file('rabbitmq.config').with_content(%r{port, 3141\}})
-          should contain_file('rabbitmq.config').with_content(%r{ssl, true\}})
-          should contain_file('rabbitmq.config').with_content(%r{ssl_opts, \[\{cacertfile, "/path/to/cacert"\},})
-          should contain_file('rabbitmq.config').with_content(%r{certfile, "/path/to/cert"\},})
-          should contain_file('rabbitmq.config').with_content(%r{keyfile, "/path/to/key"\}[\r\n ]*\]\}})
+        let(:params) do
+          { ssl: true,
+            ssl_management_port: 3141,
+            ssl_cacert: '/path/to/cacert',
+            ssl_cert: '/path/to/cert',
+            ssl_key: '/path/to/key',
+            ssl_management_verify: 'verify_peer',
+            ssl_management_fail_if_no_peer_cert: true,
+            admin_enable: true }
+        end
+
+        it 'sets rabbitmq_management ssl options to specified values' do
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{rabbitmq_management, \[})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{listener, \[})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{port, 3141\}})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{ssl, true\}})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{ssl_opts, \[})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{verify,verify_peer\},})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{fail_if_no_peer_cert,true\}})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{cacertfile, "/path/to/cacert"\},})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{certfile, "/path/to/cert"\},})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{keyfile, "/path/to/key"\}})
         end
       end
 
       describe 'admin without ssl' do
-        let(:params) {
-          { :ssl => false,
-            :management_port => 3141,
-            :admin_enable => true
-        } }
+        let(:params) do
+          { ssl: false,
+            management_port: 3141,
+            admin_enable: true }
+        end
 
-        it 'should set rabbitmq_management  options to specified values' do
-          should contain_file('rabbitmq.config').with_content(%r{rabbitmq_management, \[})
-          should contain_file('rabbitmq.config').with_content(%r{listener, \[})
-          should contain_file('rabbitmq.config').with_content(%r{port, 3141\}})
+        it 'sets rabbitmq_management options to specified values' do
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{rabbitmq_management, \[})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{listener, \[})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{port, 3141\}})
         end
       end
 
       describe 'ssl admin options' do
-        let(:params) {
-          { :ssl => true,
-            :ssl_management_port => 3141,
-            :ssl_cacert => '/path/to/cacert',
-            :ssl_cert => '/path/to/cert',
-            :ssl_key => '/path/to/key',
-            :admin_enable => true
-        } }
-
-        it 'should set rabbitmq_management ssl options to specified values' do
-          should contain_file('rabbitmq.config').with_content(%r{rabbitmq_management, \[})
-          should contain_file('rabbitmq.config').with_content(%r{listener, \[})
-          should contain_file('rabbitmq.config').with_content(%r{port, 3141\},})
-          should contain_file('rabbitmq.config').with_content(%r{ssl, true\},})
-          should contain_file('rabbitmq.config').with_content(%r{ssl_opts, \[\{cacertfile, "/path/to/cacert"\},})
-          should contain_file('rabbitmq.config').with_content(%r{certfile, "/path/to/cert"\},})
-          should contain_file('rabbitmq.config').with_content(%r{keyfile, "/path/to/key"\}[\r\n ]*\]\}})
+        let(:params) do
+          { ssl: true,
+            ssl_management_port: 3141,
+            ssl_cacert: '/path/to/cacert',
+            ssl_cert: '/path/to/cert',
+            ssl_key: '/path/to/key',
+            admin_enable: true }
+        end
+
+        it 'sets rabbitmq_management ssl options to specified values' do
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{rabbitmq_management, \[})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{listener, \[})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{port, 3141\},})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{ssl, true\},})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{ssl_opts, \[})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{cacertfile, "/path/to/cacert"\},})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{certfile, "/path/to/cert"\},})
+          is_expected.to contain_file('rabbitmq.config').with_content(%r{keyfile, "/path/to/key"\}})
         end
       end
 
       describe 'admin without ssl' do
-        let(:params) {
-          { :ssl => false,
-            :management_port => 3141,
-            :admin_enable => true
-        } }
-
-        it 'should set rabbitmq_management  options to specified values' do
-          should contain_file('rabbitmq.config') \
-            .with_content(/\{rabbitmq_management, \[/) \
-            .with_content(/\{listener, \[/) \
-            .with_content(/\{port, 3141\}/)
+        let(:params) do
+          { ssl: false,
+            management_port: 3141,
+            admin_enable: true }
+        end
+
+        it 'sets rabbitmq_management options to specified values' do
+          is_expected.to contain_file('rabbitmq.config'). \
+            with_content(%r{\{rabbitmq_management, \[}). \
+            with_content(%r{\{listener, \[}). \
+            with_content(%r{\{port, 3141\}})
+        end
+      end
+
+      describe 'ipv6 enabled' do
+        let(:params) { { ipv6: true } }
+
+        it 'enables resolver inet6 in inetrc' do
+          is_expected.to contain_file('rabbitmq-inetrc').with_content(%r{{inet6, true}.})
+        end
+
+        context 'without other erl args' do
+          it 'enables inet6 distribution' do
+            is_expected.to contain_file('rabbitmq-env.config'). \
+              with_content(%r{^RABBITMQ_SERVER_ERL_ARGS="-proto_dist inet6_tcp"$}). \
+              with_content(%r{^RABBITMQ_CTL_ERL_ARGS="-proto_dist inet6_tcp"$})
+          end
+        end
+
+        context 'with other quoted erl args' do
+          let(:params) do
+            { ipv6: true,
+              environment_variables: { 'RABBITMQ_SERVER_ERL_ARGS' => '"some quoted args"',
+                                       'RABBITMQ_CTL_ERL_ARGS'    => '"other quoted args"' } }
+          end
+
+          it 'enables inet6 distribution and quote properly' do
+            is_expected.to contain_file('rabbitmq-env.config'). \
+              with_content(%r{^RABBITMQ_SERVER_ERL_ARGS="some quoted args -proto_dist inet6_tcp"$}). \
+              with_content(%r{^RABBITMQ_CTL_ERL_ARGS="other quoted args -proto_dist inet6_tcp"$})
+          end
+        end
+
+        context 'with other unquoted erl args' do
+          let(:params) do
+            { ipv6: true,
+              environment_variables: { 'RABBITMQ_SERVER_ERL_ARGS' => 'foo',
+                                       'RABBITMQ_CTL_ERL_ARGS'    => 'bar' } }
+          end
+
+          it 'enables inet6 distribution and quote properly' do
+            is_expected.to contain_file('rabbitmq-env.config'). \
+              with_content(%r{^RABBITMQ_SERVER_ERL_ARGS="foo -proto_dist inet6_tcp"$}). \
+              with_content(%r{^RABBITMQ_CTL_ERL_ARGS="bar -proto_dist inet6_tcp"$})
+          end
+        end
+
+        context 'with SSL and without other erl args' do
+          let(:params) do
+            { ipv6: true,
+              ssl_erl_dist: true }
+          end
+
+          it 'enables inet6 distribution' do
+            is_expected.to contain_file('rabbitmq-env.config'). \
+              with_content(%r{^RABBITMQ_SERVER_ERL_ARGS=" -pa /usr/lib64/erlang/lib/ssl-7.3.3.1/ebin -proto_dist inet6_tls"$}). \
+              with_content(%r{^RABBITMQ_CTL_ERL_ARGS=" -pa /usr/lib64/erlang/lib/ssl-7.3.3.1/ebin -proto_dist inet6_tls"$})
+          end
+        end
+
+        context 'with SSL and other quoted erl args' do
+          let(:params) do
+            { ipv6: true,
+              ssl_erl_dist: true,
+              environment_variables: { 'RABBITMQ_SERVER_ERL_ARGS' => '"some quoted args"',
+                                       'RABBITMQ_CTL_ERL_ARGS'    => '"other quoted args"' } }
+          end
+
+          it 'enables inet6 distribution and quote properly' do
+            is_expected.to contain_file('rabbitmq-env.config'). \
+              with_content(%r{^RABBITMQ_SERVER_ERL_ARGS="some quoted args -pa /usr/lib64/erlang/lib/ssl-7.3.3.1/ebin  -proto_dist inet6_tls"$}). \
+              with_content(%r{^RABBITMQ_CTL_ERL_ARGS="other quoted args -pa /usr/lib64/erlang/lib/ssl-7.3.3.1/ebin  -proto_dist inet6_tls"$})
+          end
+        end
+
+        context 'with SSL and with other unquoted erl args' do
+          let(:params) do
+            { ipv6: true,
+              ssl_erl_dist: true,
+              environment_variables: { 'RABBITMQ_SERVER_ERL_ARGS' => 'foo',
+                                       'RABBITMQ_CTL_ERL_ARGS'    => 'bar' } }
+          end
+
+          it 'enables inet6 distribution and quote properly' do
+            is_expected.to contain_file('rabbitmq-env.config'). \
+              with_content(%r{^RABBITMQ_SERVER_ERL_ARGS="foo -pa /usr/lib64/erlang/lib/ssl-7.3.3.1/ebin  -proto_dist inet6_tls"$}). \
+              with_content(%r{^RABBITMQ_CTL_ERL_ARGS="bar -pa /usr/lib64/erlang/lib/ssl-7.3.3.1/ebin  -proto_dist inet6_tls"$})
+          end
         end
       end
 
       describe 'config_variables options' do
-        let(:params) {{ :config_variables => {
-            'hipe_compile'                  => true,
+        let(:params) do
+          { config_variables: {
+            'hipe_compile' => true,
             'vm_memory_high_watermark'      => 0.4,
-            'frame_max'                     => 131072,
-            'collect_statistics'            => "none",
-            'auth_mechanisms'               => "['PLAIN', 'AMQPLAIN']",
-        }}}
-        it 'should set environment variables' do
-          should contain_file('rabbitmq.config') \
-            .with_content(/\{hipe_compile, true\}/) \
-            .with_content(/\{vm_memory_high_watermark, 0.4\}/) \
-            .with_content(/\{frame_max, 131072\}/) \
-            .with_content(/\{collect_statistics, none\}/) \
-            .with_content(/\{auth_mechanisms, \['PLAIN', 'AMQPLAIN'\]\}/)
+            'frame_max'                     => 131_072,
+            'collect_statistics'            => 'none',
+            'auth_mechanisms'               => "['PLAIN', 'AMQPLAIN']"
+          } }
+        end
+
+        it 'sets environment variables' do
+          is_expected.to contain_file('rabbitmq.config'). \
+            with_content(%r{\{hipe_compile, true\}}). \
+            with_content(%r{\{vm_memory_high_watermark, 0.4\}}). \
+            with_content(%r{\{frame_max, 131072\}}). \
+            with_content(%r{\{collect_statistics, none\}}). \
+            with_content(%r{\{auth_mechanisms, \['PLAIN', 'AMQPLAIN'\]\}})
         end
       end
 
       describe 'config_kernel_variables options' do
-        let(:params) {{ :config_kernel_variables => {
-            'inet_dist_listen_min'      => 9100,
-            'inet_dist_listen_max'      => 9105,
-        }}}
-        it 'should set config variables' do
-          should contain_file('rabbitmq.config') \
-            .with_content(/\{inet_dist_listen_min, 9100\}/) \
-            .with_content(/\{inet_dist_listen_max, 9105\}/)
+        let(:params) do
+          { config_kernel_variables: {
+            'inet_dist_listen_min' => 9100,
+            'inet_dist_listen_max' => 9105
+          } }
+        end
+
+        it 'sets config variables' do
+          is_expected.to contain_file('rabbitmq.config'). \
+            with_content(%r{\{inet_dist_listen_min, 9100\}}). \
+            with_content(%r{\{inet_dist_listen_max, 9105\}})
+        end
+      end
+
+      describe 'config_management_variables' do
+        let(:params) do
+          { config_management_variables: {
+            'rates_mode' => 'none'
+          } }
+        end
+
+        it 'sets config variables' do
+          is_expected.to contain_file('rabbitmq.config'). \
+            with_content(%r{\{rates_mode, none\}})
         end
       end
 
       describe 'tcp_keepalive enabled' do
-        let(:params) {{ :tcp_keepalive => true }}
-        it 'should set tcp_listen_options keepalive true' do
-          should contain_file('rabbitmq.config') \
-            .with_content(/\{tcp_listen_options, \[\{keepalive, true\}\]\},/)
+        let(:params) { { tcp_keepalive: true } }
+
+        it 'sets tcp_listen_options keepalive true' do
+          is_expected.to contain_file('rabbitmq.config'). \
+            with_content(%r{\{keepalive,     true\}})
         end
       end
 
       describe 'tcp_keepalive disabled (default)' do
-        it 'should not set tcp_listen_options' do
-          should contain_file('rabbitmq.config') \
-            .without_content(/\{tcp_listen_options, \[\{keepalive, true\}\]\},/)
+        it 'does not set tcp_listen_options' do
+          is_expected.to contain_file('rabbitmq.config'). \
+            without_content(%r{\{keepalive,     true\}})
         end
       end
 
-      describe 'non-bool tcp_keepalive parameter' do
-        let :params do
-          { :tcp_keepalive => 'string' }
+      describe 'tcp_backlog with default value' do
+        it 'sets tcp_listen_options backlog to 128' do
+          is_expected.to contain_file('rabbitmq.config'). \
+            with_content(%r{\{backlog,       128\}})
+        end
+      end
+
+      describe 'tcp_backlog with non-default value' do
+        let(:params) do
+          { tcp_backlog: 256 }
+        end
+
+        it 'sets tcp_listen_options backlog to 256' do
+          is_expected.to contain_file('rabbitmq.config'). \
+            with_content(%r{\{backlog,       256\}})
+        end
+      end
+
+      describe 'tcp_sndbuf with default value' do
+        it 'does not set tcp_listen_options sndbuf' do
+          is_expected.to contain_file('rabbitmq.config'). \
+            without_content(%r{sndbuf})
+        end
+      end
+
+      describe 'tcp_sndbuf with non-default value' do
+        let(:params) do
+          { tcp_sndbuf: 128 }
+        end
+
+        it 'sets tcp_listen_options sndbuf to 128' do
+          is_expected.to contain_file('rabbitmq.config'). \
+            with_content(%r{\{sndbuf,       128\}})
+        end
+      end
+
+      describe 'tcp_recbuf with default value' do
+        it 'does not set tcp_listen_options recbuf' do
+          is_expected.to contain_file('rabbitmq.config'). \
+            without_content(%r{recbuf})
+        end
+      end
+
+      describe 'tcp_recbuf with non-default value' do
+        let(:params) do
+          { tcp_recbuf: 128 }
         end
 
-        it 'should raise an error' do
-          expect {
-            should contain_file('rabbitmq.config')
-          }.to raise_error(Puppet::Error, /is not a boolean/)
+        it 'sets tcp_listen_options recbuf to 128' do
+          is_expected.to contain_file('rabbitmq.config'). \
+            with_content(%r{\{recbuf,       128\}})
+        end
+      end
+
+      describe 'rabbitmq-heartbeat options' do
+        let(:params) { { heartbeat: 60 } }
+
+        it 'sets heartbeat paramter in config file' do
+          is_expected.to contain_file('rabbitmq.config'). \
+            with_content(%r{\{heartbeat, 60\}})
         end
       end
 
       context 'delete_guest_user' do
         describe 'should do nothing by default' do
-          it { should_not contain_rabbitmq_user('guest') }
+          it { is_expected.not_to contain_rabbitmq_user('guest') }
         end
 
         describe 'delete user when delete_guest_user set' do
-          let(:params) {{ :delete_guest_user => true }}
+          let(:params) { { delete_guest_user: true } }
+
           it 'removes the user' do
-            should contain_rabbitmq_user('guest').with(
+            is_expected.to contain_rabbitmq_user('guest').with(
               'ensure'   => 'absent',
               'provider' => 'rabbitmqctl'
             )
@@ -966,134 +1415,36 @@ rabbitmq hard nofile 1234
       ## rabbitmq::service
       ##
       describe 'service with default params' do
-        it { should contain_service('rabbitmq-server').with(
-          'ensure'     => 'running',
-          'enable'     => 'true',
-          'hasstatus'  => 'true',
-          'hasrestart' => 'true'
-        )}
+        it {
+          is_expected.to contain_service('rabbitmq-server').with(
+            'ensure'     => 'running',
+            'enable'     => 'true',
+            'hasstatus'  => 'true',
+            'hasrestart' => 'true'
+          )
+        }
       end
 
       describe 'service with ensure stopped' do
         let :params do
-          { :service_ensure => 'stopped' }
+          { service_ensure: 'stopped' }
         end
 
-        it { should contain_service('rabbitmq-server').with(
-          'ensure'    => 'stopped',
-          'enable'    => false
-        ) }
-      end
-
-      describe 'service with ensure neither running neither stopped' do
-        let :params do
-          { :service_ensure => 'foo' }
-        end
-
-        it 'should raise an error' do
-          expect {
-            should contain_service('rabbitmq-server').with(
-              'ensure' => 'stopped' )
-          }.to raise_error(Puppet::Error, /validate_re\(\): "foo" does not match "\^\(running\|stopped\)\$"/)
-        end
+        it {
+          is_expected.to contain_service('rabbitmq-server').with(
+            'ensure'    => 'stopped',
+            'enable'    => false
+          )
+        }
       end
 
       describe 'service with service_manage equal to false' do
         let :params do
-          { :service_manage => false }
+          { service_manage: false }
         end
 
-        it { should_not contain_service('rabbitmq-server') }
-      end
-
-    end
-  end
-
-  ##
-  ## rabbitmq::install
-  ##
-  context "on RHEL" do
-    let(:facts) {{ :osfamily => 'RedHat' }}
-    let(:params) {{ :package_source => 'http://www.rabbitmq.com/releases/rabbitmq-server/v3.2.3/rabbitmq-server-3.2.3-1.noarch.rpm' }}
-    it 'installs the rabbitmq package' do
-      should contain_package('rabbitmq-server').with(
-        'ensure'   => 'installed',
-        'name'     => 'rabbitmq-server',
-        'provider' => 'rpm',
-        'source'   => 'http://www.rabbitmq.com/releases/rabbitmq-server/v3.2.3/rabbitmq-server-3.2.3-1.noarch.rpm'
-      )
-    end
-  end
-
-  context "on Debian" do
-    let(:facts) {{ :osfamily => 'Debian', :lsbdistid => 'Debian', :lsbdistcodename => 'precise' }}
-    it 'installs the rabbitmq package' do
-      should contain_package('rabbitmq-server').with(
-        'ensure'   => 'installed',
-        'name'     => 'rabbitmq-server',
-        'provider' => 'apt'
-      )
-    end
-  end
-
-  context "on Archlinux" do
-    let(:facts) {{ :osfamily => 'Archlinux' }}
-    it 'installs the rabbitmq package' do
-      should contain_package('rabbitmq-server').with(
-        'ensure'   => 'installed',
-        'name'     => 'rabbitmq')
-    end
-  end
-
-  describe 'repo management on Debian' do
-    let(:facts)  {{ :osfamily => 'Debian', :lsbdistid => 'Debian' }}
-
-    context 'with no pin' do
-      let(:params) {{ :package_apt_pin => '' }}
-      describe 'it sets up an apt::source' do
-
-        it { should contain_apt__source('rabbitmq').with(
-          'location'    => 'http://www.rabbitmq.com/debian/',
-          'release'     => 'testing',
-          'repos'       => 'main',
-          'include_src' => false,
-          'key'         => 'F78372A06FF50C80464FC1B4F7B8CEA6056E8E56'
-        ) }
-      end
-    end
-
-    context 'with pin' do
-      let(:params) {{ :package_apt_pin => '700' }}
-      describe 'it sets up an apt::source and pin' do
-
-        it { should contain_apt__source('rabbitmq').with(
-          'location'    => 'http://www.rabbitmq.com/debian/',
-          'release'     => 'testing',
-          'repos'       => 'main',
-          'include_src' => false,
-          'key'         => 'F78372A06FF50C80464FC1B4F7B8CEA6056E8E56'
-        ) }
-
-        it { should contain_apt__pin('rabbitmq').with(
-          'packages' => 'rabbitmq-server',
-          'priority' => '700'
-        ) }
-
+        it { is_expected.not_to contain_service('rabbitmq-server') }
       end
     end
   end
-
-  ['RedHat', 'SuSE'].each do |distro|
-    describe "repo management on #{distro}" do
-      describe 'imports the key' do
-        let(:facts) {{ :osfamily => distro }}
-        let(:params) {{ :package_gpg_key => 'http://www.rabbitmq.com/rabbitmq-signing-key-public.asc' }}
-
-        it { should contain_exec("rpm --import #{params[:package_gpg_key]}").with(
-          'path' => ['/bin','/usr/bin','/sbin','/usr/sbin']
-        ) }
-      end
-    end
-  end
-
 end
diff --git a/3rdparty/modules/rabbitmq/spec/default_facts.yml b/3rdparty/modules/rabbitmq/spec/default_facts.yml
new file mode 100644 (file)
index 0000000..13c4165
--- /dev/null
@@ -0,0 +1,14 @@
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+#
+# use default_module_facts.yaml for module specific
+# facts.
+#
+# Hint if using with rspec-puppet-facts ("on_supported_os.each"):
+#   if a same named fact exists in facterdb it will be overridden.
+---
+concat_basedir: "/tmp"
+ipaddress: "172.16.254.254"
+is_pe: false
+macaddress: "AA:AA:AA:AA:AA:AA"
diff --git a/3rdparty/modules/rabbitmq/spec/spec.opts b/3rdparty/modules/rabbitmq/spec/spec.opts
deleted file mode 100644 (file)
index 91cd642..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
---format
-s
---colour
---loadby
-mtime
---backtrace
index 2c6f566..ccf76e5 100644 (file)
@@ -1 +1,32 @@
 require 'puppetlabs_spec_helper/module_spec_helper'
+require 'rspec-puppet-facts'
+include RspecPuppetFacts
+
+if Dir.exist?(File.expand_path('../../lib', __FILE__))
+  require 'coveralls'
+  require 'simplecov'
+  require 'simplecov-console'
+  SimpleCov.formatters = [
+    SimpleCov::Formatter::HTMLFormatter,
+    SimpleCov::Formatter::Console
+  ]
+  SimpleCov.start do
+    track_files 'lib/**/*.rb'
+    add_filter '/spec'
+    add_filter '/vendor'
+    add_filter '/.vendor'
+  end
+end
+
+RSpec.configure do |c|
+  default_facts = {
+    puppetversion: Puppet.version,
+    facterversion: Facter.version
+  }
+  default_facts.merge!(YAML.load(File.read(File.expand_path('../default_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_facts.yml', __FILE__))
+  default_facts.merge!(YAML.load(File.read(File.expand_path('../default_module_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_module_facts.yml', __FILE__))
+  c.default_facts = default_facts
+end
+
+require 'spec_helper_local'
+# vim: syntax=ruby
index b82ba36..c52c39b 100644 (file)
 require 'beaker-rspec'
+require 'beaker/puppet_install_helper'
+require 'beaker/module_install_helper'
 
-UNSUPPORTED_PLATFORMS = []
+UNSUPPORTED_PLATFORMS = [].freeze
 
-unless ENV['RS_PROVISION'] == 'no' or ENV['BEAKER_provision'] == 'no'
-  if hosts.first.is_pe?
-    install_pe
-  else
-    install_puppet
-  end
-  hosts.each do |host|
-    on hosts, "mkdir -p #{host['distmoduledir']}"
-  end
-end
+run_puppet_install_helper
+install_module
+install_module_dependencies
 
-RSpec.configure do |c|
-  # Project root
-  proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
+# Install aditional modules for soft deps
+install_module_from_forge('puppetlabs-apt', '>= 4.1.0 < 5.0.0') if fact('os.family') == 'Debian'
+install_module_from_forge('garethr-erlang', '>= 0.3.0 < 1.0.0') if fact('os.family') == 'RedHat'
 
+RSpec.configure do |c|
   # Readable test descriptions
   c.formatter = :documentation
   c.before :suite do
     hosts.each do |host|
-      copy_module_to(host, :source => proj_root, :module_name => 'rabbitmq')
-
-      shell("/bin/touch #{default['puppetpath']}/hiera.yaml")
-      shell('puppet module install puppetlabs-stdlib', { :acceptable_exit_codes => [0,1] })
-      if fact('osfamily') == 'Debian'
-        shell('puppet module install puppetlabs-apt --version 1.8.0 --force', { :acceptable_exit_codes => [0,1] })
-      end
-      shell('puppet module install nanliu-staging', { :acceptable_exit_codes => [0,1] })
-      if fact('osfamily') == 'RedHat'
-        shell('puppet module install garethr-erlang', { :acceptable_exit_codes => [0,1] })
+      if fact('os.family') == 'RedHat' && fact('selinux') == 'true'
+        # Make sure selinux is disabled so the tests work.
+        on host, puppet('apply', '-e',
+                        %("exec { 'setenforce 0': path   => '/bin:/sbin:/usr/bin:/usr/sbin', onlyif => 'which setenforce && getenforce | grep Enforcing', }"))
       end
+
+      # Fake certs
+      on host, 'echo "-----BEGIN RSA PRIVATE KEY-----
+MIICXAIBAAKBgQDw1uXI+EAgxk4dOxArPqMNnnCQqmXeQ61XQQXoAgWWjRvY4LAJ
+4ALoACYWFlWVKQkLLQfQ2YYM3vNDG/eYfL2tjhp9APeJrJYJEcbmr5COURtuIh/Z
+fVKRgV5vtOMdlAHS0HFpk/DP1g520Da9wKwv2nDbfRui0y0ImPWz1uqK8wIDAQAB
+AoGBAJ/cNMgyJ/bZSk5SvwfFWtuWWGdeA6IF0BBDo9T9SpJE9b/+XDshyywNtToh
+9wq8Izmc2TxCtpzifBwGe1FnM0qvioQhwQwJsGa4JJFzSkIt/MgPmojzutnP59RJ
+ozjCgAahX6xEkB6Kn/b2S6D7jgixyMTQ3FdPKq6lJVhXz6Q5AkEA+tSgg/xhrcTs
+5W//hYZP/xjrE27xXzfkNrr/cAtVH5ZM2j2qqKFv3wEn9tAKrUvM+KNDhEjgLUSd
+MjvvH5DYZQJBAPXNjsg4AG09KqWbvcbB2Cgaf6RRTAe+Hx6A7aB01OQohc5uF0ws
+cPxZ8CE/KDbHtNSlx1MAvn8IOoitA06s5HcCQErP/mw/a3bjxHCOXh0aOWPxr7Ol
+JHLs/bFhRuzJRINeVd/GAs+3DuHpu1y/ImAbuq/yKiIbhlmaHHSuMZ0tm40CQHHi
+FzE0oR37pPKtwbOAxEFwZYsgD3XW5Fwhp/cbqjc7fyMxZqHoRUDl+pesx1j6FhIf
+7MXMJnZ8vYHthwbAm+kCQHFH0HULyNcki4zEYSqiLaVMcbB7QybQmBBDA0mJR2HO
+KYdYDeFG3kfeBOReFM9jOt39OBS/nNP0GXFBJU2ahpQ=
+-----END RSA PRIVATE KEY-----" > /tmp/rabbitmq.key'
+      on host, 'echo "-----BEGIN CERTIFICATE-----
+MIIEYTCCAkmgAwIBAgIQVAIiKvJ6YmTSszWEfassuDANBgkqhkiG9w0BAQUFADCB
+qjELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFDASBgNVBAcMC0xv
+cyBBbmdlbGVzMRUwEwYDVQQKDAxBY21lIFdpZGdldHMxETAPBgNVBAsMCFNlY3Vy
+aXR5MR0wGwYDVQQDDBRyYWJiaXRtcS5leGFtcGxlLmNvbTEnMCUGCSqGSIb3DQEJ
+ARYYcm9nZXIucmFiYml0QGV4YW1wbGUuY29tMB4XDTE3MDkxMzAzMzExMloXDTI3
+MDkxMTAzMzExMlowgZUxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTEQMA4GA1UE
+BwwHQ2hpY2FnbzENMAsGA1UECgwEQWNtZTEQMA4GA1UECwwHV2lkZ2V0czEdMBsG
+A1UEAwwUcmFiYml0bXEuZXhhbXBsZS5jb20xJzAlBgkqhkiG9w0BCQEWGHJvZ2Vy
+LnJhYmJpdEBleGFtcGxlLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA
+8NblyPhAIMZOHTsQKz6jDZ5wkKpl3kOtV0EF6AIFlo0b2OCwCeAC6AAmFhZVlSkJ
+Cy0H0NmGDN7zQxv3mHy9rY4afQD3iayWCRHG5q+QjlEbbiIf2X1SkYFeb7TjHZQB
+0tBxaZPwz9YOdtA2vcCsL9pw230botMtCJj1s9bqivMCAwEAAaMaMBgwCQYDVR0T
+BAIwADALBgNVHQ8EBAMCBeAwDQYJKoZIhvcNAQEFBQADggIBAIPXqHlxbo+BpBWz
+H+E7lFDYZkUQD8c34jybxZbwya7od/f9x5jU3F/+6g1Y7A8NAPPxbs+m3Sye0/sz
+WmEz+smKFseGVPWQJ6NgvYJjr8P/MpBUfA7zkkaKs2uuTbPx0tgU1+XGluC1hsZ+
+KQCI0LIEGQlSuT3miPSYL6MPR9o/PTp6TPlYGbL+LLNQedriZRLuiUpOWJzsFyz/
+CcdayANtlWxhuy50A9qUwAa5RzgIJnqfxk5OYuJHq7+p1oCKk+XhgHccHHq7t97M
+Ye/xC18NDTMKkAiggCad0+kYTUgUYnuwvYg4eRpQytsncp7Ck83JChb56eJKlsj1
+HnEkQDyi1B/cKxRKwG81fzkSgw7+0nFY6GAIaGz1GdYBkoxlzN9JNd3/MmS+xAtm
+HXtCqkTWUJQ5ZBinszauPtG4Inu6H28blstlqGjzKTzwo1w8N27shii14IhEHhEV
+tVRxA+ORIt14fZrl04AROsYLqJxqBHy8vJEX4OMm2JTzaO2KdPwEi2gmQK0SkfR8
+TCQc43SF2rqpYs3ZE4fPNlyQR3ZCUcYwjv99s6Nz0Ue4vD9+PuT0McE8NtMgiAMf
+DQqmYIMEiYNm15qKW6jJaY7VMUPGNohfEvubsWPlXPQ6/I7e9bNyk5OnA6OGi4qz
+M2Fcgn+pqLU7M+epynzgz4bsPsEw
+-----END CERTIFICATE-----" > /tmp/rabbitmq.crt'
+      on host, 'echo "-----BEGIN CERTIFICATE-----
+MIIGKTCCBBGgAwIBAgIJAMCISMDHjBJpMA0GCSqGSIb3DQEBBQUAMIGqMQswCQYD
+VQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEUMBIGA1UEBwwLTG9zIEFuZ2Vs
+ZXMxFTATBgNVBAoMDEFjbWUgV2lkZ2V0czERMA8GA1UECwwIU2VjdXJpdHkxHTAb
+BgNVBAMMFHJhYmJpdG1xLmV4YW1wbGUuY29tMScwJQYJKoZIhvcNAQkBFhhyb2dl
+ci5yYWJiaXRAZXhhbXBsZS5jb20wHhcNMTcwOTEzMDMzMTAyWhcNMjcwOTExMDMz
+MTAyWjCBqjELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFDASBgNV
+BAcMC0xvcyBBbmdlbGVzMRUwEwYDVQQKDAxBY21lIFdpZGdldHMxETAPBgNVBAsM
+CFNlY3VyaXR5MR0wGwYDVQQDDBRyYWJiaXRtcS5leGFtcGxlLmNvbTEnMCUGCSqG
+SIb3DQEJARYYcm9nZXIucmFiYml0QGV4YW1wbGUuY29tMIICIjANBgkqhkiG9w0B
+AQEFAAOCAg8AMIICCgKCAgEA2WBjjypMwd4QU2m2K3ChuviDjY/4/c/cwcJBiM2l
+ibQdTO77is5Ub017/z+/Y9kZ4BMO86G97nkafG+mqyuWQj7kaOOAtaZ72Vz4Z2wl
+3eij08OZO4rr3WvYP1VPqgM0FuGxA3iIuP1wl+IhaHLLH+HW5wsnl74pdBC+q7lv
+FKgd1xtCR0bWXVPbiYUi70rL2VA5j+Tp7gJy2XL0/tr3j+KSmqm6zKPrrl4xSLKW
+AZ0o8PFxO9eev5qxf9YYa8LGj7nNLpaqD77ituD27AYdQ4nIaRia4WXyJpyUQ6RS
+z87JsKZELZnQkd6EOXL5C/H0AZHz6KGbU7f4Zpxg0dj0vArunSxoMZRICfuGespi
+KGRCENL12HP7kAM+kdoWXcN5xd+NF+IJqoKORX/P9a8VNA3xn5EGMX/b+gcVOpB3
+0H/gWMYI8M2rnFSDWw+1+qgJfV1meRM6+bj4Fab9mFxMPuqPCsd4YUQdSEOlV7L+
+FpixpbOUEUIGSGCkE0tBdJ2zpStAnB3TsrjYhSU1GsevrdKEa5msfkHTDpZV/9EY
+AXo6WMWHWQe+joxnQzr9r8dlmdsyH0mN+cDxUmlQIwwvHqEtf7CVkN0cx7qKPhQ0
+vHX2NmlfmpgTf5LKnC4xrz8M8OsMfMV5efck0lLYuGKe4wFiBdCoTQvHRuCBncP+
+npMCAwEAAaNQME4wHQYDVR0OBBYEFCkQ7/iSfDsHVL0UcA9vuEB5mqL5MB8GA1Ud
+IwQYMBaAFCkQ7/iSfDsHVL0UcA9vuEB5mqL5MAwGA1UdEwQFMAMBAf8wDQYJKoZI
+hvcNAQEFBQADggIBAEpHP9B7YbsykJ0mMDgXtUog7ZgY5qMf7YFnNrF7Gj0RRRsa
+O9oMSyQbOH6hEgr4b89Vval0ojKg0nWjP/KO73IRwb/eXewWV2THJaKW8Nj0T3mP
+Zai2OHEKIk33qBlAOMbgjL5GTwAbWuwPg8hQYySscOGblknQEdCLweRoCCU9m0dA
+EgQpemsELJoY0i2HkrAVK9+FCmxr0N4ApEckw/+KZxL/Yb0Sz3R3+0FM3JGkbdgi
+2zP5xBEpJszHZqpwsxSwrLbnACrwv7xdxso/ojiW2MWPGqB/g3hHY9PexV732ZNK
+sRN2WJmRQ1G1RzKs8pi352hbra3WDmeEb0AQEuda6sqx6mu0EiomKN5JOq+pltyK
+PvQuBvJV04HwFqpTm7wAJprF1F+9y1B4PDt8c+/CnMBKMOJ9nv84qZEq2ihp65LK
+valeoetcimRCEJ5xnqGCza/sSDHjUMUvMhwMJdq56t0zKMk5pFH6lHxzgAKzX3Gt
+pct+50AzBHUSn0zpB6QRBow2MddivGmTs1IOFdWaSj+Mfdb6phln1Hkv+KW2Wizv
+I28L690yK+Bnk1ezGs+ln6yxiWOdnurckaLkTj6/JFw2x5q/uaTXOxjG/YKKpMQE
+Fq8uI2+DbX/zW18ZIEv6UloGEEWbLO1427+Yyb/THMczWYyH20PTyzT8zFOt
+-----END CERTIFICATE-----" > /tmp/cacert.crt'
     end
   end
 end
 
+shared_examples 'an idempotent resource' do
+  it 'applies with no errors' do
+    apply_manifest(pp, catch_failures: true)
+  end
+
+  it 'applies a second time without changes' do
+    apply_manifest(pp, catch_changes: true)
+  end
+end
diff --git a/3rdparty/modules/rabbitmq/spec/spec_helper_local.rb b/3rdparty/modules/rabbitmq/spec/spec_helper_local.rb
new file mode 100644 (file)
index 0000000..10bda71
--- /dev/null
@@ -0,0 +1,6 @@
+require 'rspec-puppet-facts'
+include RspecPuppetFacts
+#                                                                       # Original fact sources:
+add_custom_fact :puppetversion, Puppet.version                          # Facter, but excluded from rspec-puppet-facts
+add_custom_fact :rabbitmq_version, '3.6.1'                              # puppet-rabbitmq
+add_custom_fact :erl_ssl_path, '/usr/lib64/erlang/lib/ssl-7.3.3.1/ebin' # puppet-rabbitmq
diff --git a/3rdparty/modules/rabbitmq/spec/unit/facter/util/fact_erl_ssl_path_spec.rb b/3rdparty/modules/rabbitmq/spec/unit/facter/util/fact_erl_ssl_path_spec.rb
new file mode 100644 (file)
index 0000000..b32346c
--- /dev/null
@@ -0,0 +1,42 @@
+require 'spec_helper'
+RSpec.configure do |config|
+  config.mock_with :rspec
+end
+
+describe Facter::Util::Fact do
+  before { Facter.clear }
+
+  describe 'erl_ssl_path' do
+    context 'with valid value' do
+      before do
+        allow(Facter::Util::Resolution).to receive(:which).with('erl') { true }
+        allow(Facter::Core::Execution).to receive(:execute).with("erl -eval 'io:format(\"~p\", [code:lib_dir(ssl, ebin)]),halt().' -noshell") { '"/usr/lib64/erlang/lib/ssl-5.3.3/ebin"' }
+      end
+
+      it do
+        expect(Facter.fact(:erl_ssl_path).value).to eq('/usr/lib64/erlang/lib/ssl-5.3.3/ebin')
+      end
+    end
+
+    context 'with error message' do
+      before do
+        allow(Facter::Util::Resolution).to receive(:which).with('erl') { true }
+        allow(Facter::Core::Execution).to receive(:execute).with("erl -eval 'io:format(\"~p\", [code:lib_dir(ssl, ebin)]),halt().' -noshell") { '{error,bad_name}' }
+      end
+
+      it do
+        expect(Facter.fact(:erl_ssl_path).value).to be_nil
+      end
+    end
+
+    context 'with erl not present' do
+      before do
+        allow(Facter::Util::Resolution).to receive(:which).with('erl') { false }
+      end
+
+      it do
+        expect(Facter.fact(:erl_ssl_path).value).to be_nil
+      end
+    end
+  end
+end
diff --git a/3rdparty/modules/rabbitmq/spec/unit/facter/util/fact_rabbitmq_nodename_spec.rb b/3rdparty/modules/rabbitmq/spec/unit/facter/util/fact_rabbitmq_nodename_spec.rb
new file mode 100644 (file)
index 0000000..869cf7a
--- /dev/null
@@ -0,0 +1,101 @@
+require 'spec_helper'
+
+RSpec.configure do |config|
+  config.mock_with :rspec
+end
+
+describe Facter::Util::Fact do
+  before { Facter.clear }
+
+  describe 'rabbitmq_nodename' do
+    context 'with value' do
+      before do
+        allow(Facter::Util::Resolution).to receive(:which).with('rabbitmqctl') { true }
+        allow(Facter::Core::Execution).to receive(:execute).with('rabbitmqctl status 2>&1') { 'Status of node monty@rabbit1 ...' }
+      end
+      it do
+        expect(Facter.fact(:rabbitmq_nodename).value).to eq('monty@rabbit1')
+      end
+    end
+
+    context 'with dashes in hostname' do
+      before do
+        allow(Facter::Util::Resolution).to receive(:which).with('rabbitmqctl') { true }
+        allow(Facter::Core::Execution).to receive(:execute).with('rabbitmqctl status 2>&1') { 'Status of node monty@rabbit-1 ...' }
+      end
+      it do
+        expect(Facter.fact(:rabbitmq_nodename).value).to eq('monty@rabbit-1')
+      end
+    end
+
+    context 'with dashes in nodename/hostname' do
+      before do
+        allow(Facter::Util::Resolution).to receive(:which).with('rabbitmqctl') { true }
+        allow(Facter::Core::Execution).to receive(:execute).with('rabbitmqctl status 2>&1') { 'Status of node monty-python@rabbit-1 ...' }
+      end
+      it do
+        expect(Facter.fact(:rabbitmq_nodename).value).to eq('monty-python@rabbit-1')
+      end
+    end
+
+    context 'with quotes around node name' do
+      before do
+        allow(Facter::Util::Resolution).to receive(:which).with('rabbitmqctl') { true }
+        allow(Facter::Core::Execution).to receive(:execute).with('rabbitmqctl status 2>&1') { 'Status of node \'monty@rabbit-1\' ...' }
+      end
+      it do
+        expect(Facter.fact(:rabbitmq_nodename).value).to eq('monty@rabbit-1')
+      end
+    end
+
+    context 'without trailing points' do
+      before do
+        allow(Facter::Util::Resolution).to receive(:which).with('rabbitmqctl') { true }
+        allow(Facter::Core::Execution).to receive(:execute).with('rabbitmqctl status 2>&1') { 'Status of node monty@rabbit-1' }
+      end
+      it do
+        expect(Facter.fact(:rabbitmq_nodename).value).to eq('monty@rabbit-1')
+      end
+    end
+
+    context 'rabbitmq is not running' do
+      before do
+        error_string = <<-EOS
+Status of node 'monty@rabbit-1' ...
+Error: unable to connect to node 'monty@rabbit-1': nodedown
+
+DIAGNOSTICS
+===========
+
+attempted to contact: ['monty@rabbit-1']
+
+monty@rabbit-1:
+  * connected to epmd (port 4369) on centos-7-x64
+  * epmd reports: node 'rabbit' not running at all
+                  no other nodes on centos-7-x64
+  * suggestion: start the node
+
+current node details:
+- node name: 'rabbitmq-cli-73@centos-7-x64'
+- home dir: /var/lib/rabbitmq
+- cookie hash: 6WdP0nl6d3HYqA5vTKMkIg==
+
+        EOS
+        allow(Facter::Util::Resolution).to receive(:which).with('rabbitmqctl') { true }
+        allow(Facter::Core::Execution).to receive(:execute).with('rabbitmqctl status 2>&1') { error_string }
+      end
+      it do
+        expect(Facter.fact(:rabbitmq_nodename).value).to eq('monty@rabbit-1')
+      end
+    end
+
+    context 'rabbitmqctl is not in path' do
+      before do
+        allow(Facter::Util::Resolution).to receive(:which).with('rabbitmqctl') { false }
+      end
+      it do
+        expect(Facter.fact(:rabbitmq_nodename).value).to be_nil
+      end
+    end
+  end
+end
diff --git a/3rdparty/modules/rabbitmq/spec/unit/facter/util/fact_rabbitmq_version_spec.rb b/3rdparty/modules/rabbitmq/spec/unit/facter/util/fact_rabbitmq_version_spec.rb
new file mode 100644 (file)
index 0000000..65edd33
--- /dev/null
@@ -0,0 +1,31 @@
+require 'spec_helper'
+
+RSpec.configure do |config|
+  config.mock_with :rspec
+end
+
+describe Facter::Util::Fact do
+  before do
+    Facter.clear
+  end
+
+  describe 'rabbitmq_version' do
+    context 'with value' do
+      before do
+        allow(Facter::Util::Resolution).to receive(:which).with('rabbitmqadmin') { true }
+        allow(Facter::Core::Execution).to receive(:execute).with('rabbitmqadmin --version 2>&1') { 'rabbitmqadmin 3.6.0' }
+      end
+      it do
+        expect(Facter.fact(:rabbitmq_version).value).to eq('3.6.0')
+      end
+    end
+    context 'rabbitmqadmin is not in path' do
+      before do
+        allow(Facter::Util::Resolution).to receive(:which).with('rabbitmqadmin') { false }
+      end
+      it do
+        expect(Facter.fact(:rabbitmq_version).value).to be_nil
+      end
+    end
+  end
+end
index e165d55..04015a3 100644 (file)
-require 'puppet'
-require 'mocha/api'
-RSpec.configure do |config|
-  config.mock_with :mocha
-end
+require 'spec_helper'
+
 provider_class = Puppet::Type.type(:rabbitmq_binding).provider(:rabbitmqadmin)
 describe provider_class do
-  before :each do
-    @resource = Puppet::Type::Rabbitmq_binding.new(
-      {:name => 'source@target@/',
-       :destination_type => :queue,
-       :routing_key => 'blablub',
-       :arguments => {}
-      }
+  let(:resource) do
+    Puppet::Type::Rabbitmq_binding.new(
+      name: 'source@target@/',
+      destination_type: :queue,
+      routing_key: 'blablub',
+      arguments: {}
     )
-    @provider = provider_class.new(@resource)
   end
+  let(:provider) { provider_class.new(resource) }
 
-  it 'should return instances' do
-    provider_class.expects(:rabbitmqctl).with('list_vhosts', '-q').returns <<-EOT
+  # rubocop:disable RSpec/MultipleExpectations
+  describe '#instances' do
+    it 'returns instances' do
+      provider_class.expects(:rabbitmqctl).with('list_vhosts', '-q').returns <<-EOT
 /
 EOT
-    provider_class.expects(:rabbitmqctl).with('list_bindings', '-q', '-p', '/', 'source_name', 'destination_name', 'destination_kind', 'routing_key', 'arguments').returns <<-EOT
-    queue queue queue []
+      provider_class.expects(:rabbitmqctl).with(
+        'list_bindings', '-q', '-p', '/', 'source_name', 'destination_name', 'destination_kind', 'routing_key', 'arguments'
+      ).returns <<-EOT
+exchange\tdst_queue\tqueue\t*\t[]
 EOT
-    instances = provider_class.instances
-    instances.size.should == 1
-  end
-  
-  it 'should call rabbitmqadmin to create' do
-    @provider.expects(:rabbitmqadmin).with('declare', 'binding', '--vhost=/', '--user=guest', '--password=guest', '-c', '/etc/rabbitmq/rabbitmqadmin.conf', 'source=source', 'destination=target', 'arguments={}', 'routing_key=blablub', 'destination_type=queue')
-    @provider.create
+      instances = provider_class.instances
+      expect(instances.size).to eq(1)
+      expect(instances.map do |prov|
+        {
+          source: prov.get(:source),
+          destination: prov.get(:destination),
+          vhost: prov.get(:vhost),
+          routing_key: prov.get(:routing_key)
+        }
+      end).to eq([
+                   {
+                     source: 'exchange',
+                     destination: 'dst_queue',
+                     vhost: '/',
+                     routing_key: '*'
+                   }
+                 ])
+    end
+    # rubocop:enable RSpec/MultipleExpectations
+
+    # rubocop:disable RSpec/MultipleExpectations
+    it 'returns multiple instances' do
+      provider_class.expects(:rabbitmqctl).with('list_vhosts', '-q').returns <<-EOT
+/
+EOT
+      provider_class.expects(:rabbitmqctl).with(
+        'list_bindings', '-q', '-p', '/', 'source_name', 'destination_name', 'destination_kind', 'routing_key', 'arguments'
+      ).returns <<-EOT
+exchange\tdst_queue\tqueue\trouting_one\t[]
+exchange\tdst_queue\tqueue\trouting_two\t[]
+EOT
+      instances = provider_class.instances
+      expect(instances.size).to eq(2)
+      expect(instances.map do |prov|
+        {
+          source: prov.get(:source),
+          destination: prov.get(:destination),
+          vhost: prov.get(:vhost),
+          routing_key: prov.get(:routing_key)
+        }
+      end).to eq([
+                   {
+                     source: 'exchange',
+                     destination: 'dst_queue',
+                     vhost: '/',
+                     routing_key: 'routing_one'
+                   },
+                   {
+                     source: 'exchange',
+                     destination: 'dst_queue',
+                     vhost: '/',
+                     routing_key: 'routing_two'
+                   }
+                 ])
+    end
   end
+  # rubocop:enable RSpec/MultipleExpectations
+
+  describe 'Test for prefetch error' do
+    let(:resource) do
+      Puppet::Type::Rabbitmq_binding.new(
+        name: 'binding1',
+        source: 'exchange1',
+        destination: 'destqueue',
+        destination_type: :queue,
+        routing_key: 'blablubd',
+        arguments: {}
+      )
+    end
+
+    it 'exists' do
+      provider_class.expects(:rabbitmqctl).with('list_vhosts', '-q').returns <<-EOT
+/
+EOT
+      provider_class.expects(:rabbitmqctl).with(
+        'list_bindings', '-q', '-p', '/', 'source_name', 'destination_name', 'destination_kind', 'routing_key', 'arguments'
+      ).returns <<-EOT
+exchange\tdst_queue\tqueue\t*\t[]
+EOT
+
+      provider_class.prefetch({})
+    end
 
-  it 'should call rabbitmqadmin to destroy' do
-    @provider.expects(:rabbitmqadmin).with('delete', 'binding', '--vhost=/', '--user=guest', '--password=guest', '-c', '/etc/rabbitmq/rabbitmqadmin.conf', 'source=source', 'destination_type=queue', 'destination=target', 'properties_key=blablub')
-    @provider.destroy
+    it 'matches' do
+      # Test resource to match against
+      provider_class.expects(:rabbitmqctl).with('list_vhosts', '-q').returns <<-EOT
+/
+EOT
+      provider_class.expects(:rabbitmqctl).with(
+        'list_bindings', '-q', '-p', '/', 'source_name', 'destination_name', 'destination_kind', 'routing_key', 'arguments'
+      ).returns <<-EOT
+exchange\tdst_queue\tqueue\t*\t[]
+EOT
+
+      provider_class.prefetch('binding1' => resource)
+    end
   end
 
-  context 'specifying credentials' do
-    before :each do
-      @resource = Puppet::Type::Rabbitmq_binding.new(
-        {:name => 'source@test2@/',
-         :destination_type => :queue,
-         :routing_key => 'blablubd',
-         :arguments => {},
-         :user => 'colin',
-         :password => 'secret'
-        }
+  describe '#create' do
+    it 'calls rabbitmqadmin to create' do
+      provider.expects(:rabbitmqadmin).with(
+        'declare', 'binding', '--vhost=/', '--user=guest', '--password=guest', '-c', '/etc/rabbitmq/rabbitmqadmin.conf',
+        'source=source', 'destination=target', 'arguments={}', 'routing_key=blablub', 'destination_type=queue'
       )
-      @provider = provider_class.new(@resource)
+      provider.create
     end
 
-    it 'should call rabbitmqadmin to create' do
-      @provider.expects(:rabbitmqadmin).with('declare', 'binding', '--vhost=/', '--user=colin', '--password=secret', '-c', '/etc/rabbitmq/rabbitmqadmin.conf', 'source=source', 'destination=test2', 'arguments={}', 'routing_key=blablubd', 'destination_type=queue')
-      @provider.create
+    context 'specifying credentials' do
+      let(:resource) do
+        Puppet::Type::Rabbitmq_binding.new(
+          name: 'source@test2@/',
+          destination_type: :queue,
+          routing_key: 'blablubd',
+          arguments: {},
+          user: 'colin',
+          password: 'secret'
+        )
+      end
+      let(:provider) { provider_class.new(resource) }
+
+      it 'calls rabbitmqadmin to create' do
+        provider.expects(:rabbitmqadmin).with(
+          'declare', 'binding', '--vhost=/', '--user=colin', '--password=secret', '-c', '/etc/rabbitmq/rabbitmqadmin.conf',
+          'source=source', 'destination=test2', 'arguments={}', 'routing_key=blablubd', 'destination_type=queue'
+        )
+        provider.create
+      end
+    end
+
+    context 'new queue_bindings' do
+      let(:resource) do
+        Puppet::Type::Rabbitmq_binding.new(
+          name: 'binding1',
+          source: 'exchange1',
+          destination: 'destqueue',
+          destination_type: :queue,
+          routing_key: 'blablubd',
+          arguments: {}
+        )
+      end
+      let(:provider) { provider_class.new(resource) }
+
+      it 'calls rabbitmqadmin to create' do
+        provider.expects(:rabbitmqadmin).with(
+          'declare', 'binding', '--vhost=/', '--user=guest', '--password=guest', '-c', '/etc/rabbitmq/rabbitmqadmin.conf',
+          'source=exchange1', 'destination=destqueue', 'arguments={}', 'routing_key=blablubd', 'destination_type=queue'
+        )
+        provider.create
+      end
+    end
+  end
+
+  describe '#destroy' do
+    it 'calls rabbitmqadmin to destroy' do
+      provider.expects(:rabbitmqadmin).with(
+        'delete', 'binding', '--vhost=/', '--user=guest', '--password=guest', '-c', '/etc/rabbitmq/rabbitmqadmin.conf',
+        'source=source', 'destination_type=queue', 'destination=target', 'properties_key=blablub'
+      )
+      provider.destroy
     end
   end
 end
index 10e39ac..709e55a 100644 (file)
@@ -1,26 +1,22 @@
-require 'puppet'
-require 'mocha'
-RSpec.configure do |config|
-  config.mock_with :mocha
-end
+require 'spec_helper'
+
 provider_class = Puppet::Type.type(:rabbitmq_exchange).provider(:rabbitmqadmin)
 describe provider_class do
-  before :each do
-    @resource = Puppet::Type::Rabbitmq_exchange.new(
-      {:name => 'test.headers@/',
-       :type => :headers,
-       :internal => :false,
-       :durable => :true,
-       :auto_delete => :false,
-       :arguments => {
-        "hash-headers" => "message-distribution-hash" 
-        },
+  let(:resource) do
+    Puppet::Type::Rabbitmq_exchange.new(
+      name: 'test.headers@/',
+      type: :headers,
+      internal: :false,
+      durable: :true,
+      auto_delete: :false,
+      arguments: {
+        'hash-headers' => 'message-distribution-hash'
       }
     )
-    @provider = provider_class.new(@resource)
   end
+  let(:provider) { provider_class.new(resource) }
 
-  it 'should return instances' do
+  it 'returns instances' do
     provider_class.expects(:rabbitmqctl).with('-q', 'list_vhosts').returns <<-EOT
 /
 EOT
@@ -36,40 +32,39 @@ amq.topic       topic   false   true    false   []
 test.headers    x-consistent-hash       false   true    false   [{"hash-header","message-distribution-hash"}]
 EOT
     instances = provider_class.instances
-    instances.size.should == 9
+    expect(instances.size).to eq(9)
   end
 
-  it 'should call rabbitmqadmin to create as guest' do
-    @provider.expects(:rabbitmqadmin).with('declare', 'exchange', '--vhost=/', '--user=guest', '--password=guest', 'name=test.headers', 'type=headers', 'internal=false', 'durable=true', 'auto_delete=false', 'arguments={"hash-headers":"message-distribution-hash"}', '-c', '/etc/rabbitmq/rabbitmqadmin.conf')
-    @provider.create
+  it 'calls rabbitmqadmin to create as guest' do
+    provider.expects(:rabbitmqadmin).with('declare', 'exchange', '--vhost=/', '--user=guest', '--password=guest', 'name=test.headers', 'type=headers', 'internal=false', 'durable=true', 'auto_delete=false', 'arguments={"hash-headers":"message-distribution-hash"}', '-c', '/etc/rabbitmq/rabbitmqadmin.conf')
+    provider.create
   end
 
-  it 'should call rabbitmqadmin to destroy' do
-    @provider.expects(:rabbitmqadmin).with('delete', 'exchange', '--vhost=/', '--user=guest', '--password=guest', 'name=test.headers', '-c', '/etc/rabbitmq/rabbitmqadmin.conf')
-    @provider.destroy
+  it 'calls rabbitmqadmin to destroy' do
+    provider.expects(:rabbitmqadmin).with('delete', 'exchange', '--vhost=/', '--user=guest', '--password=guest', 'name=test.headers', '-c', '/etc/rabbitmq/rabbitmqadmin.conf')
+    provider.destroy
   end
 
   context 'specifying credentials' do
-    before :each do
-      @resource = Puppet::Type::Rabbitmq_exchange.new(
-        {:name => 'test.headers@/',
-        :type => :headers,
-        :internal => 'false',
-        :durable => 'true',
-        :auto_delete => 'false',
-        :user => 'colin',
-        :password => 'secret',
-        :arguments => {
-          "hash-header" => "message-distribution-hash"
-        },
-      }
+    let(:resource) do
+      Puppet::Type::Rabbitmq_exchange.new(
+        name: 'test.headers@/',
+        type: :headers,
+        internal: 'false',
+        durable: 'true',
+        auto_delete: 'false',
+        user: 'colin',
+        password: 'secret',
+        arguments: {
+          'hash-header' => 'message-distribution-hash'
+        }
       )
-      @provider = provider_class.new(@resource)
     end
+    let(:provider) { provider_class.new(resource) }
 
-    it 'should call rabbitmqadmin to create with credentials' do
-      @provider.expects(:rabbitmqadmin).with('declare', 'exchange', '--vhost=/', '--user=colin', '--password=secret', 'name=test.headers', 'type=headers', 'internal=false', 'durable=true', 'auto_delete=false', 'arguments={"hash-header":"message-distribution-hash"}', '-c', '/etc/rabbitmq/rabbitmqadmin.conf')
-      @provider.create
+    it 'calls rabbitmqadmin to create with credentials' do
+      provider.expects(:rabbitmqadmin).with('declare', 'exchange', '--vhost=/', '--user=colin', '--password=secret', 'name=test.headers', 'type=headers', 'internal=false', 'durable=true', 'auto_delete=false', 'arguments={"hash-header":"message-distribution-hash"}', '-c', '/etc/rabbitmq/rabbitmqadmin.conf')
+      provider.create
     end
   end
 end
diff --git a/3rdparty/modules/rabbitmq/spec/unit/puppet/provider/rabbitmq_parameter/rabbitmqctl_spec.rb b/3rdparty/modules/rabbitmq/spec/unit/puppet/provider/rabbitmq_parameter/rabbitmqctl_spec.rb
new file mode 100644 (file)
index 0000000..5162edd
--- /dev/null
@@ -0,0 +1,84 @@
+require 'spec_helper'
+
+describe Puppet::Type.type(:rabbitmq_parameter).provider(:rabbitmqctl) do
+  let(:resource) do
+    Puppet::Type.type(:rabbitmq_parameter).new(
+      name: 'documentumShovel@/',
+      component_name: 'shovel',
+      value: {
+        'src-uri'    => 'amqp://',
+        'src-queue'  => 'my-queue',
+        'dest-uri'   => 'amqp://remote-server',
+        'dest-queue' => 'another-queue'
+      },
+      provider: described_class.name
+    )
+  end
+  let(:provider) { resource.provider }
+
+  after do
+    described_class.instance_variable_set(:@parameters, nil)
+  end
+
+  context 'has "@" in parameter name' do
+    let(:resource) do
+      Puppet::Type.type(:rabbitmq_parameter).new(
+        name: 'documentumShovel@/',
+        component_name: 'shovel',
+        value: {
+          'src-uri'    => 'amqp://',
+          'src-queue'  => 'my-queue',
+          'dest-uri'   => 'amqp://remote-server',
+          'dest-queue' => 'another-queue'
+        },
+        provider: described_class.name
+      )
+    end
+    let(:provider) { described_class.new(resource) }
+
+    it do
+      expect(provider.should_parameter).to eq('documentumShovel')
+    end
+
+    it do
+      expect(provider.should_vhost).to eq('/')
+    end
+  end
+
+  it 'fails with invalid output from list' do
+    provider.class.expects(:rabbitmqctl).with('list_parameters', '-q', '-p', '/').returns 'foobar'
+    expect { provider.exists? }.to raise_error(Puppet::Error, %r{cannot parse line from list_parameter})
+  end
+
+  it 'matches parameters from list' do
+    provider.class.expects(:rabbitmqctl).with('list_parameters', '-q', '-p', '/').returns <<-EOT
+shovel  documentumShovel  {"src-uri":"amqp://","src-queue":"my-queue","dest-uri":"amqp://remote-server","dest-queue":"another-queue"}
+EOT
+    expect(provider.exists?).to eq(component_name: 'shovel',
+                                   value: {
+                                     'src-uri' => 'amqp://',
+                                     'src-queue'  => 'my-queue',
+                                     'dest-uri'   => 'amqp://remote-server',
+                                     'dest-queue' => 'another-queue'
+                                   })
+  end
+
+  it 'does not match an empty list' do
+    provider.class.expects(:rabbitmqctl).with('list_parameters', '-q', '-p', '/').returns ''
+    expect(provider.exists?).to eq(nil)
+  end
+
+  it 'destroys parameter' do
+    provider.expects(:rabbitmqctl).with('clear_parameter', '-p', '/', 'shovel', 'documentumShovel')
+    provider.destroy
+  end
+
+  it 'onlies call set_parameter once' do
+    provider.expects(:rabbitmqctl).with('set_parameter',
+                                        '-p', '/',
+                                        'shovel',
+                                        'documentumShovel',
+                                        '{"src-uri":"amqp://","src-queue":"my-queue","dest-uri":"amqp://remote-server","dest-queue":"another-queue"}').once
+    provider.create
+  end
+end
index c398b62..3c0a757 100644 (file)
@@ -1,26 +1,24 @@
-require 'puppet'
-require 'mocha'
-RSpec.configure do |config|
-  config.mock_with :mocha
-end
+require 'spec_helper'
+
 provider_class = Puppet::Type.type(:rabbitmq_plugin).provider(:rabbitmqplugins)
 describe provider_class do
-  before :each do
-    @resource = Puppet::Type::Rabbitmq_plugin.new(
-      {:name => 'foo'}
+  let(:resource) do
+    Puppet::Type::Rabbitmq_plugin.new(
+      name: 'foo'
     )
-    @provider = provider_class.new(@resource)
   end
-  it 'should match plugins' do
-    @provider.expects(:rabbitmqplugins).with('list', '-E', '-m').returns("foo\n")
-    @provider.exists?.should == 'foo'
+  let(:provider) { provider_class.new(resource) }
+
+  it 'matches plugins' do
+    provider.expects(:rabbitmqplugins).with('list', '-E', '-m').returns("foo\n")
+    expect(provider.exists?).to eq(true)
   end
-  it 'should call rabbitmqplugins to enable' do
-    @provider.expects(:rabbitmqplugins).with('enable', 'foo')
-    @provider.create
+  it 'calls rabbitmqplugins to enable' do
+    provider.expects(:rabbitmqplugins).with('enable', 'foo')
+    provider.create
   end
-  it 'should call rabbitmqplugins to disable' do
-    @provider.expects(:rabbitmqplugins).with('disable', 'foo')
-    @provider.destroy
+  it 'calls rabbitmqplugins to disable' do
+    provider.expects(:rabbitmqplugins).with('disable', 'foo')
+    provider.destroy
   end
 end
index cddb6c0..075602c 100644 (file)
-require 'puppet'
-require 'mocha'
-
-RSpec.configure do |config|
-  config.mock_with :mocha
-end
+require 'spec_helper'
 
 describe Puppet::Type.type(:rabbitmq_policy).provider(:rabbitmqctl) do
-
   let(:resource) do
     Puppet::Type.type(:rabbitmq_policy).new(
-      :name       => 'ha-all@/',
-      :pattern    => '.*',
-      :definition => {
+      name: 'ha-all@/',
+      pattern: '.*',
+      definition: {
         'ha-mode' => 'all'
-      },
-      :provider => described_class.name
+      }
     )
   end
+  let(:provider) { described_class.new(resource) }
 
-  let(:provider) { resource.provider }
-
-  after(:each) do
+  after do
     described_class.instance_variable_set(:@policies, nil)
   end
 
-  it 'should accept @ in policy name' do
-    resource = Puppet::Type.type(:rabbitmq_policy).new(
-      :name       => 'ha@home@/',
-      :pattern    => '.*',
-      :definition => {
-        'ha-mode' => 'all'
-      },
-      :provider => described_class.name
-    )
-    provider = described_class.new(resource)
-    provider.should_policy.should == 'ha@home'
-    provider.should_vhost.should == '/'
+  context 'has "@" in policy name' do
+    let(:resource) do
+      Puppet::Type.type(:rabbitmq_policy).new(
+        name: 'ha@home@/',
+        pattern: '.*',
+        definition: {
+          'ha-mode' => 'all'
+        },
+        provider: described_class.name
+      )
+    end
+    let(:provider) { described_class.new(resource) }
+
+    it do
+      expect(provider.should_policy).to eq('ha@home')
+    end
+
+    it do
+      expect(provider.should_vhost).to eq('/')
+    end
   end
 
-  it 'should fail with invalid output from list' do
+  it 'fails with invalid output from list' do
+    provider.class.expects(:rabbitmqctl).with('-q', 'status').returns '{rabbit,"RabbitMQ","3.1.5"}'
     provider.class.expects(:rabbitmqctl).with('list_policies', '-q', '-p', '/').returns 'foobar'
-    expect { provider.exists? }.to raise_error(Puppet::Error, /cannot parse line from list_policies/)
+    expect { provider.exists? }.to raise_error(Puppet::Error, %r{cannot parse line from list_policies})
   end
 
-  it 'should match policies from list (>=3.2.0)' do
-    provider.class.expects(:rabbitmqctl).with('list_policies', '-q', '-p', '/').returns <<-EOT
+  context 'with RabbitMQ version >=3.7.0' do
+    it 'matches policies from list' do
+      provider.class.expects(:rabbitmq_version).returns '3.7.0'
+      provider.class.expects(:rabbitmqctl).with('list_policies', '-q', '-p', '/').returns <<-EOT
+/ ha-all .* all {"ha-mode":"all","ha-sync-mode":"automatic"} 0
+/ test .* exchanges {"ha-mode":"all"} 0
+EOT
+      expect(provider.exists?).to eq(applyto: 'all',
+                                     pattern: '.*',
+                                     priority: '0',
+                                     definition: {
+                                       'ha-mode'      => 'all',
+                                       'ha-sync-mode' => 'automatic'
+                                     })
+    end
+  end
+
+  context 'with RabbitMQ version >=3.2.0 and < 3.7.0' do
+    it 'matches policies from list' do
+      provider.class.expects(:rabbitmq_version).returns '3.6.9'
+      provider.class.expects(:rabbitmqctl).with('list_policies', '-q', '-p', '/').returns <<-EOT
 / ha-all all .* {"ha-mode":"all","ha-sync-mode":"automatic"} 0
 / test exchanges .* {"ha-mode":"all"} 0
 EOT
-    provider.exists?.should == {
-      :applyto    => 'all',
-      :pattern    => '.*',
-      :priority   => '0',
-      :definition => {
-        'ha-mode'      => 'all',
-        'ha-sync-mode' => 'automatic'}
-      }
+      expect(provider.exists?).to eq(applyto: 'all',
+                                     pattern: '.*',
+                                     priority: '0',
+                                     definition: {
+                                       'ha-mode'      => 'all',
+                                       'ha-sync-mode' => 'automatic'
+                                     })
+    end
   end
 
-  it 'should match policies from list (<3.2.0)' do
-    provider.class.expects(:rabbitmqctl).with('list_policies', '-q', '-p', '/').returns <<-EOT
+  context 'with RabbitMQ version <3.2.0' do
+    it 'matches policies from list (<3.2.0)' do
+      provider.class.expects(:rabbitmq_version).returns '3.1.5'
+      provider.class.expects(:rabbitmqctl).with('list_policies', '-q', '-p', '/').returns <<-EOT
 / ha-all .* {"ha-mode":"all","ha-sync-mode":"automatic"} 0
 / test .* {"ha-mode":"all"} 0
 EOT
-    provider.exists?.should == {
-      :applyto    => 'all',
-      :pattern    => '.*',
-      :priority   => '0',
-      :definition => {
-        'ha-mode'      => 'all',
-        'ha-sync-mode' => 'automatic'}
-      }
+      expect(provider.exists?).to eq(applyto: 'all',
+                                     pattern: '.*',
+                                     priority: '0',
+                                     definition: {
+                                       'ha-mode'      => 'all',
+                                       'ha-sync-mode' => 'automatic'
+                                     })
+    end
   end
 
-  it 'should not match an empty list' do
+  it 'does not match an empty list' do
+    provider.class.expects(:rabbitmqctl).with('-q', 'status').returns '{rabbit,"RabbitMQ","3.1.5"}'
     provider.class.expects(:rabbitmqctl).with('list_policies', '-q', '-p', '/').returns ''
-    provider.exists?.should == nil
+    expect(provider.exists?).to eq(nil)
   end
 
-  it 'should destroy policy' do
+  it 'destroys policy' do
     provider.expects(:rabbitmqctl).with('clear_policy', '-p', '/', 'ha-all')
     provider.destroy
   end
 
-  it 'should only call set_policy once (<3.2.0)' do
+  it 'onlies call set_policy once (<3.2.0)' do
     provider.class.expects(:rabbitmq_version).returns '3.1.0'
     provider.resource[:priority] = '10'
     provider.resource[:applyto] = 'exchanges'
     provider.expects(:rabbitmqctl).with('set_policy',
-      '-p', '/',
-      'ha-all',
-      '.*',
-      '{"ha-mode":"all"}',
-      '10').once
+                                        '-p', '/',
+                                        'ha-all',
+                                        '.*',
+                                        '{"ha-mode":"all"}',
+                                        '10').once
     provider.priority = '10'
     provider.applyto = 'exchanges'
   end
 
-  it 'should only call set_policy once (>=3.2.0)' do
+  it 'onlies call set_policy once (>=3.2.0)' do
     provider.class.expects(:rabbitmq_version).returns '3.2.0'
     provider.resource[:priority] = '10'
     provider.resource[:applyto] = 'exchanges'
     provider.expects(:rabbitmqctl).with('set_policy',
-      '-p', '/',
-      '--priority', '10',
-      '--apply-to', 'exchanges',
-      'ha-all',
-      '.*',
-      '{"ha-mode":"all"}').once
+                                        '-p', '/',
+                                        '--priority', '10',
+                                        '--apply-to', 'exchanges',
+                                        'ha-all',
+                                        '.*',
+                                        '{"ha-mode":"all"}').once
     provider.priority = '10'
     provider.applyto = 'exchanges'
   end
index 85843da..c07a182 100644 (file)
@@ -1,22 +1,18 @@
-require 'puppet'
-require 'mocha/api'
-RSpec.configure do |config|
-  config.mock_with :mocha
-end
+require 'spec_helper'
+
 provider_class = Puppet::Type.type(:rabbitmq_queue).provider(:rabbitmqadmin)
 describe provider_class do
-  before :each do
-    @resource = Puppet::Type::Rabbitmq_queue.new(
-      {:name => 'test@/',
-       :durable => :true,
-       :auto_delete => :false,
-       :arguments => {}
-      }
+  let(:resource) do
+    Puppet::Type::Rabbitmq_queue.new(
+      name: 'test@/',
+      durable: :true,
+      auto_delete: :false,
+      arguments: {}
     )
-    @provider = provider_class.new(@resource)
   end
+  let(:provider) { provider_class.new(resource) }
 
-  it 'should return instances' do
+  it 'returns instances' do
     provider_class.expects(:rabbitmqctl).with('list_vhosts', '-q').returns <<-EOT
 /
 EOT
@@ -25,36 +21,35 @@ test  true  false []
 test2 true  false [{"x-message-ttl",342423},{"x-expires",53253232},{"x-max-length",2332},{"x-max-length-bytes",32563324242},{"x-dead-letter-exchange","amq.direct"},{"x-dead-letter-routing-key","test.routing"}]
 EOT
     instances = provider_class.instances
-    instances.size.should == 2
+    expect(instances.size).to eq(2)
   end
 
-  it 'should call rabbitmqadmin to create' do
-    @provider.expects(:rabbitmqadmin).with('declare', 'queue', '--vhost=/', '--user=guest', '--password=guest', '-c', '/etc/rabbitmq/rabbitmqadmin.conf', 'name=test', 'durable=true', 'auto_delete=false', 'arguments={}')
-    @provider.create
+  it 'calls rabbitmqadmin to create' do
+    provider.expects(:rabbitmqadmin).with('declare', 'queue', '--vhost=/', '--user=guest', '--password=guest', '-c', '/etc/rabbitmq/rabbitmqadmin.conf', 'name=test', 'durable=true', 'auto_delete=false', 'arguments={}')
+    provider.create
   end
 
-  it 'should call rabbitmqadmin to destroy' do
-    @provider.expects(:rabbitmqadmin).with('delete', 'queue', '--vhost=/', '--user=guest', '--password=guest', '-c', '/etc/rabbitmq/rabbitmqadmin.conf', 'name=test')
-    @provider.destroy
+  it 'calls rabbitmqadmin to destroy' do
+    provider.expects(:rabbitmqadmin).with('delete', 'queue', '--vhost=/', '--user=guest', '--password=guest', '-c', '/etc/rabbitmq/rabbitmqadmin.conf', 'name=test')
+    provider.destroy
   end
 
   context 'specifying credentials' do
-    before :each do
-      @resource = Puppet::Type::Rabbitmq_queue.new(
-        {:name => 'test@/',
-        :durable => 'true',
-        :auto_delete => 'false',
-        :arguments => {},
-        :user => 'colin',
-        :password => 'secret',
-        }
+    let(:resource) do
+      Puppet::Type::Rabbitmq_queue.new(
+        name: 'test@/',
+        durable: 'true',
+        auto_delete: 'false',
+        arguments: {},
+        user: 'colin',
+        password: 'secret'
       )
-      @provider = provider_class.new(@resource)
     end
+    let(:provider) { provider_class.new(resource) }
 
-    it 'should call rabbitmqadmin to create' do
-      @provider.expects(:rabbitmqadmin).with('declare', 'queue', '--vhost=/', '--user=colin', '--password=secret', '-c', '/etc/rabbitmq/rabbitmqadmin.conf', 'name=test', 'durable=true', 'auto_delete=false', 'arguments={}')
-      @provider.create
+    it 'calls rabbitmqadmin to create' do
+      provider.expects(:rabbitmqadmin).with('declare', 'queue', '--vhost=/', '--user=colin', '--password=secret', '-c', '/etc/rabbitmq/rabbitmqadmin.conf', 'name=test', 'durable=true', 'auto_delete=false', 'arguments={}')
+      provider.create
     end
   end
 end
index ed828ea..0fd7d9c 100644 (file)
-require 'puppet'
-require 'mocha'
-RSpec.configure do |config|
-  config.mock_with :mocha
-end
+require 'spec_helper'
+
 provider_class = Puppet::Type.type(:rabbitmq_user).provider(:rabbitmqctl)
 describe provider_class do
-  before :each do
-    @resource = Puppet::Type::Rabbitmq_user.new(
-      {:name => 'foo', :password => 'bar'}
+  let(:resource) do
+    Puppet::Type.type(:rabbitmq_user).new(
+      ensure: :present,
+      name: 'rmq_x',
+      password: 'secret',
+      provider: described_class.name
     )
-    @provider = provider_class.new(@resource)
-  end
-  it 'should match user names' do
-    @provider.expects(:rabbitmqctl).with('-q', 'list_users').returns <<-EOT
-foo
-EOT
-    @provider.exists?.should == 'foo'
-  end
-  it 'should match user names with 2.4.1 syntax' do
-    @provider.expects(:rabbitmqctl).with('-q', 'list_users').returns <<-EOT
-foo bar
-EOT
-    @provider.exists?.should == 'foo bar'
-  end
-  it 'should not match if no users on system' do
-    @provider.expects(:rabbitmqctl).with('-q', 'list_users').returns <<-EOT
-EOT
-    @provider.exists?.should be_nil
-  end
-  it 'should not match if no matching users on system' do
-    @provider.expects(:rabbitmqctl).with('-q', 'list_users').returns <<-EOT
-fooey
-EOT
-    @provider.exists?.should be_nil
-  end
-  it 'should match user names from list' do
-    @provider.expects(:rabbitmqctl).with('-q', 'list_users').returns <<-EOT
-one
-two three
-foo
-bar
-EOT
-    @provider.exists?.should == 'foo'
-  end
-  it 'should create user and set password' do
-    @resource[:password] = 'bar'
-    @provider.expects(:rabbitmqctl).with('add_user', 'foo', 'bar')
-    @provider.create
-  end
-  it 'should create user, set password and set to admin' do
-    @resource[:password] = 'bar'
-    @resource[:admin] = 'true'
-    @provider.expects(:rabbitmqctl).with('add_user', 'foo', 'bar')
-    @provider.expects(:rabbitmqctl).with('-q', 'list_users').returns <<-EOT
-foo   []
-icinga  [monitoring]
-kitchen []
-kitchen2        [abc, def, ghi]
-EOT
-    @provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ['administrator'])
-    @provider.create
-  end
-  it 'should call rabbitmqctl to delete' do
-    @provider.expects(:rabbitmqctl).with('delete_user', 'foo')
-    @provider.destroy
-  end
-  it 'should be able to retrieve admin value' do
-    @provider.expects(:rabbitmqctl).with('-q', 'list_users').returns <<-EOT
-foo [administrator]
-EOT
-    @provider.admin.should == :true
-    @provider.expects(:rabbitmqctl).with('-q', 'list_users').returns <<-EOT
-one [administrator]
-foo []
-EOT
-    @provider.admin.should == :false
-  end
-  it 'should fail if admin value is invalid' do
-    @provider.expects(:rabbitmqctl).with('-q', 'list_users').returns <<-EOT
-foo fail
-EOT
-    expect { @provider.admin }.to raise_error(Puppet::Error, /Could not match line/)
-  end
-  it 'should be able to set admin value' do
-    @provider.expects(:rabbitmqctl).with('-q', 'list_users').returns <<-EOT
-foo   []
-icinga  [monitoring]
-kitchen []
-kitchen2        [abc, def, ghi]
-EOT
-    @provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ['administrator'])
-    @provider.admin=:true
-  end
-  it 'should not interfere with existing tags on the user when setting admin value' do
-    @provider.expects(:rabbitmqctl).with('-q', 'list_users').returns <<-EOT
-foo   [bar, baz]
-icinga  [monitoring]
-kitchen []
-kitchen2        [abc, def, ghi]
-EOT
-    @provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ['bar','baz', 'administrator'].sort)
-    @provider.admin=:true
-  end
-  it 'should be able to unset admin value' do
-    @provider.expects(:rabbitmqctl).with('-q', 'list_users').returns <<-EOT
-foo     [administrator]
-guest   [administrator]
-icinga  []
-EOT
-    @provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', [])
-    @provider.admin=:false
-  end
-  it 'should not interfere with existing tags on the user when unsetting admin value' do
-    @provider.expects(:rabbitmqctl).with('-q', 'list_users').returns <<-EOT
-foo   [administrator, bar, baz]
-icinga  [monitoring]
-kitchen []
-kitchen2        [abc, def, ghi]
-EOT
-    @provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ['bar','baz'].sort)
-    @provider.admin=:false
   end
+  let(:provider) { provider_class.new(resource) }
+  let(:instance) { provider.class.instances.first }
 
-  it 'should clear all tags on existing user' do
-    @provider.expects(:rabbitmqctl).with('-q', 'list_users').returns <<-EOT
-one [administrator]
-foo [tag1,tag2]
-icinga  [monitoring]
-kitchen []
-kitchen2        [abc, def, ghi]
-EOT
-    @provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', [])
-    @provider.tags=[]
+  before do
+    provider.class.stubs(:rabbitmqctl).with('-q', 'list_users').returns(
+      "rmq_x [disk, storage]\nrmq_y [network, cpu, administrator]\nrmq_z []\n"
+    )
   end
 
-  it 'should set multiple tags' do
-    @provider.expects(:rabbitmqctl).with('-q', 'list_users').returns <<-EOT
-one [administrator]
-foo []
-icinga  [monitoring]
-kitchen []
-kitchen2        [abc, def, ghi]
-EOT
-    @provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ['tag1','tag2'])
-    @provider.tags=['tag1','tag2']
+  describe '#self.instances' do
+    it { expect(provider.class.instances.size).to eq(3) }
+    it 'returns an array of users' do
+      users = provider.class.instances.map(&:name)
+      expect(users).to match_array(%w[rmq_x rmq_y rmq_z])
+    end
+    it 'returns the expected tags' do
+      tags = provider.class.instances.first.get(:tags)
+      expect(tags).to match_array(%w[disk storage])
+    end
   end
 
-  it 'should clear tags while keep admin tag' do
-    @resource[:admin]  = true
-    @provider.expects(:rabbitmqctl).with('-q', 'list_users').returns <<-EOT
-one [administrator]
-foo [administrator, tag1, tag2]
-icinga  [monitoring]
-kitchen []
-kitchen2        [abc, def, ghi]
-EOT
-    @provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ["administrator"])
-    @provider.tags=[]
+  describe '#exists?' do
+    it { expect(instance.exists?).to be true }
   end
 
-  it 'should change tags while keep admin tag' do
-    @resource[:admin]  = true
-    @provider.expects(:rabbitmqctl).with('-q', 'list_users').returns <<-EOT
-one [administrator]
-foo [administrator, tag1, tag2]
-icinga  [monitoring]
-kitchen []
-kitchen2        [abc, def, ghi]
-EOT
-    @provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ["administrator","tag1","tag3","tag7"])
-    @provider.tags=['tag1','tag7','tag3']
+  describe '#create' do
+    it 'adds a user' do
+      provider.expects(:rabbitmqctl).with('add_user', 'rmq_x', 'secret')
+      provider.create
+    end
+    context 'no password supplied' do
+      let(:resource) do
+        Puppet::Type.type(:rabbitmq_user).new(
+          ensure: :present,
+          name: 'rmq_x'
+        )
+      end
+
+      it 'raises an error' do
+        expect do
+          provider.create
+        end.to raise_error(Puppet::Error, 'Password is a required parameter for rabbitmq_user (user: rmq_x)')
+      end
+    end
   end
 
-  it 'should create user with tags and without admin' do
-    @resource[:tags] = [ "tag1", "tag2" ]
-    @provider.expects(:rabbitmqctl).with('add_user', 'foo', 'bar')
-    @provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ["tag1","tag2"])
-    @provider.expects(:rabbitmqctl).with('-q', 'list_users').returns <<-EOT
-foo []
-EOT
-    @provider.create
+  describe '#destroy' do
+    it 'removes a user' do
+      provider.expects(:rabbitmqctl).with('delete_user', 'rmq_x')
+      provider.destroy
+    end
   end
 
-  it 'should create user with tags and with admin' do
-    @resource[:tags] = [ "tag1", "tag2" ]
-    @resource[:admin]  = true
-    @provider.expects(:rabbitmqctl).with('add_user', 'foo', 'bar')
-    @provider.expects(:rabbitmqctl).with('-q', 'list_users').twice.returns <<-EOT
-foo []
-EOT
-    @provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ["administrator"])
-    @provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ["administrator","tag1","tag2"])
-    @provider.create
+  describe '#check_password' do
+    context 'correct password' do
+      before do
+        provider.class.stubs(:rabbitmqctl).with(
+          'eval',
+          'rabbit_access_control:check_user_pass_login(list_to_binary("rmq_x"), list_to_binary("secret")).'
+        ).returns <<-EOT
+{ok,{user,<<"rmq_x">>,[],rabbit_auth_backend_internal,
+          {internal_user,<<"rmq_x">>,
+                         <<193,81,62,182,129,135,196,89,148,87,227,48,86,2,154,
+                           192,52,119,214,177>>,
+                         []}}}
+EOT
+      end
+
+      it do
+        provider.check_password('secret')
+      end
+    end
+
+    context 'incorrect password' do
+      before do
+        provider.class.stubs(:rabbitmqctl).with(
+          'eval',
+          'rabbit_access_control:check_user_pass_login(list_to_binary("rmq_x"), list_to_binary("nottherightone")).'
+        ).returns <<-EOT
+{refused,"user '~s' - invalid credentials",[<<"rmq_x">>]}
+...done.
+EOT
+      end
+
+      it do
+        provider.check_password('nottherightone')
+      end
+    end
   end
 
-  it 'should not return the administrator tag in tags for admins' do
-    @resource[:tags] = []
-    @resource[:admin]  = true
-    @provider.expects(:rabbitmqctl).with('-q', 'list_users').returns <<-EOT
-foo [administrator]
-EOT
-    @provider.tags.should == []
+  describe '#tags=' do
+    it 'clears all tags on existing user' do
+      provider.set(tags: %w[tag1 tag2 tag3])
+      provider.expects(:rabbitmqctl).with('set_user_tags', 'rmq_x', [])
+      provider.tags = []
+      provider.flush
+    end
+
+    it 'sets multiple tags' do
+      provider.set(tags: [])
+      provider.expects(:rabbitmqctl).with('set_user_tags', 'rmq_x', %w[tag1 tag2])
+      provider.tags = %w[tag1 tag2]
+      provider.flush
+    end
+
+    it 'clears tags while keeping admin tag' do
+      provider.set(tags: %w[administrator tag1 tag2])
+      resource[:admin] = true
+      provider.expects(:rabbitmqctl).with('set_user_tags', 'rmq_x', ['administrator'])
+      provider.tags = []
+      provider.flush
+    end
+
+    it 'changes tags while keeping admin tag' do
+      provider.set(tags: %w[administrator tag1 tag2])
+      resource[:admin] = true
+      provider.expects(:rabbitmqctl).with('set_user_tags', 'rmq_x', %w[tag1 tag7 tag3 administrator])
+      provider.tags = %w[tag1 tag7 tag3]
+      provider.flush
+    end
   end
 
-  it 'should return the administrator tag for non-admins' do
-    # this should not happen though.
-    @resource[:tags] = []
-    @resource[:admin]  = :false
-    @provider.expects(:rabbitmqctl).with('-q', 'list_users').returns <<-EOT
-foo [administrator]
-EOT
-    @provider.tags.should == ["administrator"]
+  describe '#admin=' do
+    it 'gets admin value properly' do
+      provider.set(tags: %w[administrator tag1 tag2])
+      expect(provider.admin).to be :true
+    end
+
+    it 'gets false admin value' do
+      provider.set(tags: %w[tag1 tag2])
+      expect(provider.admin).to be :false
+    end
+
+    it 'sets admin value' do
+      provider.expects(:rabbitmqctl).with('set_user_tags', 'rmq_x', ['administrator'])
+      resource[:admin] = true
+      provider.admin = resource[:admin]
+      provider.flush
+    end
+
+    it 'adds admin value to existing tags of the user' do
+      resource[:tags] = %w[tag1 tag2]
+      provider.expects(:rabbitmqctl).with('set_user_tags', 'rmq_x', %w[tag1 tag2 administrator])
+      resource[:admin] = true
+      provider.admin = resource[:admin]
+      provider.flush
+    end
+
+    it 'unsets admin value' do
+      provider.set(tags: ['administrator'])
+      provider.expects(:rabbitmqctl).with('set_user_tags', 'rmq_x', [])
+      provider.admin = :false
+      provider.flush
+    end
+
+    it 'does not interfere with existing tags on the user when unsetting admin value' do
+      provider.set(tags: %w[administrator tag1 tag2])
+      resource[:tags] = %w[tag1 tag2]
+      provider.expects(:rabbitmqctl).with('set_user_tags', 'rmq_x', %w[tag1 tag2])
+      provider.admin = :false
+      provider.flush
+    end
   end
 end
index bdbc73e..76e9a17 100644 (file)
@@ -1,93 +1,89 @@
-require 'puppet'
-require 'mocha'
-RSpec.configure do |config|
-  config.mock_with :mocha
-end
+require 'spec_helper'
+
 describe 'Puppet::Type.type(:rabbitmq_user_permissions).provider(:rabbitmqctl)' do
-  before :each do
-    @provider_class = Puppet::Type.type(:rabbitmq_user_permissions).provider(:rabbitmqctl)
-    @resource = Puppet::Type::Rabbitmq_user_permissions.new(
-      {:name => 'foo@bar'}
+  let(:resource) do
+    Puppet::Type::Rabbitmq_user_permissions.new(
+      name: 'foo@bar'
     )
-    @provider = @provider_class.new(@resource)
   end
-  after :each do
-    @provider_class.instance_variable_set(:@users, nil)
+  let(:provider_class) { Puppet::Type.type(:rabbitmq_user_permissions).provider(:rabbitmqctl) }
+  let(:provider) { provider_class.new(resource) }
+
+  after do
+    provider_class.instance_variable_set(:@users, nil)
   end
-  it 'should match user permissions from list' do
-    @provider.class.expects(:rabbitmqctl).with('-q', 'list_user_permissions', 'foo').returns <<-EOT
+  it 'matches user permissions from list' do
+    provider.class.expects(:rabbitmqctl).with('-q', 'list_user_permissions', 'foo').returns <<-EOT
 bar 1 2 3
 EOT
-    @provider.exists?.should == {:configure=>"1", :write=>"2", :read=>"3"}
+    expect(provider.exists?).to eq(configure: '1', write: '2', read: '3')
   end
-  it 'should match user permissions with empty columns' do
-    @provider.class.expects(:rabbitmqctl).with('-q', 'list_user_permissions', 'foo').returns <<-EOT
+  it 'matches user permissions with empty columns' do
+    provider.class.expects(:rabbitmqctl).with('-q', 'list_user_permissions', 'foo').returns <<-EOT
 bar                    3
 EOT
-    @provider.exists?.should == {:configure=>"", :write=>"", :read=>"3"}
+    expect(provider.exists?).to eq(configure: '', write: '', read: '3')
   end
-  it 'should not match user permissions with more than 3 columns' do
-    @provider.class.expects(:rabbitmqctl).with('-q', 'list_user_permissions', 'foo').returns <<-EOT
+  it 'does not match user permissions with more than 3 columns' do
+    provider.class.expects(:rabbitmqctl).with('-q', 'list_user_permissions', 'foo').returns <<-EOT
 bar 1 2 3 4
 EOT
-    expect { @provider.exists? }.to raise_error(Puppet::Error, /cannot parse line from list_user_permissions/)
+    expect { provider.exists? }.to raise_error(Puppet::Error, %r{cannot parse line from list_user_permissions})
   end
-  it 'should not match an empty list' do
-    @provider.class.expects(:rabbitmqctl).with('-q', 'list_user_permissions', 'foo').returns <<-EOT
+  it 'does not match an empty list' do
+    provider.class.expects(:rabbitmqctl).with('-q', 'list_user_permissions', 'foo').returns <<-EOT
 EOT
-    @provider.exists?.should == nil
+    expect(provider.exists?).to eq(nil)
   end
-  it 'should create default permissions' do
-    @provider.instance_variable_set(:@should_vhost, "bar")
-    @provider.instance_variable_set(:@should_user, "foo")
-    @provider.expects(:rabbitmqctl).with('set_permissions', '-p', 'bar', 'foo', "''", "''", "''")
-    @provider.create
+  it 'creates default permissions' do
+    provider.instance_variable_set(:@should_vhost, 'bar')
+    provider.instance_variable_set(:@should_user, 'foo')
+    provider.expects(:rabbitmqctl).with('set_permissions', '-p', 'bar', 'foo', "''", "''", "''")
+    provider.create
   end
-  it 'should destroy permissions' do
-    @provider.instance_variable_set(:@should_vhost, "bar")
-    @provider.instance_variable_set(:@should_user, "foo")
-    @provider.expects(:rabbitmqctl).with('clear_permissions', '-p', 'bar', 'foo')
-    @provider.destroy
+  it 'destroys permissions' do
+    provider.instance_variable_set(:@should_vhost, 'bar')
+    provider.instance_variable_set(:@should_user, 'foo')
+    provider.expects(:rabbitmqctl).with('clear_permissions', '-p', 'bar', 'foo')
+    provider.destroy
   end
-  {:configure_permission => '1', :write_permission => '2', :read_permission => '3'}.each do |k,v|
+  { configure_permission: '1', write_permission: '2', read_permission: '3' }.each do |k, v|
     it "should be able to retrieve #{k}" do
-      @provider.class.expects(:rabbitmqctl).with('-q', 'list_user_permissions', 'foo').returns <<-EOT
+      provider.class.expects(:rabbitmqctl).with('-q', 'list_user_permissions', 'foo').returns <<-EOT
 bar 1 2 3
 EOT
-      @provider.send(k).should == v
+      expect(provider.send(k)).to eq(v)
     end
   end
-  {:configure_permission => '1', :write_permission => '2', :read_permission => '3'}.each do |k,v|
+  { configure_permission: '1', write_permission: '2', read_permission: '3' }.each do |k, v|
     it "should be able to retrieve #{k} after exists has been called" do
-      @provider.class.expects(:rabbitmqctl).with('-q', 'list_user_permissions', 'foo').returns <<-EOT
+      provider.class.expects(:rabbitmqctl).with('-q', 'list_user_permissions', 'foo').returns <<-EOT
 bar 1 2 3
 EOT
-      @provider.exists?
-      @provider.send(k).should == v
+      provider.exists?
+      expect(provider.send(k)).to eq(v)
     end
   end
-  {:configure_permission => ['foo', '2', '3'],
-   :read_permission      => ['1', '2', 'foo'],
-   :write_permission     => ['1', 'foo', '3']
-  }.each do |perm, columns|
+  { configure_permission: %w[foo 2 3],
+    read_permission: %w[1 2 foo],
+    write_permission: %w[1 foo 3] }.each do |perm, columns|
     it "should be able to sync #{perm}" do
-      @provider.class.expects(:rabbitmqctl).with('-q', 'list_user_permissions', 'foo').returns <<-EOT
+      provider.class.expects(:rabbitmqctl).with('-q', 'list_user_permissions', 'foo').returns <<-EOT
 bar 1 2 3
 EOT
-      @provider.resource[perm] = 'foo'
-      @provider.expects(:rabbitmqctl).with('set_permissions', '-p', 'bar', 'foo', *columns)
-      @provider.send("#{perm}=".to_sym, 'foo')
+      provider.resource[perm] = 'foo'
+      provider.expects(:rabbitmqctl).with('set_permissions', '-p', 'bar', 'foo', *columns)
+      provider.send("#{perm}=".to_sym, 'foo')
     end
   end
-  it 'should only call set_permissions once' do
-    @provider.class.expects(:rabbitmqctl).with('-q', 'list_user_permissions', 'foo').returns <<-EOT
+  it 'onlies call set_permissions once' do
+    provider.class.expects(:rabbitmqctl).with('-q', 'list_user_permissions', 'foo').returns <<-EOT
 bar 1 2 3
 EOT
-    @provider.resource[:configure_permission] = 'foo'
-    @provider.resource[:read_permission] = 'foo'
-    @provider.expects(:rabbitmqctl).with('set_permissions', '-p', 'bar', 'foo', 'foo', '2', 'foo').once
-    @provider.configure_permission='foo'
-    @provider.read_permission='foo'
+    provider.resource[:configure_permission] = 'foo'
+    provider.resource[:read_permission] = 'foo'
+    provider.expects(:rabbitmqctl).with('set_permissions', '-p', 'bar', 'foo', 'foo', '2', 'foo').once
+    provider.configure_permission = 'foo'
+    provider.read_permission = 'foo'
   end
 end
-
index 6c8cce8..d4ed328 100644 (file)
@@ -1,45 +1,43 @@
-require 'puppet'
-require 'mocha'
-RSpec.configure do |config|
-  config.mock_with :mocha
-end
+require 'spec_helper'
+
 provider_class = Puppet::Type.type(:rabbitmq_vhost).provider(:rabbitmqctl)
 describe provider_class do
-  before :each do
-    @resource = Puppet::Type::Rabbitmq_vhost.new(
-      {:name => 'foo'}
+  let(:resource) do
+    Puppet::Type::Rabbitmq_vhost.new(
+      name: 'foo'
     )
-    @provider = provider_class.new(@resource)
   end
-  it 'should match vhost names' do
-    @provider.expects(:rabbitmqctl).with('-q', 'list_vhosts').returns <<-EOT
+  let(:provider) { provider_class.new(resource) }
+
+  it 'matches vhost names' do
+    provider.expects(:rabbitmqctl).with('-q', 'list_vhosts').returns <<-EOT
 Listing vhosts ...
 foo
 ...done.
 EOT
-    @provider.exists?.should == 'foo'
+    expect(provider.exists?).to eq(true)
   end
-  it 'should not match if no vhosts on system' do
-    @provider.expects(:rabbitmqctl).with('-q', 'list_vhosts').returns <<-EOT
+  it 'does not match if no vhosts on system' do
+    provider.expects(:rabbitmqctl).with('-q', 'list_vhosts').returns <<-EOT
 Listing vhosts ...
 ...done.
 EOT
-    @provider.exists?.should be_nil
+    expect(provider.exists?).to eq(false)
   end
-  it 'should not match if no matching vhosts on system' do
-    @provider.expects(:rabbitmqctl).with('-q', 'list_vhosts').returns <<-EOT
+  it 'does not match if no matching vhosts on system' do
+    provider.expects(:rabbitmqctl).with('-q', 'list_vhosts').returns <<-EOT
 Listing vhosts ...
 fooey
 ...done.
 EOT
-    @provider.exists?.should be_nil
+    expect(provider.exists?).to eq(false)
   end
-  it 'should call rabbitmqctl to create' do
-    @provider.expects(:rabbitmqctl).with('add_vhost', 'foo')
-    @provider.create
+  it 'calls rabbitmqctl to create' do
+    provider.expects(:rabbitmqctl).with('add_vhost', 'foo')
+    provider.create
   end
-  it 'should call rabbitmqctl to create' do
-    @provider.expects(:rabbitmqctl).with('delete_vhost', 'foo')
-    @provider.destroy
+  it 'calls rabbitmqctl to create' do
+    provider.expects(:rabbitmqctl).with('delete_vhost', 'foo')
+    provider.destroy
   end
 end
index b0671e7..14b8824 100644 (file)
@@ -1,50 +1,47 @@
-require 'puppet'
-require 'puppet/type/rabbitmq_binding'
+require 'spec_helper'
 describe Puppet::Type.type(:rabbitmq_binding) do
-  before :each do
-    @binding = Puppet::Type.type(:rabbitmq_binding).new(
-      :name => 'foo@blub@bar',
-      :destination_type => :queue
+  let(:binding) do
+    Puppet::Type.type(:rabbitmq_binding).new(
+      name: 'foo@blub@bar',
+      destination_type: :queue
     )
   end
-  it 'should accept an queue name' do
-    @binding[:name] = 'dan@dude@pl'
-    @binding[:name].should == 'dan@dude@pl'
-  end
-  it 'should require a name' do
-    expect {
-      Puppet::Type.type(:rabbitmq_binding).new({})
-    }.to raise_error(Puppet::Error, 'Title or name must be provided')
-  end
-  it 'should not allow whitespace in the name' do
-    expect {
-      @binding[:name] = 'b r'
-    }.to raise_error(Puppet::Error, /Valid values match/)
-  end
-  it 'should not allow names without one @' do
-    expect {
-      @binding[:name] = 'b_r'
-    }.to raise_error(Puppet::Error, /Valid values match/)
-  end
 
-  it 'should not allow names without two @' do
-    expect {
-      @binding[:name] = 'b@r'
-    }.to raise_error(Puppet::Error, /Valid values match/)
+  it 'accepts an queue name' do
+    binding[:name] = 'dan@dude@pl'
+    expect(binding[:name]).to eq('dan@dude@pl')
   end
-
-  it 'should accept an binding destination_type' do
-    @binding[:destination_type] = :exchange
-    @binding[:destination_type].should == :exchange
-  end
-
-  it 'should accept a user' do
-    @binding[:user] = :root
-    @binding[:user].should == :root
-  end
-
-  it 'should accept a password' do
-    @binding[:password] = :PaSsw0rD
-    @binding[:password].should == :PaSsw0rD
+  it 'requires a name' do
+    expect do
+      Puppet::Type.type(:rabbitmq_binding).new({})
+    end.to raise_error(Puppet::Error, 'Title or name must be provided')
+  end
+  it 'errors when missing source' do
+    expect do
+      Puppet::Type.type(:rabbitmq_binding).new(
+        name: 'test binding',
+        destination: 'foobar'
+      )
+    end.to raise_error(Puppet::Error, %r{`source` must be defined})
+  end
+  it 'errors when missing destination' do
+    expect do
+      Puppet::Type.type(:rabbitmq_binding).new(
+        name: 'test binding',
+        source: 'foobar'
+      )
+    end.to raise_error(Puppet::Error, %r{`destination` must be defined})
+  end
+  it 'accepts an binding destination_type' do
+    binding[:destination_type] = :exchange
+    expect(binding[:destination_type]).to eq(:exchange)
+  end
+  it 'accepts a user' do
+    binding[:user] = :root
+    expect(binding[:user]).to eq(:root)
+  end
+  it 'accepts a password' do
+    binding[:password] = :PaSsw0rD
+    expect(binding[:password]).to eq(:PaSsw0rD)
   end
 end
index 1500122..e1be271 100644 (file)
@@ -1,57 +1,57 @@
-require 'puppet'
-require 'puppet/type/rabbitmq_exchange'
+require 'spec_helper'
 describe Puppet::Type.type(:rabbitmq_exchange) do
-  before :each do
-    @exchange = Puppet::Type.type(:rabbitmq_exchange).new(
-      :name => 'foo@bar',
-      :type => :topic,
-      :internal => false,
-      :auto_delete => false,
-      :durable => true
+  let(:exchange) do
+    Puppet::Type.type(:rabbitmq_exchange).new(
+      name: 'foo@bar',
+      type: :topic,
+      internal: false,
+      auto_delete: false,
+      durable: true
     )
   end
-  it 'should accept an exchange name' do
-    @exchange[:name] = 'dan@pl'
-    @exchange[:name].should == 'dan@pl'
+
+  it 'accepts an exchange name' do
+    exchange[:name] = 'dan@pl'
+    expect(exchange[:name]).to eq('dan@pl')
   end
-  it 'should require a name' do
-    expect {
+  it 'requires a name' do
+    expect do
       Puppet::Type.type(:rabbitmq_exchange).new({})
-    }.to raise_error(Puppet::Error, 'Title or name must be provided')
+    end.to raise_error(Puppet::Error, 'Title or name must be provided')
   end
-  it 'should not allow whitespace in the name' do
-    expect {
-      @exchange[:name] = 'b r'
-    }.to raise_error(Puppet::Error, /Valid values match/)
+  it 'does not allow whitespace in the name' do
+    expect do
+      exchange[:name] = 'b r'
+    end.to raise_error(Puppet::Error, %r{Valid values match})
   end
-  it 'should not allow names without @' do
-    expect {
-      @exchange[:name] = 'b_r'
-    }.to raise_error(Puppet::Error, /Valid values match/)
+  it 'does not allow names without @' do
+    expect do
+      exchange[:name] = 'b_r'
+    end.to raise_error(Puppet::Error, %r{Valid values match})
   end
 
-  it 'should accept an exchange type' do
-    @exchange[:type] = :direct
-    @exchange[:type].should == :direct
+  it 'accepts an exchange type' do
+    exchange[:type] = :direct
+    expect(exchange[:type]).to eq(:direct)
   end
-  it 'should require a type' do
-    expect {
-      Puppet::Type.type(:rabbitmq_exchange).new(:name => 'foo@bar')
-    }.to raise_error(/.*must set type when creating exchange.*/)
+  it 'requires a type' do
+    expect do
+      Puppet::Type.type(:rabbitmq_exchange).new(name: 'foo@bar')
+    end.to raise_error(%r{.*must set type when creating exchange.*})
   end
-  it 'should not require a type when destroying' do
-    expect {
-            Puppet::Type.type(:rabbitmq_exchange).new(:name => 'foo@bar', :ensure => :absent)
-    }.to_not raise_error
+  it 'does not require a type when destroying' do
+    expect do
+      Puppet::Type.type(:rabbitmq_exchange).new(name: 'foo@bar', ensure: :absent)
+    end.not_to raise_error
   end
 
-  it 'should accept a user' do
-    @exchange[:user] = :root
-    @exchange[:user].should == :root
+  it 'accepts a user' do
+    exchange[:user] = :root
+    expect(exchange[:user]).to eq(:root)
   end
 
-  it 'should accept a password' do
-    @exchange[:password] = :PaSsw0rD
-    @exchange[:password].should == :PaSsw0rD
+  it 'accepts a password' do
+    exchange[:password] = :PaSsw0rD
+    expect(exchange[:password]).to eq(:PaSsw0rD)
   end
 end
diff --git a/3rdparty/modules/rabbitmq/spec/unit/puppet/type/rabbitmq_parameter_spec.rb b/3rdparty/modules/rabbitmq/spec/unit/puppet/type/rabbitmq_parameter_spec.rb
new file mode 100644 (file)
index 0000000..8982b37
--- /dev/null
@@ -0,0 +1,79 @@
+require 'spec_helper'
+describe Puppet::Type.type(:rabbitmq_parameter) do
+  let(:parameter) do
+    Puppet::Type.type(:rabbitmq_parameter).new(
+      name: 'documentumShovel@/',
+      component_name: 'shovel',
+      value: {
+        'src-uri' => 'amqp://myremote-server',
+        'src-queue' => 'queue.docs.outgoing',
+        'dest-uri' => 'amqp://',
+        'dest-queue' => 'queue.docs.incoming'
+      }
+    )
+  end
+
+  it 'accepts a valid name' do
+    parameter[:name] = 'documentumShovel@/'
+    expect(parameter[:name]).to eq('documentumShovel@/')
+  end
+
+  it 'requires a name' do
+    expect do
+      Puppet::Type.type(:rabbitmq_parameter).new({})
+    end.to raise_error(Puppet::Error, 'Title or name must be provided')
+  end
+
+  it 'fails when name does not have a @' do
+    expect do
+      parameter[:name] = 'documentumShovel'
+    end.to raise_error(Puppet::Error, %r{Valid values match})
+  end
+
+  it 'accepts a string' do
+    parameter[:component_name] = 'mystring'
+    expect(parameter[:component_name]).to eq('mystring')
+  end
+
+  it 'is not empty' do
+    expect do
+      parameter[:component_name] = ''
+    end.to raise_error(Puppet::Error, %r{component_name must be defined})
+  end
+
+  it 'accepts a valid hash for value' do
+    value = { 'message-ttl' => '1800000' }
+    parameter[:value] = value
+    expect(parameter[:value]).to eq(value)
+  end
+
+  it 'does not accept an empty string for definition' do
+    expect do
+      parameter[:value] = ''
+    end.to raise_error(Puppet::Error, %r{Invalid value})
+  end
+
+  it 'does not accept a string for definition' do
+    expect do
+      parameter[:value] = 'guest'
+    end.to raise_error(Puppet::Error, %r{Invalid value})
+  end
+
+  it 'does not accept an array for definition' do
+    expect do
+      parameter[:value] = { 'message-ttl' => %w[999 100] }
+    end.to raise_error(Puppet::Error, %r{Invalid value})
+  end
+
+  it 'accepts string as myparameter' do
+    value = { 'myparameter' => 'mystring' }
+    parameter[:value] = value
+    expect(parameter[:value]['myparameter']).to eq('mystring')
+  end
+
+  it 'converts to integer when string only contains numbers' do
+    value = { 'myparameter' => '1800000' }
+    parameter[:value] = value
+    expect(parameter[:value]['myparameter']).to eq(1_800_000)
+  end
+end
diff --git a/3rdparty/modules/rabbitmq/spec/unit/puppet/type/rabbitmq_plugin_spec.rb b/3rdparty/modules/rabbitmq/spec/unit/puppet/type/rabbitmq_plugin_spec.rb
new file mode 100644 (file)
index 0000000..194df66
--- /dev/null
@@ -0,0 +1,24 @@
+require 'spec_helper'
+describe Puppet::Type.type(:rabbitmq_plugin) do
+  let(:plugin) do
+    Puppet::Type.type(:rabbitmq_plugin).new(name: 'foo')
+  end
+
+  it 'accepts a plugin name' do
+    plugin[:name] = 'plugin-name'
+    expect(plugin[:name]).to eq('plugin-name')
+  end
+  it 'requires a name' do
+    expect do
+      Puppet::Type.type(:rabbitmq_plugin).new({})
+    end.to raise_error(Puppet::Error, 'Title or name must be provided')
+  end
+  it 'defaults to a umask of 0022' do
+    expect(plugin[:umask]).to eq(0o022)
+  end
+  it 'does not allow a non-octal value to be specified' do
+    expect do
+      plugin[:umask] = '198'
+    end.to raise_error(Puppet::Error, %r{The umask specification is invalid: "198"})
+  end
+end
index 36bf2a7..fca3c61 100644 (file)
-require 'puppet'
-require 'puppet/type/rabbitmq_policy'
-
+require 'spec_helper'
 describe Puppet::Type.type(:rabbitmq_policy) do
-
-  before do
-    @policy = Puppet::Type.type(:rabbitmq_policy).new(
-      :name       => 'ha-all@/',
-      :pattern    => '.*',
-      :definition => {
+  let(:policy) do
+    Puppet::Type.type(:rabbitmq_policy).new(
+      name: 'ha-all@/',
+      pattern: '.*',
+      definition: {
         'ha-mode' => 'all'
-      })
+      }
+    )
   end
 
-  it 'should accept a valid name' do
-    @policy[:name] = 'ha-all@/'
-    @policy[:name].should == 'ha-all@/'
+  it 'accepts a valid name' do
+    policy[:name] = 'ha-all@/'
+    expect(policy[:name]).to eq('ha-all@/')
   end
 
-  it 'should require a name' do
-    expect {
+  it 'requires a name' do
+    expect do
       Puppet::Type.type(:rabbitmq_policy).new({})
-    }.to raise_error(Puppet::Error, 'Title or name must be provided')
+    end.to raise_error(Puppet::Error, 'Title or name must be provided')
   end
 
-  it 'should fail when name does not have a @' do
-    expect {
-      @policy[:name] = 'ha-all'
-    }.to raise_error(Puppet::Error, /Valid values match/)
+  it 'fails when name does not have a @' do
+    expect do
+      policy[:name] = 'ha-all'
+    end.to raise_error(Puppet::Error, %r{Valid values match})
   end
 
-  it 'should accept a valid regex for pattern' do
-    @policy[:pattern] = '.*?'
-    @policy[:pattern].should == '.*?'
+  it 'accepts a valid regex for pattern' do
+    policy[:pattern] = '.*?'
+    expect(policy[:pattern]).to eq('.*?')
   end
 
-  it 'should accept an empty string for pattern' do
-    @policy[:pattern] = ''
-    @policy[:pattern].should == ''
+  it 'accepts an empty string for pattern' do
+    policy[:pattern] = ''
+    expect(policy[:pattern]).to eq('')
   end
 
-  it 'should not accept invalid regex for pattern' do
-    expect {
-      @policy[:pattern] = '*'
-    }.to raise_error(Puppet::Error, /Invalid regexp/)
+  it 'does not accept invalid regex for pattern' do
+    expect do
+      policy[:pattern] = '*'
+    end.to raise_error(Puppet::Error, %r{Invalid regexp})
   end
 
-  it 'should accept valid value for applyto' do
+  it 'accepts valid value for applyto' do
     [:all, :exchanges, :queues].each do |v|
-      @policy[:applyto] = v
-      @policy[:applyto].should == v
+      policy[:applyto] = v
+      expect(policy[:applyto]).to eq(v)
     end
   end
 
-  it 'should not accept invalid value for applyto' do
-    expect {
-      @policy[:applyto] = 'me'
-    }.to raise_error(Puppet::Error, /Invalid value/)
+  it 'does not accept invalid value for applyto' do
+    expect do
+      policy[:applyto] = 'me'
+    end.to raise_error(Puppet::Error, %r{Invalid value})
   end
 
-  it 'should accept a valid hash for definition' do
-    definition = {'ha-mode' => 'all', 'ha-sync-mode' => 'automatic'}
-    @policy[:definition] = definition
-    @policy[:definition].should == definition
+  it 'accepts a valid hash for definition' do
+    definition = { 'ha-mode' => 'all', 'ha-sync-mode' => 'automatic' }
+    policy[:definition] = definition
+    expect(policy[:definition]).to eq(definition)
   end
 
-  it 'should not accept invalid hash for definition' do
-    expect {
-      @policy[:definition] = 'ha-mode'
-    }.to raise_error(Puppet::Error, /Invalid definition/)
+  it 'does not accept a string for definition' do
+    expect do
+      policy[:definition] = 'ha-mode'
+    end.to raise_error(Puppet::Error, %r{Invalid definition})
+  end
 
-    expect {
-      @policy[:definition] = {'ha-mode' => ['a', 'b']}
-    }.to raise_error(Puppet::Error, /Invalid definition/)
+  it 'does not accept invalid hash for definition' do
+    expect do
+      policy[:definition] = { 'ha-mode' => %w[a b] }
+    end.to raise_error(Puppet::Error, %r{Invalid definition})
   end
 
-  it 'should accept valid value for priority' do
+  it 'accepts valid value for priority' do
     [0, 10, '0', '10'].each do |v|
-      @policy[:priority] = v
-      @policy[:priority].should == v
+      policy[:priority] = v
+      expect(policy[:priority]).to eq(v)
     end
   end
 
-  it 'should not accept invalid value for priority' do
+  it 'does not accept invalid value for priority' do
     ['-1', -1, '1.0', 1.0, 'abc', ''].each do |v|
-      expect {
-        @policy[:priority] = v
-      }.to raise_error(Puppet::Error, /Invalid value/)
+      expect do
+        policy[:priority] = v
+      end.to raise_error(Puppet::Error, %r{Invalid value})
     end
   end
 
-  it 'should accept and convert ha-params for ha-mode exactly' do
-    definition = {'ha-mode' => 'exactly', 'ha-params' => '2'}
-    @policy[:definition] = definition
-    @policy[:definition]['ha-params'].should be_a(Fixnum)
-    @policy[:definition]['ha-params'].should == 2
+  it 'accepts and convert ha-params for ha-mode exactly' do
+    definition = { 'ha-mode' => 'exactly', 'ha-params' => '2' }
+    policy[:definition] = definition
+    expect(policy[:definition]['ha-params']).to eq(2)
+  end
+
+  it 'does not accept non-numeric ha-params for ha-mode exactly' do
+    definition = { 'ha-mode' => 'exactly', 'ha-params' => 'nonnumeric' }
+    expect do
+      policy[:definition] = definition
+    end.to raise_error(Puppet::Error, %r{Invalid ha-params.*nonnumeric.*exactly})
+  end
+
+  it 'accepts and convert the expires value' do
+    definition = { 'expires' => '1800000' }
+    policy[:definition] = definition
+    expect(policy[:definition]['expires']).to eq(1_800_000)
+  end
+
+  it 'does not accept non-numeric expires value' do
+    definition = { 'expires' => 'future' }
+    expect do
+      policy[:definition] = definition
+    end.to raise_error(Puppet::Error, %r{Invalid expires value.*future})
+  end
+
+  it 'accepts and convert the message-ttl value' do
+    definition = { 'message-ttl' => '1800000' }
+    policy[:definition] = definition
+    expect(policy[:definition]['message-ttl']).to eq(1_800_000)
+  end
+
+  it 'does not accept non-numeric message-ttl value' do
+    definition = { 'message-ttl' => 'future' }
+    expect do
+      policy[:definition] = definition
+    end.to raise_error(Puppet::Error, %r{Invalid message-ttl value.*future})
+  end
+
+  it 'accepts and convert the max-length value' do
+    definition = { 'max-length' => '1800000' }
+    policy[:definition] = definition
+    expect(policy[:definition]['max-length']).to eq(1_800_000)
   end
 
-  it 'should not accept non-numeric ha-params for ha-mode exactly' do
-    definition = {'ha-mode' => 'exactly', 'ha-params' => 'nonnumeric'}
-    expect {
-      @policy[:definition] = definition
-    }.to raise_error(Puppet::Error, /Invalid ha-params.*nonnumeric.*exactly/)
+  it 'does not accept non-numeric max-length value' do
+    definition = { 'max-length' => 'future' }
+    expect do
+      policy[:definition] = definition
+    end.to raise_error(Puppet::Error, %r{Invalid max-length value.*future})
   end
 
-  it 'should accept and convert the expires value' do
-    definition = {'expires' => '1800000'}
-    @policy[:definition] = definition
-    @policy[:definition]['expires'].should be_a(Fixnum)
-    @policy[:definition]['expires'].should == 1800000
+  it 'accepts and convert the max-length-bytes value' do
+    definition = { 'max-length-bytes' => '1800000' }
+    policy[:definition] = definition
+    expect(policy[:definition]['max-length-bytes']).to eq(1_800_000)
+  end
+
+  it 'does not accept non-numeric max-length-bytes value' do
+    definition = { 'max-length-bytes' => 'future' }
+    expect do
+      policy[:definition] = definition
+    end.to raise_error(Puppet::Error, %r{Invalid max-length-bytes value.*future})
+  end
+
+  it 'accepts and convert the shards-per-node value' do
+    definition = { 'shards-per-node' => '1800000' }
+    policy[:definition] = definition
+    expect(policy[:definition]['shards-per-node']).to eq(1_800_000)
+  end
+
+  it 'does not accept non-numeric shards-per-node value' do
+    definition = { 'shards-per-node' => 'future' }
+    expect do
+      policy[:definition] = definition
+    end.to raise_error(Puppet::Error, %r{Invalid shards-per-node value.*future})
+  end
+
+  it 'accepts and convert the ha-sync-batch-size value' do
+    definition = { 'ha-sync-batch-size' => '1800000' }
+    policy[:definition] = definition
+    expect(policy[:definition]['ha-sync-batch-size']).to eq(1_800_000)
+  end
+
+  it 'does not accept non-numeric ha-sync-batch-size value' do
+    definition = { 'ha-sync-batch-size' => 'future' }
+    expect do
+      policy[:definition] = definition
+    end.to raise_error(Puppet::Error, %r{Invalid ha-sync-batch-size value.*future})
+  end
+
+  context 'accepts list value in ha-params when ha-mode = nodes' do
+    before do
+      policy[:definition] = definition
+    end
+
+    let(:definition) { { 'ha-mode' => 'nodes', 'ha-params' => ['rabbit@rabbit-01', 'rabbit@rabbit-02'] } }
+
+    it { expect(policy[:definition]['ha-mode']).to eq('nodes') }
+    it { expect(policy[:definition]['ha-params']).to be_a(Array) }
+    it { expect(policy[:definition]['ha-params'][0]).to eq('rabbit@rabbit-01') }
+    it { expect(policy[:definition]['ha-params'][1]).to eq('rabbit@rabbit-02') }
   end
 
-  it 'should not accept non-numeric expires value' do
-    definition = {'expires' => 'future'}
-    expect {
-      @policy[:definition] = definition
-    }.to raise_error(Puppet::Error, /Invalid expires value.*future/)
+  it 'does not accept non-list value in ha-params when ha-mode = nodes' do
+    definition = { 'ha-mode' => 'nodes', 'ha-params' => 'this-will-fail' }
+    expect do
+      policy[:definition] = definition
+    end.to raise_error(Puppet::Error, %r{Invalid definition, value this-will-fail for key ha-params is not an array})
   end
 end
index 4fd7b34..625c3fe 100644 (file)
@@ -1,60 +1,58 @@
-require 'puppet'
-require 'puppet/type/rabbitmq_queue'
-require 'json'
+require 'spec_helper'
 describe Puppet::Type.type(:rabbitmq_queue) do
-  before :each do
-    @queue = Puppet::Type.type(:rabbitmq_queue).new(
-      :name => 'foo@bar',
-      :durable => :true,
-      :arguments => {
+  let(:queue) do
+    Puppet::Type.type(:rabbitmq_queue).new(
+      name: 'foo@bar',
+      durable: :true,
+      arguments: {
         'x-message-ttl' => 45,
         'x-dead-letter-exchange' => 'deadexchange'
       }
     )
   end
-  it 'should accept an queue name' do
-    @queue[:name] = 'dan@pl'
-    @queue[:name].should == 'dan@pl'
+
+  it 'accepts an queue name' do
+    queue[:name] = 'dan@pl'
+    expect(queue[:name]).to eq('dan@pl')
   end
-  it 'should require a name' do
-    expect {
+  it 'requires a name' do
+    expect do
       Puppet::Type.type(:rabbitmq_queue).new({})
-    }.to raise_error(Puppet::Error, 'Title or name must be provided')
+    end.to raise_error(Puppet::Error, 'Title or name must be provided')
   end
-  it 'should not allow whitespace in the name' do
-    expect {
-      @queue[:name] = 'b r'
-    }.to raise_error(Puppet::Error, /Valid values match/)
+  it 'does not allow whitespace in the name' do
+    expect do
+      queue[:name] = 'b r'
+    end.to raise_error(Puppet::Error, %r{Valid values match})
   end
-  it 'should not allow names without @' do
-    expect {
-      @queue[:name] = 'b_r'
-    }.to raise_error(Puppet::Error, /Valid values match/)
+  it 'does not allow names without @' do
+    expect do
+      queue[:name] = 'b_r'
+    end.to raise_error(Puppet::Error, %r{Valid values match})
   end
 
-  it 'should accept an arguments with numbers value' do
-    @queue[:arguments] = {'x-message-ttl' => 30}
-    @queue[:arguments].to_json.should == "{\"x-message-ttl\":30}"
-    @queue[:arguments]['x-message-ttl'].should == 30
+  it 'accepts an arguments with numbers value' do
+    queue[:arguments] = { 'x-message-ttl' => 30 }
+    expect(queue[:arguments].to_json).to eq('{"x-message-ttl":30}')
   end
 
-  it 'should accept an arguments with string value' do
-    @queue[:arguments] = {'x-dead-letter-exchange' => 'catchallexchange'}
-    @queue[:arguments].to_json.should == "{\"x-dead-letter-exchange\":\"catchallexchange\"}"
+  it 'accepts an arguments with string value' do
+    queue[:arguments] = { 'x-dead-letter-exchange' => 'catchallexchange' }
+    expect(queue[:arguments].to_json).to eq('{"x-dead-letter-exchange":"catchallexchange"}')
   end
 
-  it 'should accept an queue durable' do
-    @queue[:durable] = :true
-    @queue[:durable].should == :true
+  it 'accepts an queue durable' do
+    queue[:durable] = :true
+    expect(queue[:durable]).to eq(:true)
   end
 
-  it 'should accept a user' do
-    @queue[:user] = :root
-    @queue[:user].should == :root
+  it 'accepts a user' do
+    queue[:user] = :root
+    expect(queue[:user]).to eq(:root)
   end
 
-  it 'should accept a password' do
-    @queue[:password] = :PaSsw0rD
-    @queue[:password].should == :PaSsw0rD
+  it 'accepts a password' do
+    queue[:password] = :PaSsw0rD
+    expect(queue[:password]).to eq(:PaSsw0rD)
   end
 end
index 7cb66ea..b6951c4 100644 (file)
@@ -1,55 +1,57 @@
-require 'puppet'
-require 'puppet/type/rabbitmq_user_permissions'
+require 'spec_helper'
 describe Puppet::Type.type(:rabbitmq_user_permissions) do
-  before :each do
-    @perms = Puppet::Type.type(:rabbitmq_user_permissions).new(:name => 'foo@bar')
+  let(:perms) do
+    Puppet::Type.type(:rabbitmq_user_permissions).new(name: 'foo@bar')
   end
-  it 'should accept a valid hostname name' do
-    @perms[:name] = 'dan@bar'
-    @perms[:name].should == 'dan@bar'
+
+  it 'accepts a valid hostname name' do
+    perms[:name] = 'dan@bar'
+    expect(perms[:name]).to eq('dan@bar')
   end
-  it 'should require a name' do
-    expect {
+  it 'requires a name' do
+    expect do
       Puppet::Type.type(:rabbitmq_user_permissions).new({})
-    }.to raise_error(Puppet::Error, 'Title or name must be provided')
+    end.to raise_error(Puppet::Error, 'Title or name must be provided')
   end
-  it 'should fail when names dont have a @' do
-    expect {
-      @perms[:name] = 'bar'
-    }.to raise_error(Puppet::Error, /Valid values match/)
+  it 'fails when names dont have a @' do
+    expect do
+      perms[:name] = 'bar'
+    end.to raise_error(Puppet::Error, %r{Valid values match})
   end
   [:configure_permission, :read_permission, :write_permission].each do |param|
-    it 'should not default to anything' do
-       @perms[param].should == nil
+    it 'does not default to anything' do
+      expect(perms[param]).to eq(nil)
     end
     it "should accept a valid regex for #{param}" do
-      @perms[param] = '.*?'
-      @perms[param].should == '.*?'  
+      perms[param] = '.*?'
+      expect(perms[param]).to eq('.*?')
     end
     it "should accept an empty string for #{param}" do
-      @perms[param] = ''
-      @perms[param].should == ''  
+      perms[param] = ''
+      expect(perms[param]).to eq('')
     end
     it "should not accept invalid regex for #{param}" do
-      expect {
-        @perms[param] = '*'
-      }.to raise_error(Puppet::Error, /Invalid regexp/)
+      expect do
+        perms[param] = '*'
+      end.to raise_error(Puppet::Error, %r{Invalid regexp})
     end
   end
-  {:rabbitmq_vhost => 'dan@test', :rabbitmq_user => 'test@dan'}.each do |k,v|
+  # rubocop:disable RSpec/MultipleExpectations
+  { rabbitmq_vhost: 'dan@test', rabbitmq_user: 'test@dan' }.each do |k, v|
     it "should autorequire #{k}" do
-      if k == :rabbitmq_vhost
-        vhost = Puppet::Type.type(k).new(:name => "test")
-      else
-        vhost = Puppet::Type.type(k).new(:name => "test", :password => 'pass')
-      end
-      perm  = Puppet::Type.type(:rabbitmq_user_permissions).new(:name => v)
-      config = Puppet::Resource::Catalog.new :testing do |conf|
+      vhost = if k == :rabbitmq_vhost
+                Puppet::Type.type(k).new(name: 'test')
+              else
+                Puppet::Type.type(k).new(name: 'test', password: 'pass')
+              end
+      perm = Puppet::Type.type(:rabbitmq_user_permissions).new(name: v)
+      Puppet::Resource::Catalog.new :testing do |conf|
         [vhost, perm].each { |resource| conf.add_resource resource }
       end
       rel = perm.autorequire[0]
-      rel.source.ref.should == vhost.ref
-      rel.target.ref.should == perm.ref
+      expect(rel.source.ref).to eq(vhost.ref)
+      expect(rel.target.ref).to eq(perm.ref)
     end
   end
+  # rubocop:enable RSpec/MultipleExpectations
 end
index a73d9c9..eaa72d0 100644 (file)
@@ -1,52 +1,50 @@
-require 'puppet'
-require 'puppet/type/rabbitmq_user'
+require 'spec_helper'
 describe Puppet::Type.type(:rabbitmq_user) do
-  before :each do
-    @user = Puppet::Type.type(:rabbitmq_user).new(:name => 'foo', :password => 'pass')
+  let(:user) do
+    Puppet::Type.type(:rabbitmq_user).new(name: 'foo', password: 'pass')
   end
-  it 'should accept a user name' do
-    @user[:name] = 'dan'
-    @user[:name].should == 'dan'
-    @user[:admin].should == :false
+
+  it 'accepts a user name' do
+    user[:name] = 'dan'
+    expect(user[:name]).to eq('dan')
   end
-  it 'should accept a password' do
-    @user[:password] = 'foo'
-    @user[:password].should == 'foo'
+  it 'admin is false when :admin is not set' do
+    user[:name] = 'dan'
+    expect(user[:admin]).to eq(:false)
   end
-  it 'should require a password' do
-    expect {
-      Puppet::Type.type(:rabbitmq_user).new(:name => 'foo')
-    }.to raise_error(/must set password/)
+  it 'accepts a password' do
+    user[:password] = 'foo'
+    expect(user[:password]).to eq('foo')
   end
-  it 'should require a name' do
-    expect {
+  it 'requires a name' do
+    expect do
       Puppet::Type.type(:rabbitmq_user).new({})
-    }.to raise_error(Puppet::Error, 'Title or name must be provided')
+    end.to raise_error(Puppet::Error, 'Title or name must be provided')
   end
-  it 'should not allow whitespace in the name' do
-    expect {
-      @user[:name] = 'b r'
-    }.to raise_error(Puppet::Error, /Valid values match/)
+  it 'does not allow whitespace in the name' do
+    expect do
+      user[:name] = 'b r'
+    end.to raise_error(Puppet::Error, %r{Valid values match})
   end
   [true, false, 'true', 'false'].each do |val|
     it "admin property should accept #{val}" do
-      @user[:admin] = val
-      @user[:admin].should == val.to_s.to_sym
+      user[:admin] = val
+      expect(user[:admin]).to eq(val.to_s.to_sym)
     end
   end
-  it 'should not accept non-boolean values for admin' do
-    expect {
-      @user[:admin] = 'yes'
-    }.to raise_error(Puppet::Error, /Invalid value/)
+  it 'does not accept non-boolean values for admin' do
+    expect do
+      user[:admin] = 'yes'
+    end.to raise_error(Puppet::Error, %r{Invalid value})
   end
-  it 'should not accept tags with spaces' do
-    expect {
-      @user[:tags] = ['policy maker']
-    }.to raise_error(Puppet::Error, /Invalid tag/)
+  it 'does not accept tags with spaces' do
+    expect do
+      user[:tags] = ['policy maker']
+    end.to raise_error(Puppet::Error, %r{Invalid tag})
   end
-  it 'should not accept the administrator tag' do
-    expect {
-      @user[:tags] = ['administrator']
-    }.to raise_error(Puppet::Error, /must use admin property/)
+  it 'does not accept the administrator tag' do
+    expect do
+      user[:tags] = ['administrator']
+    end.to raise_error(Puppet::Error, %r{must use admin property})
   end
 end
index 70b8e37..38337b1 100644 (file)
@@ -1,21 +1,21 @@
-require 'puppet'
-require 'puppet/type/rabbitmq_vhost'
+require 'spec_helper'
 describe Puppet::Type.type(:rabbitmq_vhost) do
-  before :each do
-    @vhost = Puppet::Type.type(:rabbitmq_vhost).new(:name => 'foo')
+  let(:vhost) do
+    Puppet::Type.type(:rabbitmq_vhost).new(name: 'foo')
   end
-  it 'should accept a vhost name' do
-    @vhost[:name] = 'dan'
-    @vhost[:name].should == 'dan'
+
+  it 'accepts a vhost name' do
+    vhost[:name] = 'dan'
+    expect(vhost[:name]).to eq('dan')
   end
-  it 'should require a name' do
-    expect {
+  it 'requires a name' do
+    expect do
       Puppet::Type.type(:rabbitmq_vhost).new({})
-    }.to raise_error(Puppet::Error, 'Title or name must be provided')
+    end.to raise_error(Puppet::Error, 'Title or name must be provided')
   end
-  it 'should not allow whitespace in the name' do
-    expect {
-      @vhost[:name] = 'b r'
-    }.to raise_error(Puppet::Error, /Valid values match/)
+  it 'does not allow whitespace in the name' do
+    expect do
+      vhost[:name] = 'b r'
+    end.to raise_error(Puppet::Error, %r{Valid values match})
   end
 end
diff --git a/3rdparty/modules/rabbitmq/templates/inetrc.erb b/3rdparty/modules/rabbitmq/templates/inetrc.erb
new file mode 100644 (file)
index 0000000..8a990e8
--- /dev/null
@@ -0,0 +1,5 @@
+% This file managed by Puppet
+% Template Path: <%= @module_name %>/templates/inetrc
+<%- if @ipv6 -%>
+{inet6, true}.
+<%- end -%>
index 0c6b5d1..dabeef0 100644 (file)
@@ -1,5 +1,5 @@
-<%- @environment_variables.keys.sort.each do |key| -%>
-<%- if @environment_variables[key] != 'UNSET' -%>
-<%= key %>=<%= @environment_variables[key] %>
-<%- end -%>
-<%- end -%>
+<% @environment_variables.sort.each do |key, value| -%>
+  <%- unless value.nil? -%>
+<%= key %>=<%= value %>
+  <%- end -%>
+<% end -%>
index 4e2154e..791c919 100644 (file)
@@ -5,33 +5,72 @@
   {ssl, [{versions, [<%= @ssl_versions.sort.map { |v| "'#{v}'" }.join(', ') %>]}]},
 <%- end -%>
   {rabbit, [
-<% if @ldap_auth -%>
+<%- if @heartbeat -%>
+    {heartbeat, <%=@heartbeat%>},
+<% end -%>
+<% if @auth_backends -%>
+    {auth_backends, [<%= @auth_backends.map { |v| "#{v}" }.join(', ') %>]},
+<% elsif @ldap_auth -%>
     {auth_backends, [rabbit_auth_backend_internal, rabbit_auth_backend_ldap]},
 <% end -%>
 <% if @config_cluster -%>
     {cluster_nodes, {[<%= @cluster_nodes.map { |n| "\'rabbit@#{n}\'" }.join(', ') %>], <%= @cluster_node_type %>}},
     {cluster_partition_handling, <%= @cluster_partition_handling %>},
 <% end -%>
-<%- if @tcp_keepalive -%>
-    {tcp_listen_options, [{keepalive, true}]},
+    {tcp_listen_options, [
+         <%- unless @config_ranch -%>
+         binary,
+         {packet,        raw},
+         {reuseaddr,     true},
+         <%- end -%>
+         <%- if @tcp_keepalive -%>
+         {keepalive,     true},
+         <%- end -%>
+         <%- if @tcp_backlog -%>
+         {backlog,       <%= @tcp_backlog %>},
+         <%- end -%>
+         <%- if @tcp_sndbuf -%>
+         {sndbuf,       <%= @tcp_sndbuf %>},
+         <%- end -%>
+         <%- if @tcp_recbuf -%>
+         {recbuf,       <%= @tcp_recbuf %>},
+         <%- end -%>
+         {nodelay,       true},
+         {linger,        {true, 0}},
+         {exit_on_close, false}
+    ]},
+<%- if @collect_statistics_interval -%>
+    {collect_statistics_interval, <%= @collect_statistics_interval %>},
 <%- end -%>
 <%- if @ssl_only -%>
     {tcp_listeners, []},
-<%- elsif @interface != 'UNSET' -%>
+<%- elsif @interface -%>
     {tcp_listeners, [{"<%= @interface%>", <%= @port %>}]},
 <%- end -%>
 <%- if @ssl -%>
-  <%- if @ssl_interface != 'UNSET' -%>
+  <%- if @ssl_interface -%>
     {ssl_listeners, [{"<%= @ssl_interface%>", <%= @ssl_port %>}]},
   <%- else -%>
     {ssl_listeners, [<%= @ssl_port %>]},
   <%- end -%>
     {ssl_options, [
-                   <%- if @ssl_cacert != 'UNSET' -%>
+                   <%- if @ssl_cacert -%>
                    {cacertfile,"<%= @ssl_cacert %>"},
                    <%- end -%>
                    {certfile,"<%= @ssl_cert %>"},
                    {keyfile,"<%= @ssl_key %>"},
+                   <%- if @ssl_cert_password -%>
+                   {password, "<%= @ssl_cert_password %>"},
+                   <%- end -%>
+                   <%- if @ssl_depth -%>
+                   {depth,<%= @ssl_depth %>},
+                   <%- end -%>
+                   <%- if @ssl_dhfile -%>
+                   {dhfile, "<%= @ssl_dhfile %>"},
+                   <%- end -%>
+                   {secure_renegotiate,<%= @ssl_secure_renegotiate %>},
+                   {reuse_sessions,<%= @ssl_reuse_sessions %>},
+                   {honor_cipher_order,<%= @ssl_honor_cipher_order %>},
                    {verify,<%= @ssl_verify %>},
                    {fail_if_no_peer_cert,<%= @ssl_fail_if_no_peer_cert %>}
                    <%- if @ssl_versions -%>
@@ -44,9 +83,9 @@
                    <%- end -%>
                   ]},
 <%- end -%>
-<% if @config_variables -%>
-<%- @config_variables.keys.sort.each do |key| -%>
-    {<%= key %>, <%= @config_variables[key] %>},
+<% if scope['rabbitmq::config_variables'] -%>
+<%- scope['rabbitmq::config_variables'].keys.sort.each do |key| -%>
+    {<%= key %>, <%= scope['rabbitmq::config_variables'][key] %>},
 <%- end -%>
 <%- end -%>
     {default_user, <<"<%= @default_user %>">>},
     <%= @config_kernel_variables.sort.map{|k,v| "{#{k}, #{v}}"}.join(",\n    ") %>
   ]}
 <%- end -%>
-<%- if @admin_enable -%>,
+<%- if @admin_enable or !@config_management_variables.empty? -%>,
   {rabbitmq_management, [
+    <%- if !@config_management_variables.empty? -%>
+    <%= @config_management_variables.sort.map{|k,v| "{#{k}, #{v}}"}.join(",\n    ") %>
+    <%- end -%>
+<%- if @admin_enable -%>
+<%- if  !@config_management_variables.empty? -%>,<%-end-%>
     {listener, [
-<%- if @ssl -%>
+<%- if @ssl && @management_ssl -%>
+  <%- if @management_ip_address -%>
+      {ip, "<%= @management_ip_address %>"},
+  <%- end -%>
       {port, <%= @ssl_management_port %>},
       {ssl, true},
-      {ssl_opts, [<%- if @ssl_cacert != 'UNSET' -%>{cacertfile, "<%= @ssl_cacert %>"},<%- end -%>
-
+      {ssl_opts, [<%- if @ssl_cacert %>
+                  {cacertfile, "<%= @ssl_cacert %>"},
+                  <%- end -%>
                   {certfile, "<%= @ssl_cert %>"},
-                  {keyfile, "<%= @ssl_key %>"}
+                  {keyfile, "<%= @ssl_key %>"},
+                  {verify,<%= @ssl_management_verify %>},
+                  {fail_if_no_peer_cert,<%= @ssl_management_fail_if_no_peer_cert %>}
                    <%- if @ssl_versions -%>
                      ,{versions, [<%= @ssl_versions.sort.map { |v| "'#{v}'" }.join(', ') %>]}
                    <%- end -%>
                   <%- end -%>
                  ]}
 <%- else -%>
+  <%- if @management_ip_address -%>
+      {ip, "<%= @management_ip_address %>"},
+  <%- end -%>
       {port, <%= @management_port %>}
 <%- end -%>
     ]}
+<%- end -%>
   ]}
 <%- end -%>
 <% if @config_stomp -%>,
 % Configure the Stomp Plugin listening port
   {rabbitmq_stomp, [
+  <%- if @stomp_ssl_only -%>
+    {tcp_listeners, []}
+  <%- else -%>
     {tcp_listeners, [<%= @stomp_port %>]}
-  <%- if @ssl && @ssl_stomp_port -%>,
+  <%- end -%>
+  <%- if @ssl && @ssl_stomp_port -%>
+    ,
     {ssl_listeners, [<%= @ssl_stomp_port %>]}
   <%- end -%>
   ]}
   {rabbitmq_auth_backend_ldap, [
     {other_bind, <%= @ldap_other_bind %>},
     {servers, ["<%= @ldap_server %>"]},
+<% if @ldap_user_dn_pattern -%>
     {user_dn_pattern, "<%= @ldap_user_dn_pattern %>"},
+<%- end -%>
     {use_ssl, <%= @ldap_use_ssl %>},
     {port, <%= @ldap_port %>},
 <% if @ldap_config_variables -%>
     {log, <%= @ldap_log %>}
   ]}
 <%- end -%>
+<%- if @config_shovel and not @config_shovel_statics.empty? -%>,
+  {rabbitmq_shovel,
+    [{shovels,[
+      <%= @config_shovel_statics.sort.map{|k,v| "{#{k},[#{v}]}"}.join(",\n      ") %>
+    ]}]}
+<%- end -%>
+<%- if @config_additional_variables and not @config_additional_variables.empty? -%>,
+% Additional config
+<%- @config_additional_variables.keys.sort.each do |key| -%>
+  {<%= key %>, <%= @config_additional_variables[key] %>}<%- if key != @config_additional_variables.keys.sort.last %>,<% end %>
+<%- end -%>
+<%- end -%>
 ].
 % EOF
index d76c811..c7ed0a2 100644 (file)
@@ -1,7 +1,16 @@
 [default]
-<% if @ssl -%>
+<% if @ssl && @management_ssl -%>
 ssl = True
+ssl_ca_cert_file = <%= @ssl_cacert %>
+ssl_cert_file = <%= @ssl_cert %>
+ssl_key_file = <%= @ssl_key %>
 port = <%= @ssl_management_port %>
+<% unless @management_hostname -%>
+hostname = <%= @fqdn %>
+<% end -%>
 <% else -%>
 port = <%= @management_port %>
 <% end -%>
+<% if @management_hostname %>
+hostname = <%= @management_hostname %>
+<% end -%>
diff --git a/3rdparty/modules/rabbitmq/tests/erlang_deps.pp b/3rdparty/modules/rabbitmq/tests/erlang_deps.pp
deleted file mode 100644 (file)
index d34d944..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-# install first the garethr-erlang module. See README.md
-include 'erlang'
-
-class { 'erlang': epel_enable => true}
-Class['erlang'] -> Class['rabbitmq']
diff --git a/3rdparty/modules/rabbitmq/tests/full.pp b/3rdparty/modules/rabbitmq/tests/full.pp
deleted file mode 100644 (file)
index c6dfc5c..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-class { 'rabbitmq::repo::apt':
-  pin => '900',
-}->
-class { 'rabbitmq::server':
-  delete_guest_user => true,
-#  version           => '2.4.1',
-}->
-rabbitmq_user { 'dan':
-  admin    => true,
-  password => 'pass',
-  provider => 'rabbitmqctl',
-}->
-rabbitmq_vhost { 'myhost':
-  provider => 'rabbitmqctl',
-}
-rabbitmq_user_permissions { 'dan@myhost':
-  configure_permission => '.*',
-  read_permission      => '.*',
-  write_permission     => '.*',
-  provider             => 'rabbitmqctl',
-}
diff --git a/3rdparty/modules/rabbitmq/tests/permissions/add.pp b/3rdparty/modules/rabbitmq/tests/permissions/add.pp
deleted file mode 100644 (file)
index fb71af1..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-rabbitmq_user { 'blah7':
-  password => 'foo',
-}
-rabbitmq_vhost { 'test5': }
-rabbitmq_user_permissions { 'blah7@test5':
-  configure_permission => 'config2',
-  read_permission      => 'ready',
-  #write_permission     => 'ready',
-}
diff --git a/3rdparty/modules/rabbitmq/tests/plugin.pp b/3rdparty/modules/rabbitmq/tests/plugin.pp
deleted file mode 100644 (file)
index 6c5605b..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-class { 'rabbitmq::server':
-    config_stomp => true,
-}
-
-$rabbitmq_plugins = [ 'amqp_client', 'rabbitmq_stomp' ]
-
-rabbitmq_plugin { $rabbitmq_plugins:
-  ensure   => present,
-  require  => Class['rabbitmq::server'],
-  provider => 'rabbitmqplugins',
-}
diff --git a/3rdparty/modules/rabbitmq/tests/repo/apt.pp b/3rdparty/modules/rabbitmq/tests/repo/apt.pp
deleted file mode 100644 (file)
index f137373..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-# requires pupetlabs-apt
-include rabbitmq::repo::apt
diff --git a/3rdparty/modules/rabbitmq/tests/server.pp b/3rdparty/modules/rabbitmq/tests/server.pp
deleted file mode 100644 (file)
index caea893..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-class { 'rabbitmq::server':
-  port              => '5672',
-  delete_guest_user => true,
-  version           => 'latest',
-}
diff --git a/3rdparty/modules/rabbitmq/tests/service.pp b/3rdparty/modules/rabbitmq/tests/service.pp
deleted file mode 100644 (file)
index 9a00d2b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-class { 'rabbitmq::service': }
diff --git a/3rdparty/modules/rabbitmq/tests/site.pp b/3rdparty/modules/rabbitmq/tests/site.pp
deleted file mode 100644 (file)
index 75ebcfe..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-node default {
-
-  $rabbitmq_plugins = [ 'amqp_client', 'rabbitmq_stomp' ]
-
-  class { 'rabbitmq::server':
-    config => '[ {rabbit_stomp, [{tcp_listeners, [1234]} ]} ].',
-  }
-
-  # Required for MCollective
-  rabbitmq_plugin { $rabbitmq_plugins:
-    ensure   => present,
-    require  => Class['rabbitmq::server'],
-    provider => 'rabbitmqplugins',
-  }
-}
-
diff --git a/3rdparty/modules/rabbitmq/tests/user/add.pp b/3rdparty/modules/rabbitmq/tests/user/add.pp
deleted file mode 100644 (file)
index 2c3a870..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-rabbitmq_user { ['blah2', 'blah3', 'blah4']:
-  password => 'phoey!',
-  #provider => 'rabbitmqctl',
-}
diff --git a/3rdparty/modules/rabbitmq/tests/vhosts/add.pp b/3rdparty/modules/rabbitmq/tests/vhosts/add.pp
deleted file mode 100644 (file)
index d818a19..0000000
+++ /dev/null
@@ -1 +0,0 @@
-rabbitmq_vhost { ['fooey', 'blah']: }