diff --git a/.sync.yml b/.sync.yml index 478e0c6..6d9140d 100644 --- a/.sync.yml +++ b/.sync.yml @@ -1,43 +1,46 @@ --- .github/CONTRIBUTING.md: delete: true .github/ISSUE_TEMPLATE.md: delete: true .github/PULL_REQUEST_TEMPLATE.md: delete: true .gitlab-ci.yml: delete: true .travis.yml: remove_branches: - main - /^v\d/ docker_sets: - set: debian9-64 - set: debian10-64 - set: ubuntu1804-64 - set: centos7-64 irc: false user: 'deric' secure: 'K3gfvfUtsZ4l6TTChG5jBLIB4j9ZG3zQECBCMI0ZcYiyiFYIihDtraO6sTf0qOcocRg5TpihBNJ8IpBPdDvd8bOrQCIWnSor2hP6NKA8J0XCDX5H4hmyieJhFCuGydaopia6rATEbj4TIOzMk8zPVc/lavg4yRkpwcxCy7UQVKc=' Rakefile: config.user: 'deric' spec/spec_helper.rb: spec_overrides: "require 'spec_helper_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_local.rb'))" Gemfile: required: ":development": - - gem: 'overcommit' + - gem: 'github_changelog_generator' + version: '~> 1.15' + condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.3.0')" + - gem: overcommit optional: ':acceptance': - gem: beaker - gem: beaker-rspec - gem: beaker-docker - gem: beaker-puppet_install_helper - gem: beaker-module_install_helper diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ed12d9..ec883d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,119 +1,368 @@ -## 1.0.0 -- New features: - - [Support Puppet 6](https://github.com/deric/puppet-zookeeper/issues/132) (#132) - - [allow configuring additional log appenders (#139)](https://github.com/deric/puppet-zookeeper/pull/139) -- Changes: - - Drop support for Puppet 3 ([#144](https://github.com/deric/puppet-zookeeper/pull/144)) - - Drop support for Puppet 4 ([#145](https://github.com/deric/puppet-zookeeper/pull/145)) - - Drop support for Debian (6, 7) and Ubuntu (10.04, 12.04, 14.04) ([#143](https://github.com/deric/puppet-zookeeper/pull/143)) -- Fixes: - - Fixed and extended acceptance tests -- [Full diff](https://github.com/deric/puppet-zookeeper/compare/v0.8.7...v1.0.0) - - -## 0.8.7 -- New features: - - [Support global outstanding limit](https://github.com/deric/puppet-zookeeper/issues/128) (#128) -- Fixes: - - Fixed and extended acceptance tests -- [Full diff](https://github.com/deric/puppet-zookeeper/compare/v0.8.6...v0.8.7) - -## 0.8.6 -- New features: - - [Support commands whitelist](https://github.com/deric/puppet-zookeeper/issues/135) (#135) - - [Support proxy_server for archive install method](https://github.com/deric/puppet-zookeeper/issues/133) (#133) -- Fixes: - - Fixed mirror URI for ZooKeeper 3.5.5 from archive (d33cf0289333846775860751d12533e72f284c3e) -- [Full diff](https://github.com/deric/puppet-zookeeper/compare/v0.8.5...v0.8.6) - -## 0.8.5 -- Replace 'require' function with an explicit relationship (#125) -- Allow puppetlabs/stdlib 6.x, puppet/archive 4.x (#131) -- Use mirror according to required version (#129) -- [Full diff](https://github.com/deric/puppet-zookeeper/compare/v0.8.4...v0.8.5) - -## 0.8.4 -- Bugfix: prevent service from failing to log any upcoming events ([#122](https://github.com/deric/puppet-zookeeper/pull/122)) -- [Full diff](https://github.com/deric/puppet-zookeeper/compare/v0.8.2...v0.8.4) - -## 0.8.3 -- Same as `v0.8.2` (incorrectly tagged release) - -## 0.8.2 -- [Full diff](https://github.com/deric/puppet-zookeeper/compare/v0.8.1...v0.8.2) -- Fixed `JAVA_OPTS` broken with enabled SASL auth ([#120](https://github.com/deric/puppet-zookeeper/pull/120)) - -## 0.8.1 -* Allow newer dependencies stdlib, archive, puppet (#116) -* Include SASL parameters in init.pp (#115) - -## 0.8.0 -* Dropped Puppet 3 support (still might work with `FUTURE_PARSER=true`) - -## 0.7.7 -- [Full diff](https://github.com/deric/puppet-zookeeper/compare/v0.7.6...v0.7.7) -- Drop testing on Ruby 1.9.3 -- Include Puppet 5 in build matrix -- Fixes: - - [Replace sh with bash in systemd unit](https://github.com/deric/puppet-zookeeper/pull/113) #113 - -## 0.7.6 -- [Full diff](https://github.com/deric/puppet-zookeeper/compare/v0.7.5...v0.7.6) -- Fixes: - - [zookeeper does not start under debian stretch](https://github.com/deric/puppet-zookeeper/issues/109) #109 - -## 0.7.5 -- [Full diff](https://github.com/deric/puppet-zookeeper/compare/v0.7.4...v0.7.5) -- New features: - - Support Debian 9 - - [Allow configuring log file size](https://github.com/deric/puppet-zookeeper/pull/105) - - [Allow customizing systed path](https://github.com/deric/puppet-zookeeper/commit/96ae6ee6fd398249d9218c8b242ac39d950bdd9a) -- Fixes: - - [Properly configure log dir](https://github.com/deric/puppet-zookeeper/issues/108) #108 - - [Fix systemd wants directive](https://github.com/deric/puppet-zookeeper/issues/103) #103 - - [replace all resource-style class with plain `include`](https://github.com/deric/puppet-zookeeper/pull/106) - -## 0.7.4 -- [Full diff](https://github.com/deric/puppet-zookeeper/compare/v0.7.3...v0.7.4) -- New features: - - [Allow service restarts to be skipped on change](https://github.com/deric/puppet-zookeeper/pull/100) #100 - - [Provide option to remove host and realm from Kerberos principal](https://github.com/deric/puppet-zookeeper/pull/99) -- Fixes: - - [systemd classpath overwritten](https://github.com/deric/puppet-zookeeper/issues/101) #102 - -## 0.7.3 -- New features: - - [Enable possibility of system users for zookeeper](https://github.com/deric/puppet-zookeeper/pull/98) #98 - -- Fixes: - - [Make service run even if bin/zkEnv.sh does not exist](https://github.com/deric/puppet-zookeeper/pull/94) #94 - - [Ensure that `/etc/zookeeper` directory exists when installing from archive](https://github.com/deric/puppet-zookeeper/issues/96) #96 -- [Full diff](https://github.com/deric/puppet-zookeeper/compare/v0.7.2...v0.7.3) - -## 0.7.2 -- New or changed features: - - [Basic acceptance tests](https://github.com/deric/puppet-zookeeper/issues/90) -- Other changes and fixes: - - [Service filename should be equal to the service name](https://github.com/deric/puppet-zookeeper/pull/91) - - [Fix service settings when installing from archive](https://github.com/deric/puppet-zookeeper/pull/92) -- [Full diff](https://github.com/deric/puppet-zookeeper/compare/v0.7.1...v0.7.2) - -## 0.7.1 -* New or changed features: - * [Exihibitor support](https://github.com/deric/puppet-zookeeper/pull/85) -* Other changes and fixes: - * [Fixed duplicate java.env declaration when using SASL #89](https://github.com/deric/puppet-zookeeper/issues/89) - * [Dependency cycle with archive install method #87](https://github.com/deric/puppet-zookeeper/issues/87) - -## 0.7.0 -* New or changed features: - * Support installation from source package instead of binary package - * Ability to install arbitrary versions of Zookeeper from source packages -* Other changes and fixes: - * Remove deprecated parameters `service_package`, `start_with`, `manage_systemd` - * Use correct value for parameter `zoo_dir` in `zookeeper::service` - * Move all parameters to `params.pp` (and remove them from private classes) - * Overall improvements to the code (style, simplification, deduplication) -* Compatibility warnings: - * All classes except the main `zookeeper` class are private classes and should not be used directly - * Fails when using removed parameters `service_package`, `start_with`, `manage_systemd` +# Change log + +All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org). + +## [v1.1.0](https://github.com/deric/puppet-zookeeper/tree/v1.1.0) (2021-03-16) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v1.0.0...v1.1.0) + +### Added + +- Add var for preAllocSize [\#166](https://github.com/deric/puppet-zookeeper/pull/166) ([deemon87](https://github.com/deemon87)) +- Allow changing initialize datastore binary path [\#163](https://github.com/deric/puppet-zookeeper/pull/163) ([olevole](https://github.com/olevole)) +- add port\_unification parameter [\#159](https://github.com/deric/puppet-zookeeper/pull/159) ([jduepmeier](https://github.com/jduepmeier)) +- Add support for parameter secureClientPort [\#156](https://github.com/deric/puppet-zookeeper/pull/156) ([dhoppe](https://github.com/dhoppe)) +- Add support for SLES 12 [\#155](https://github.com/deric/puppet-zookeeper/pull/155) ([dhoppe](https://github.com/dhoppe)) +- Support CentOS 8 [\#152](https://github.com/deric/puppet-zookeeper/pull/152) ([bjoernhaeuser](https://github.com/bjoernhaeuser)) + +### Fixed + +- install\_method set to archive should not try and install the repository [\#164](https://github.com/deric/puppet-zookeeper/pull/164) ([achevalet](https://github.com/achevalet)) +- Move daemon-reload to restart\_on\_change [\#162](https://github.com/deric/puppet-zookeeper/pull/162) ([yakirgb](https://github.com/yakirgb)) +- Ignore CLASSPATH if systemd is used [\#157](https://github.com/deric/puppet-zookeeper/pull/157) ([dhoppe](https://github.com/dhoppe)) + +## [v1.0.0](https://github.com/deric/puppet-zookeeper/tree/v1.0.0) (2020-04-14) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.8.7...v1.0.0) + +### UNCATEGORIZED PRS; LABEL THEM ON GITHUB + +- Modulesync 2.12.0 [\#148](https://github.com/deric/puppet-zookeeper/pull/148) ([dhoppe](https://github.com/dhoppe)) +- Add support for Modulesync [\#146](https://github.com/deric/puppet-zookeeper/pull/146) ([dhoppe](https://github.com/dhoppe)) +- Drop support for Puppet 4 [\#145](https://github.com/deric/puppet-zookeeper/pull/145) ([dhoppe](https://github.com/dhoppe)) +- Drop support for Puppet 3 [\#144](https://github.com/deric/puppet-zookeeper/pull/144) ([dhoppe](https://github.com/dhoppe)) +- Drop support for Debian \(6, 7\) and Ubuntu \(10.04, 12.04, 14.04\) [\#143](https://github.com/deric/puppet-zookeeper/pull/143) ([dhoppe](https://github.com/dhoppe)) +- Support for new distro releases [\#141](https://github.com/deric/puppet-zookeeper/pull/141) ([Hexta](https://github.com/Hexta)) +- allow configuring additional log appenders [\#139](https://github.com/deric/puppet-zookeeper/pull/139) ([automaticserver](https://github.com/automaticserver)) +- Symlink not needed if using Exhibitor [\#114](https://github.com/deric/puppet-zookeeper/pull/114) ([maximedevalland](https://github.com/maximedevalland)) + +## [v0.8.7](https://github.com/deric/puppet-zookeeper/tree/v0.8.7) (2019-08-13) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.8.6...v0.8.7) + +## [v0.8.6](https://github.com/deric/puppet-zookeeper/tree/v0.8.6) (2019-08-12) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.8.5...v0.8.6) + +## [v0.8.5](https://github.com/deric/puppet-zookeeper/tree/v0.8.5) (2019-06-21) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.8.4...v0.8.5) + +### UNCATEGORIZED PRS; LABEL THEM ON GITHUB + +- Allow puppetlabs/stdlib 6.x, puppet/archive 4.x [\#131](https://github.com/deric/puppet-zookeeper/pull/131) ([dhoppe](https://github.com/dhoppe)) +- Update archive filename for version 3.5.5+ install [\#130](https://github.com/deric/puppet-zookeeper/pull/130) ([alexconrey](https://github.com/alexconrey)) +- Remove require functions [\#125](https://github.com/deric/puppet-zookeeper/pull/125) ([PierreR](https://github.com/PierreR)) + +## [v0.8.4](https://github.com/deric/puppet-zookeeper/tree/v0.8.4) (2019-02-05) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.8.2...v0.8.4) + +### UNCATEGORIZED PRS; LABEL THEM ON GITHUB + +- Fix bug: prevent service from failing to log any upcoming events [\#122](https://github.com/deric/puppet-zookeeper/pull/122) ([theosotr](https://github.com/theosotr)) + +## [v0.8.2](https://github.com/deric/puppet-zookeeper/tree/v0.8.2) (2019-01-31) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.8.3...v0.8.2) + +## [v0.8.3](https://github.com/deric/puppet-zookeeper/tree/v0.8.3) (2019-01-31) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.8.1...v0.8.3) + +### UNCATEGORIZED PRS; LABEL THEM ON GITHUB + +- fixing typo in readme [\#121](https://github.com/deric/puppet-zookeeper/pull/121) ([sergigp](https://github.com/sergigp)) +- Fix JAVA\_OPTS broken with enabled sasl auth [\#120](https://github.com/deric/puppet-zookeeper/pull/120) ([Thor77](https://github.com/Thor77)) + +## [v0.8.1](https://github.com/deric/puppet-zookeeper/tree/v0.8.1) (2018-10-24) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.8.0...v0.8.1) + +### UNCATEGORIZED PRS; LABEL THEM ON GITHUB + +- allow puppet 5.x, puppetlabs/stdlib 5.x and puppet/archive 3.x [\#116](https://github.com/deric/puppet-zookeeper/pull/116) ([bastelfreak](https://github.com/bastelfreak)) +- Allow to set sasl users in init.pp [\#115](https://github.com/deric/puppet-zookeeper/pull/115) ([simioa](https://github.com/simioa)) + +## [v0.8.0](https://github.com/deric/puppet-zookeeper/tree/v0.8.0) (2018-07-22) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.7.7...v0.8.0) + +### UNCATEGORIZED PRS; LABEL THEM ON GITHUB + +- use puppet types [\#107](https://github.com/deric/puppet-zookeeper/pull/107) ([TheMeier](https://github.com/TheMeier)) + +## [v0.7.7](https://github.com/deric/puppet-zookeeper/tree/v0.7.7) (2018-03-07) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.7.6...v0.7.7) + +### Fixed + +- Replace sh with bash in systemd unit [\#113](https://github.com/deric/puppet-zookeeper/pull/113) ([marfx000](https://github.com/marfx000)) + +### UNCATEGORIZED PRS; LABEL THEM ON GITHUB + +- Fix Minor Version typo in changelog [\#110](https://github.com/deric/puppet-zookeeper/pull/110) ([christek91](https://github.com/christek91)) + +## [v0.7.6](https://github.com/deric/puppet-zookeeper/tree/v0.7.6) (2017-11-29) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.7.5...v0.7.6) + +## [v0.7.5](https://github.com/deric/puppet-zookeeper/tree/v0.7.5) (2017-10-17) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.7.4...v0.7.5) + +### UNCATEGORIZED PRS; LABEL THEM ON GITHUB + +- WIP: replace all resource-style class with plain `include` [\#106](https://github.com/deric/puppet-zookeeper/pull/106) ([Andor](https://github.com/Andor)) +- A pair of log4j properties like vars [\#105](https://github.com/deric/puppet-zookeeper/pull/105) ([alvarolmedo](https://github.com/alvarolmedo)) + +## [v0.7.4](https://github.com/deric/puppet-zookeeper/tree/v0.7.4) (2017-08-30) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.7.3...v0.7.4) + +### Fixed + +- 101: do not overwrite the CLASSPATH [\#102](https://github.com/deric/puppet-zookeeper/pull/102) ([denys-mazhar-rp](https://github.com/denys-mazhar-rp)) + +### UNCATEGORIZED PRS; LABEL THEM ON GITHUB + +- Allow service restarts to be skipped on change [\#100](https://github.com/deric/puppet-zookeeper/pull/100) ([quixoten](https://github.com/quixoten)) +- Provide option to remove host and realm from Kerberos principal [\#99](https://github.com/deric/puppet-zookeeper/pull/99) ([dlanza1](https://github.com/dlanza1)) + +## [v0.7.3](https://github.com/deric/puppet-zookeeper/tree/v0.7.3) (2017-06-02) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.7.2...v0.7.3) + +### UNCATEGORIZED PRS; LABEL THEM ON GITHUB + +- enable possibility of system users for zookeeper [\#98](https://github.com/deric/puppet-zookeeper/pull/98) ([Wayneoween](https://github.com/Wayneoween)) +- Make service run even if bin/zkEnv.sh does not exist [\#94](https://github.com/deric/puppet-zookeeper/pull/94) ([dlanza1](https://github.com/dlanza1)) + +## [v0.7.2](https://github.com/deric/puppet-zookeeper/tree/v0.7.2) (2017-03-20) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.7.1...v0.7.2) + +### UNCATEGORIZED PRS; LABEL THEM ON GITHUB + +- Fix service settings when installing from archive [\#92](https://github.com/deric/puppet-zookeeper/pull/92) ([antyale](https://github.com/antyale)) +- Service filename should be equal to the service name [\#91](https://github.com/deric/puppet-zookeeper/pull/91) ([antyale](https://github.com/antyale)) + +## [v0.7.1](https://github.com/deric/puppet-zookeeper/tree/v0.7.1) (2017-01-23) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.7.0...v0.7.1) + +### UNCATEGORIZED PRS; LABEL THEM ON GITHUB + +- \[Issue \#87\] Refactor zookeeper user & group creation [\#88](https://github.com/deric/puppet-zookeeper/pull/88) ([travees](https://github.com/travees)) +- fix a typo in template [\#86](https://github.com/deric/puppet-zookeeper/pull/86) ([eyal-lupu](https://github.com/eyal-lupu)) +- Add exhibitor support [\#85](https://github.com/deric/puppet-zookeeper/pull/85) ([travees](https://github.com/travees)) + +## [v0.7.0](https://github.com/deric/puppet-zookeeper/tree/v0.7.0) (2016-12-05) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.6.1...v0.7.0) + +### UNCATEGORIZED PRS; LABEL THEM ON GITHUB + +- parameterize environment file [\#82](https://github.com/deric/puppet-zookeeper/pull/82) ([cristifalcas](https://github.com/cristifalcas)) +- fix template for el6 server [\#79](https://github.com/deric/puppet-zookeeper/pull/79) ([cristifalcas](https://github.com/cristifalcas)) +- Proposal: extensive refactoring [\#74](https://github.com/deric/puppet-zookeeper/pull/74) ([fraenki](https://github.com/fraenki)) + +## [v0.6.1](https://github.com/deric/puppet-zookeeper/tree/v0.6.1) (2016-08-04) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.6.0...v0.6.1) + +## [v0.6.0](https://github.com/deric/puppet-zookeeper/tree/v0.6.0) (2016-08-03) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.5.5...v0.6.0) + +### Added + +- SASL authentication [\#70](https://github.com/deric/puppet-zookeeper/pull/70) ([deric](https://github.com/deric)) + +### UNCATEGORIZED PRS; LABEL THEM ON GITHUB + +- Custom zookeeper ids configurable [\#69](https://github.com/deric/puppet-zookeeper/pull/69) ([rohte](https://github.com/rohte)) +- Replaces "Redhat" by "RedHat" as it won't match [\#68](https://github.com/deric/puppet-zookeeper/pull/68) ([alejandroandreu](https://github.com/alejandroandreu)) + +## [v0.5.5](https://github.com/deric/puppet-zookeeper/tree/v0.5.5) (2016-05-27) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.5.4...v0.5.5) + +## [v0.5.4](https://github.com/deric/puppet-zookeeper/tree/v0.5.4) (2016-04-25) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.5.3...v0.5.4) + +### UNCATEGORIZED PRS; LABEL THEM ON GITHUB + +- Drop init script on Redhat-derived systems [\#63](https://github.com/deric/puppet-zookeeper/pull/63) ([ghost](https://github.com/ghost)) +- Fix RedHat 6 service provider [\#61](https://github.com/deric/puppet-zookeeper/pull/61) ([ortz](https://github.com/ortz)) + +## [v0.5.3](https://github.com/deric/puppet-zookeeper/tree/v0.5.3) (2016-03-30) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.5.2...v0.5.3) + +### UNCATEGORIZED PRS; LABEL THEM ON GITHUB + +- Tell systemd that this service needs a running process. [\#60](https://github.com/deric/puppet-zookeeper/pull/60) ([deric](https://github.com/deric)) +- Update zookeeper.init.erb [\#59](https://github.com/deric/puppet-zookeeper/pull/59) ([bobra200](https://github.com/bobra200)) +- Have $manage\_service\_file honored for init [\#58](https://github.com/deric/puppet-zookeeper/pull/58) ([RainofTerra](https://github.com/RainofTerra)) + +## [v0.5.2](https://github.com/deric/puppet-zookeeper/tree/v0.5.2) (2016-03-12) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.5.1...v0.5.2) + +## [v0.5.1](https://github.com/deric/puppet-zookeeper/tree/v0.5.1) (2016-02-19) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.5.0...v0.5.1) + +### Added + +- Init file [\#51](https://github.com/deric/puppet-zookeeper/pull/51) ([Vlaszaty](https://github.com/Vlaszaty)) + +## [v0.5.0](https://github.com/deric/puppet-zookeeper/tree/v0.5.0) (2016-02-17) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.4.2...v0.5.0) + +### UNCATEGORIZED PRS; LABEL THEM ON GITHUB + +- Align Java options between files [\#54](https://github.com/deric/puppet-zookeeper/pull/54) ([eyal-lupu](https://github.com/eyal-lupu)) +- don't zookeeper service if already exists [\#52](https://github.com/deric/puppet-zookeeper/pull/52) ([deric](https://github.com/deric)) +- Create user and group to run zookeeper under. [\#49](https://github.com/deric/puppet-zookeeper/pull/49) ([Vlaszaty](https://github.com/Vlaszaty)) +- Fix for https://github.com/deric/puppet-zookeeper/issues/47 [\#48](https://github.com/deric/puppet-zookeeper/pull/48) ([eyal-lupu](https://github.com/eyal-lupu)) +- Fix logging level setup and styling to config file [\#45](https://github.com/deric/puppet-zookeeper/pull/45) ([eyal-lupu](https://github.com/eyal-lupu)) + +## [v0.4.2](https://github.com/deric/puppet-zookeeper/tree/v0.4.2) (2016-01-12) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.4.1...v0.4.2) + +### UNCATEGORIZED PRS; LABEL THEM ON GITHUB + +- Added ability to configure custom \(local\) repository for installation [\#40](https://github.com/deric/puppet-zookeeper/pull/40) ([danielvdende](https://github.com/danielvdende)) + +## [v0.4.1](https://github.com/deric/puppet-zookeeper/tree/v0.4.1) (2015-12-16) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.4.0...v0.4.1) + +### UNCATEGORIZED PRS; LABEL THEM ON GITHUB + +- Add missing trailing quote [\#39](https://github.com/deric/puppet-zookeeper/pull/39) ([james-masson](https://github.com/james-masson)) +- Added user and group as parameters for zookeeper conf template. [\#37](https://github.com/deric/puppet-zookeeper/pull/37) ([danielvdende](https://github.com/danielvdende)) +- add support for cloudera cdh repo version 5 [\#35](https://github.com/deric/puppet-zookeeper/pull/35) ([EslamElHusseiny](https://github.com/EslamElHusseiny)) + +## [v0.4.0](https://github.com/deric/puppet-zookeeper/tree/v0.4.0) (2015-09-16) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.3.9...v0.4.0) + +### UNCATEGORIZED PRS; LABEL THEM ON GITHUB + +- Update project non-development dependencies. [\#32](https://github.com/deric/puppet-zookeeper/pull/32) ([MrAlias](https://github.com/MrAlias)) +- CentOS7 with mesosphere repo installation fix [\#31](https://github.com/deric/puppet-zookeeper/pull/31) ([cornelf](https://github.com/cornelf)) +- replacing debian with redhat in the redhat.pp manifest [\#30](https://github.com/deric/puppet-zookeeper/pull/30) ([jmktam](https://github.com/jmktam)) +- manage systemd unit files optionally [\#26](https://github.com/deric/puppet-zookeeper/pull/26) ([cristifalcas](https://github.com/cristifalcas)) +- zoo.cfg: Add maxSessionTimeout in the template [\#25](https://github.com/deric/puppet-zookeeper/pull/25) ([Spredzy](https://github.com/Spredzy)) + +## [v0.3.9](https://github.com/deric/puppet-zookeeper/tree/v0.3.9) (2015-06-04) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.3.8...v0.3.9) + +### UNCATEGORIZED PRS; LABEL THEM ON GITHUB + +- Support CentOS 7 [\#24](https://github.com/deric/puppet-zookeeper/pull/24) ([domq](https://github.com/domq)) +- Fixed dependency in "initialize\_datastore" step [\#23](https://github.com/deric/puppet-zookeeper/pull/23) ([stephanmitchev](https://github.com/stephanmitchev)) + +## [v0.3.8](https://github.com/deric/puppet-zookeeper/tree/v0.3.8) (2015-05-13) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.3.7...v0.3.8) + +### UNCATEGORIZED PRS; LABEL THEM ON GITHUB + +- Adding datalogstore param for dataLogDir to split transaction logs onto different directory [\#21](https://github.com/deric/puppet-zookeeper/pull/21) ([redstonemercury](https://github.com/redstonemercury)) + +## [v0.3.7](https://github.com/deric/puppet-zookeeper/tree/v0.3.7) (2015-04-23) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.3.6...v0.3.7) + +### UNCATEGORIZED PRS; LABEL THEM ON GITHUB + +- Add support for declaring observers in the zookeeper cluster [\#19](https://github.com/deric/puppet-zookeeper/pull/19) ([kscherer](https://github.com/kscherer)) + +## [v0.3.6](https://github.com/deric/puppet-zookeeper/tree/v0.3.6) (2015-04-08) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.3.5...v0.3.6) + +### UNCATEGORIZED PRS; LABEL THEM ON GITHUB + +- Fixed missing ports in server line of zoo.cfg.erb [\#17](https://github.com/deric/puppet-zookeeper/pull/17) ([brutus333](https://github.com/brutus333)) +- added = to allow for variable to be set [\#15](https://github.com/deric/puppet-zookeeper/pull/15) ([fin09pcap](https://github.com/fin09pcap)) +- Support attribute clientPortAddress in zoo.cfg [\#14](https://github.com/deric/puppet-zookeeper/pull/14) ([pbyrne413](https://github.com/pbyrne413)) + +## [v0.3.5](https://github.com/deric/puppet-zookeeper/tree/v0.3.5) (2015-02-09) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.3.4...v0.3.5) + +### UNCATEGORIZED PRS; LABEL THEM ON GITHUB + +- fail is a function, not a type [\#13](https://github.com/deric/puppet-zookeeper/pull/13) ([cristifalcas](https://github.com/cristifalcas)) + +## [v0.3.4](https://github.com/deric/puppet-zookeeper/tree/v0.3.4) (2015-01-29) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.3.3...v0.3.4) + +### UNCATEGORIZED PRS; LABEL THEM ON GITHUB + +- Java requirement [\#9](https://github.com/deric/puppet-zookeeper/pull/9) ([coreone](https://github.com/coreone)) + +## [v0.3.3](https://github.com/deric/puppet-zookeeper/tree/v0.3.3) (2015-01-16) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.3.2...v0.3.3) + +### UNCATEGORIZED PRS; LABEL THEM ON GITHUB + +- Add Cloudera repo installation [\#8](https://github.com/deric/puppet-zookeeper/pull/8) ([coreone](https://github.com/coreone)) +- Fix issues with future parser in puppet 3.7+ [\#7](https://github.com/deric/puppet-zookeeper/pull/7) ([tayzlor](https://github.com/tayzlor)) + +## [v0.3.2](https://github.com/deric/puppet-zookeeper/tree/v0.3.2) (2014-12-11) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.3.1...v0.3.2) + +### UNCATEGORIZED PRS; LABEL THEM ON GITHUB + +- Make servers default value an empty array [\#5](https://github.com/deric/puppet-zookeeper/pull/5) ([tayzlor](https://github.com/tayzlor)) + +## [v0.3.1](https://github.com/deric/puppet-zookeeper/tree/v0.3.1) (2014-12-04) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.3.0...v0.3.1) + +### UNCATEGORIZED PRS; LABEL THEM ON GITHUB + +- Provide options to override service name and initialize the datastore. [\#4](https://github.com/deric/puppet-zookeeper/pull/4) ([tomstockton](https://github.com/tomstockton)) + +## [v0.3.0](https://github.com/deric/puppet-zookeeper/tree/v0.3.0) (2014-11-29) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.2.4...v0.3.0) + +### UNCATEGORIZED PRS; LABEL THEM ON GITHUB + +- Fix cron package collision if its declared somewhere outside [\#3](https://github.com/deric/puppet-zookeeper/pull/3) ([claudio-walser](https://github.com/claudio-walser)) +- Add peerType parameter to support zookeeper observers [\#2](https://github.com/deric/puppet-zookeeper/pull/2) ([kscherer](https://github.com/kscherer)) + +## [v0.2.4](https://github.com/deric/puppet-zookeeper/tree/v0.2.4) (2014-03-15) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.2.3...v0.2.4) + +### UNCATEGORIZED PRS; LABEL THEM ON GITHUB + +- Max connections setting introduced [\#1](https://github.com/deric/puppet-zookeeper/pull/1) ([fiksn](https://github.com/fiksn)) + +## [v0.2.3](https://github.com/deric/puppet-zookeeper/tree/v0.2.3) (2014-01-29) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/v0.2.2...v0.2.3) + +## [v0.2.2](https://github.com/deric/puppet-zookeeper/tree/v0.2.2) (2014-01-29) + +[Full Changelog](https://github.com/deric/puppet-zookeeper/compare/d0a476e612b9ce80bcd333e13c31850c1afe1091...v0.2.2) + + + +\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)* diff --git a/Gemfile b/Gemfile index cdea6d7..819e80a 100644 --- a/Gemfile +++ b/Gemfile @@ -1,80 +1,81 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' def location_for(place_or_version, fake_version = nil) git_url_regex = %r{\A(?(https?|git)[:@][^#]*)(#(?.*))?} file_url_regex = %r{\Afile:\/\/(?.*)} if place_or_version && (git_url = place_or_version.match(git_url_regex)) [fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact elsif place_or_version && (file_url = place_or_version.match(file_url_regex)) ['>= 0', { path: File.expand_path(file_url[:path]), require: false }] else [place_or_version, { require: false }] end end ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments minor_version = ruby_version_segments[0..1].join('.') group :development do gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) gem "json", '= 2.3.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 2.8.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) gem "puppet-module-posix-default-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby] gem "puppet-module-posix-dev-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby] gem "puppet-module-win-default-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw] gem "puppet-module-win-dev-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw] + gem "github_changelog_generator", '~> 1.15', require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.3.0') gem "overcommit", require: false end group :system_tests do gem "puppet-module-posix-system-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby] gem "puppet-module-win-system-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw] end group :acceptance do gem "beaker", require: false gem "beaker-rspec", require: false gem "beaker-docker", require: false gem "beaker-puppet_install_helper", require: false gem "beaker-module_install_helper", require: false end puppet_version = ENV['PUPPET_GEM_VERSION'] facter_version = ENV['FACTER_GEM_VERSION'] hiera_version = ENV['HIERA_GEM_VERSION'] gems = {} gems['puppet'] = location_for(puppet_version) # If facter or hiera versions have been specified via the environment # variables gems['facter'] = location_for(facter_version) if facter_version gems['hiera'] = location_for(hiera_version) if hiera_version if Gem.win_platform? && puppet_version =~ %r{^(file:///|git://)} # If we're using a Puppet gem on Windows which handles its own win32-xxx gem # dependencies (>= 3.5.0), set the maximum versions (see PUP-6445). gems['win32-dir'] = ['<= 0.4.9', require: false] gems['win32-eventlog'] = ['<= 0.6.5', require: false] gems['win32-process'] = ['<= 0.7.5', require: false] gems['win32-security'] = ['<= 0.2.5', require: false] gems['win32-service'] = ['0.8.8', require: false] end gems.each do |gem_name, gem_params| gem gem_name, *gem_params end # Evaluate Gemfile.local and ~/.gemfile if they exist extra_gemfiles = [ "#{__FILE__}.local", File.join(Dir.home, '.gemfile'), ] extra_gemfiles.each do |gemfile| if File.file?(gemfile) && File.readable?(gemfile) eval(File.read(gemfile), binding) end end # vim: syntax=ruby diff --git a/manifests/config.pp b/manifests/config.pp index 383e262..1f5e46f 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -1,89 +1,89 @@ # Class: zookeeper::config # # This module manages the configuration directories # # PRIVATE CLASS - do not use directly (use main `zookeeper` class). class zookeeper::config inherits zookeeper { file { $zookeeper::cfg_dir: ensure => directory, owner => $zookeeper::user, group => $zookeeper::group, recurse => true, mode => '0644', } file { $zookeeper::log_dir: ensure => directory, owner => $zookeeper::user, group => $zookeeper::group, recurse => false, mode => '0644', } file { $zookeeper::datastore: ensure => directory, owner => $zookeeper::user, group => $zookeeper::group, mode => '0644', recurse => false, # intentionally, puppet run would take too long #41 } if $zookeeper::datalogstore { file { $zookeeper::datalogstore: ensure => directory, owner => $zookeeper::user, group => $zookeeper::group, mode => '0644', recurse => false, # intentionally, puppet run would take too long #41 } } if $zookeeper::service_provider != 'exhibitor' { file { "${zookeeper::cfg_dir}/zoo.cfg": owner => $zookeeper::user, group => $zookeeper::group, mode => '0644', content => template("${module_name}/conf/zoo.cfg.erb"), } # we should notify Class['::zookeeper::service'] however it's not configured # at this point (first run), so we have to subscribe from service declaration file { "${zookeeper::cfg_dir}/myid": ensure => file, content => template("${module_name}/conf/myid.erb"), owner => $zookeeper::user, group => $zookeeper::group, mode => '0644', require => File[$zookeeper::cfg_dir], } file { "${zookeeper::datastore}/myid": ensure => 'link', target => "${zookeeper::cfg_dir}/myid", } } file { "${zookeeper::cfg_dir}/${zookeeper::environment_file}": owner => $zookeeper::user, group => $zookeeper::group, mode => '0644', content => template("${module_name}/conf/environment.erb"), } file { "${zookeeper::cfg_dir}/log4j.properties": owner => $zookeeper::user, group => $zookeeper::group, mode => '0644', content => template("${module_name}/conf/log4j.properties.erb"), } # Initialize the datastore if required if $zookeeper::initialize_datastore { exec { 'initialize_datastore': - command => "/usr/bin/zookeeper-server-initialize --myid=${zookeeper::id}", + command => "${zookeeper::initialize_datastore_bin} --myid=${zookeeper::id}", user => $zookeeper::user, creates => "${zookeeper::datastore}/version-2", require => [File[$zookeeper::datastore], Class['zookeeper::install']], } } } diff --git a/manifests/init.pp b/manifests/init.pp index e2d3cdd..8ec22e0 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,167 +1,170 @@ # Class: zookeeper # # This module manages ZooKeeper installation # # # Parameters: # * [global_outstanding_limit] Clients can submit requests faster than ZooKeeper can process them, # especially if there are a lot of clients. To prevent ZooKeeper from running out of memory due to # queued requests, ZooKeeper will throttle clients so that there is no more than globalOutstandingLimit # outstanding requests in the system # # # * [whitelist_4lw] Fine grained control over the set of commands ZooKeeper can execute # # whitelist_4lw = ['stat','ruok'] # class zookeeper ( # meta options String $ensure = $zookeeper::params::ensure, Variant[Boolean,String] $ensure_account = $zookeeper::params::ensure_account, Boolean $ensure_cron = $zookeeper::params::ensure_cron, String $group = $zookeeper::params::group, Boolean $system_group = $zookeeper::params::system_group, Array[String] $packages = $zookeeper::params::packages, String $shell = $zookeeper::params::shell, String $user = $zookeeper::params::user, Boolean $system_user = $zookeeper::params::system_user, # installation options Hash $archive_checksum = $zookeeper::params::archive_checksum, Optional[String] $archive_dl_site = $zookeeper::params::archive_dl_site, Integer $archive_dl_timeout = $zookeeper::params::archive_dl_timeout, Optional[String] $archive_dl_url = $zookeeper::params::archive_dl_url, String $archive_install_dir = $zookeeper::params::archive_install_dir, Boolean $archive_symlink = $zookeeper::params::archive_symlink, String $archive_symlink_name = $zookeeper::params::archive_symlink_name, String $archive_version = $zookeeper::params::archive_version, Optional[String] $proxy_server = $zookeeper::params::proxy_server, Optional[String] $proxy_type = $zookeeper::params::proxy_type, Optional[String] $cdhver = $zookeeper::params::cdhver, Boolean $install_java = $zookeeper::params::install_java, String $install_method = $zookeeper::params::install_method, String $java_bin = $zookeeper::params::java_bin, String $java_opts = $zookeeper::params::java_opts, Optional[String] $java_package = $zookeeper::params::java_package, Optional[Variant[String,Hash]] $repo = $zookeeper::params::repo, # service options Boolean $manage_service = $zookeeper::params::manage_service, Boolean $manage_service_file = $zookeeper::params::manage_service_file, String $pid_dir = $zookeeper::params::pid_dir, Optional[String] $pid_file = $zookeeper::params::pid_file, Boolean $restart_on_change = $zookeeper::params::restart_on_change, String $service_ensure = $zookeeper::params::service_ensure, String $service_name = $zookeeper::params::service_name, Optional[String] $service_provider = $zookeeper::params::service_provider, Optional[String] $systemd_unit_want = $zookeeper::params::systemd_unit_want, String $systemd_unit_after = $zookeeper::params::systemd_unit_after, String $systemd_path = $zookeeper::params::systemd_path, String $zk_dir = $zookeeper::params::zk_dir, # zookeeper config String $cfg_dir = $zookeeper::params::cfg_dir, String $cleanup_sh = $zookeeper::params::cleanup_sh, Optional[String] $client_ip = $zookeeper::params::client_ip, Integer $client_port = $zookeeper::params::client_port, Optional[Integer] $secure_client_port = $zookeeper::params::secure_client_port, + Optional[Boolean] $port_unification = $zookeeper::params::port_unification, String $datastore = $zookeeper::params::datastore, Optional[String] $datalogstore = $zookeeper::params::datalogstore, Integer $election_port = $zookeeper::params::election_port, String $export_tag = $zookeeper::params::export_tag, String $id = $zookeeper::params::id, Integer $init_limit = $zookeeper::params::init_limit, Boolean $initialize_datastore = $zookeeper::params::initialize_datastore, + String $initialize_datastore_bin = $zookeeper::params::initialize_datastore_bin, Boolean $leader = $zookeeper::params::leader, Integer $leader_port = $zookeeper::params::leader_port, String $log_dir = $zookeeper::params::log_dir, Boolean $manual_clean = $zookeeper::params::manual_clean, Optional[Integer] $max_session_timeout = $zookeeper::params::max_session_timeout, Optional[Integer] $min_session_timeout = $zookeeper::params::min_session_timeout, Array[String] $observers = $zookeeper::params::observers, Integer $purge_interval = $zookeeper::params::purge_interval, Variant[Array[String],Hash[String,String]] $servers = $zookeeper::params::servers, Integer $pre_alloc_size = $zookeeper::params::pre_alloc_size, Integer $snap_count = $zookeeper::params::snap_count, Integer $snap_retain_count = $zookeeper::params::snap_retain_count, Integer $sync_limit = $zookeeper::params::sync_limit, Integer $tick_time = $zookeeper::params::tick_time, Integer $global_outstanding_limit = $zookeeper::params::global_outstanding_limit, Boolean $use_sasl_auth = $zookeeper::params::use_sasl_auth, String $zoo_dir = $zookeeper::params::zoo_dir, String $zoo_main = $zookeeper::params::zoo_main, + Boolean $quorum_listen_on_all_ips = $zookeeper::params::quorum_listen_on_all_ips, # log4j properties String $environment_file = $zookeeper::params::environment_file, String $log4j_prop = $zookeeper::params::log4j_prop, String $maxfilesize = $zookeeper::params::maxfilesize, Integer $maxbackupindex = $zookeeper::params::maxbackupindex, Optional[Integer] $max_allowed_connections = $zookeeper::params::max_allowed_connections, String $peer_type = $zookeeper::params::peer_type, String $rollingfile_threshold = $zookeeper::params::rollingfile_threshold, String $tracefile_threshold = $zookeeper::params::tracefile_threshold, String $console_threshold = $zookeeper::params::console_threshold, Hash[String,Hash[String,String]] $extra_appenders = $zookeeper::params::extra_appenders, # sasl options Hash[String, String] $sasl_users = $zookeeper::params::sasl_users, String $keytab_path = $zookeeper::params::keytab_path, String $principal = $zookeeper::params::principal, String $realm = $zookeeper::params::realm, Boolean $sasl_krb5 = $zookeeper::params::sasl_krb5, Boolean $store_key = $zookeeper::params::store_key, Boolean $use_keytab = $zookeeper::params::use_keytab, Boolean $use_ticket_cache = $zookeeper::params::use_ticket_cache, Boolean $remove_host_principal = $zookeeper::params::remove_host_principal, Boolean $remove_realm_principal = $zookeeper::params::remove_realm_principal, # four letter words whitelist Array[String] $whitelist_4lw = $zookeeper::params::whitelist_4lw, # Metrics Providers Optional[String] $metrics_provider_classname = $zookeeper::params::metrics_provider_classname, Integer $metrics_provider_http_port = $zookeeper::params::metrics_provider_http_port, Boolean $metrics_provider_export_jvm_info = $zookeeper::params::metrics_provider_export_jvm_info, ) inherits zookeeper::params { if $pid_file { $pid_path = $pid_file } else { $pid_path = "${pid_dir}/zookeeper.pid" } $repo_source = is_hash($repo) ? { true => 'custom', false => $repo } if $zookeeper::ensure_account { group { $group: ensure => $ensure_account, system => $system_group, } user { $user: ensure => $ensure_account, home => $datastore, comment => 'Zookeeper', gid => $group, shell => $shell, system => $system_user, require => Group[$group], } } include zookeeper::install include zookeeper::config anchor { 'zookeeper::start': } -> Class['zookeeper::install'] -> Class['zookeeper::config'] if ($use_sasl_auth) { include zookeeper::sasl Class['zookeeper::config'] -> Class['zookeeper::sasl'] -> Class['zookeeper::service'] } if ($manage_service) and ($service_provider != 'exhibitor') { include zookeeper::service Class['zookeeper::config'] -> Class['zookeeper::service'] -> Anchor['zookeeper::end'] } anchor { 'zookeeper::end': } } diff --git a/manifests/params.pp b/manifests/params.pp index e4b3b47..418f369 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,187 +1,193 @@ # OS specific configuration should be defined here # # PRIVATE CLASS - do not use directly (use main `zookeeper` class). class zookeeper::params { $_defaults = { 'packages' => ['zookeeper'], } $os_family = $facts['os']['family'] $os_name = $facts['os']['name'] $os_release = $facts['os']['release']['major'] case $os_family { 'Debian': { case $os_name { 'Debian', 'Ubuntu': { $initstyle = 'systemd' } default: { $initstyle = undef } } $_os_overrides = { - 'packages' => ['zookeeper', 'zookeeperd'], - 'service_name' => 'zookeeper', - 'service_provider' => $initstyle, - 'shell' => '/bin/false', + 'packages' => ['zookeeper', 'zookeeperd'], + 'service_name' => 'zookeeper', + 'service_provider' => $initstyle, + 'shell' => '/bin/false', + 'initialize_datastore_bin' => '/usr/bin/zookeeper-server-initialize' } # 'environment' file probably read just by Debian # see #16, #81 $environment_file = 'environment' } 'RedHat': { case $os_name { 'RedHat', 'CentOS': { if versioncmp($os_release, '7') < 0 { $initstyle = 'redhat' } else { $initstyle = 'systemd' } } default: { $initstyle = undef } } $_os_overrides = { - 'packages' => ['zookeeper', 'zookeeper-server'], - 'service_name' => 'zookeeper-server', - 'service_provider' => $initstyle, - 'shell' => '/sbin/nologin', + 'packages' => ['zookeeper', 'zookeeper-server'], + 'service_name' => 'zookeeper-server', + 'service_provider' => $initstyle, + 'shell' => '/sbin/nologin', + 'initialize_datastore_bin' => '/usr/bin/zookeeper-server-initialize' } $environment_file = 'java.env' } 'Suse': { case $os_name { 'SLES': { $initstyle = 'systemd' } default: { $initstyle = undef } } $_os_overrides = { - 'packages' => ['zookeeper', 'zookeeper-server'], - 'service_name' => 'zookeeper-server', - 'service_provider' => $initstyle, - 'shell' => '/bin/false', + 'packages' => ['zookeeper', 'zookeeper-server'], + 'service_name' => 'zookeeper-server', + 'service_provider' => $initstyle, + 'shell' => '/bin/false', + 'initialize_datastore_bin' => '/usr/bin/zookeeper-server-initialize' } $environment_file = 'java.env' } default: { fail("Module '${module_name}' is not supported on OS: '${os_name}', family: '${os_family}'") } } $_params = merge($_defaults, $_os_overrides) # meta options $ensure = present $ensure_account = present $ensure_cron = true $group = 'zookeeper' $system_group = false $packages = $_params['packages'] $shell = $_params['shell'] $user = 'zookeeper' $system_user = false # installation options $archive_checksum = {} $archive_dl_site = undef $archive_dl_timeout = 600 $archive_dl_url = undef $archive_install_dir = '/opt' $archive_symlink = true $archive_symlink_name = "${archive_install_dir}/zookeeper" $archive_version = '3.4.8' $cdhver = '5' $install_java = false $install_method = 'package' $java_bin = '/usr/bin/java' $java_opts = '' $java_package = undef $repo = undef $proxy_server = undef $proxy_type = undef # service options $manage_service = true $manage_service_file = false $pid_dir = '/var/run' $pid_file = undef $restart_on_change = true $service_ensure = 'running' $service_name = $_params['service_name'] $service_provider = $_params['service_provider'] # systemd_unit_want and _after can be overridden to # donate the matching directives in the [Unit] section $systemd_unit_want = undef $systemd_unit_after = 'network.target' $systemd_path = '/etc/systemd/system' $zk_dir = '/etc/zookeeper' # zookeeper config $cfg_dir = '/etc/zookeeper/conf' $cleanup_sh = '/usr/share/zookeeper/bin/zkCleanup.sh' $client_ip = undef # use e.g. $::ipaddress if you want to bind to single interface $client_port = 2181 $secure_client_port = undef + $quorum_listen_on_all_ips = false + $port_unification = undef $datastore = '/var/lib/zookeeper' # datalogstore used to put transaction logs in separate location than snapshots $datalogstore = undef $election_port = 2888 $export_tag = 'zookeeper' $id = '1' $init_limit = 10 $initialize_datastore = false + $initialize_datastore_bin = $_params['initialize_datastore_bin'] $leader = true $leader_port = 3888 $log_dir = '/var/log/zookeeper' $manual_clean = false $max_allowed_connections = undef $max_session_timeout = undef $min_session_timeout = undef $observers = [] # interval in hours, purging enabled when >= 1 $purge_interval = 0 $servers = [] $pre_alloc_size = 65536 $snap_count = 10000 # since zookeeper 3.4, for earlier version cron task might be used $snap_retain_count = 3 $sync_limit = 5 $tick_time = 2000 $global_outstanding_limit = 1000 $use_sasl_auth = false $zoo_dir = '/usr/lib/zookeeper' $zoo_main = 'org.apache.zookeeper.server.quorum.QuorumPeerMain' # log4j properties $log4j_prop = 'INFO,ROLLINGFILE' $peer_type = 'UNSET' $rollingfile_threshold = 'INFO' $console_threshold = 'INFO' $tracefile_threshold = 'TRACE' $maxfilesize = '256MB' $maxbackupindex = 20 $extra_appenders = {} # sasl options $sasl_krb5 = true $sasl_users = {} $keytab_path = '/etc/zookeeper/conf/zookeeper.keytab' $principal = "zookeeper/${facts['networking']['fqdn']}" $realm = pick($trusted['domain'], $trusted['certname']) $store_key = true $use_keytab = true $use_ticket_cache = false $remove_host_principal = false $remove_realm_principal = false # whitelist of Four Letter Words commands, see https://zookeeper.apache.org/doc/r3.4.12/zookeeperAdmin.html#sc_zkCommands $whitelist_4lw = [] # Metrics Providers $metrics_provider_classname = undef $metrics_provider_http_port = 7000 $metrics_provider_export_jvm_info = true } diff --git a/metadata.json b/metadata.json index cb4e60d..55b6083 100644 --- a/metadata.json +++ b/metadata.json @@ -1,75 +1,76 @@ { "name": "deric-zookeeper", "version": "1.1.0", "author": "deric", "summary": "Module for managing Apache Zookeeper", "license": "Apache-2.0", "source": "https://github.com/deric/puppet-zookeeper", "project_page": "https://github.com/deric/puppet-zookeeper", "issues_url": "https://github.com/deric/puppet-zookeeper/issues", "dependencies": [ { "name": "puppet/archive", "version_requirement": ">= 0.4.4 < 5.0.0" }, { "name": "puppet/cron", "version_requirement": ">= 1.3.1 < 3.0.0" }, { "name": "puppetlabs/stdlib", "version_requirement": ">= 2.3.3 < 7.0.0" }, { "name": "puppetlabs/yumrepo_core", "version_requirement": ">= 1.0.3 < 2.0.0" } ], "operatingsystem_support": [ { "operatingsystem": "RedHat", "operatingsystemrelease": [ "6", "7" ] }, { "operatingsystem": "CentOS", "operatingsystemrelease": [ "6", - "7" + "7", + "8" ] }, { "operatingsystem": "Debian", "operatingsystemrelease": [ "8", "9", "10" ] }, { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ "16.04", "18.04" ] }, { "operatingsystem": "SLES", "operatingsystemrelease": [ "12" ] } ], "requirements": [ { "name": "puppet", "version_requirement": ">= 5.5.8 < 7.0.0" } ], "description": "ZooKeeper is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services.", "pdk-version": "2.0.0", "template-url": "https://github.com/puppetlabs/pdk-templates#2.0.0", "template-ref": "tags/2.0.0-0-ge838f1d" } diff --git a/spec/classes/config_spec.rb b/spec/classes/config_spec.rb index 66cc656..15f1718 100644 --- a/spec/classes/config_spec.rb +++ b/spec/classes/config_spec.rb @@ -1,635 +1,660 @@ require 'spec_helper' shared_examples 'zookeeper parameters' do |_os_facts, precond| # load class, handle custom params let :pre_condition do precond end it do is_expected.to contain_file(cfg_dir).with('ensure' => 'directory', 'owner' => user, 'group' => group) end it do is_expected.to contain_file(log_dir).with('ensure' => 'directory', 'owner' => user, 'group' => group) end it do is_expected.to contain_file(id_file).with('ensure' => 'file', 'owner' => user, 'group' => group).with_content(myid) end end shared_examples 'zookeeper common' do |os_facts| os_info = get_os_info(os_facts) environment_file = os_info[:environment_file] context 'extra parameters' do # set custom params let :pre_condition do 'class {"zookeeper": log4j_prop => "ERROR", snap_count => 15000, pre_alloc_size => 131072, }' end it do is_expected.to contain_file(environment_file).with_content(%r{ERROR}) is_expected.to contain_file(environment_file).with_content(%r{ZOOCFG}) # CLASSPATH won't be overriden for all install methods # is_expected.to contain_file(environment_file).with_content(%r{CLASSPATH}) end it do is_expected.to contain_file('/etc/zookeeper/conf/zoo.cfg').with_content(%r{snapCount=15000}) end it do is_expected.to contain_file('/etc/zookeeper/conf/zoo.cfg').with_content(%r{preAllocSize=131072}) end # leave the default value to be determined by ZooKeeper it 'does not set maxClientCnxns by default' do # due to problem with should_not not matching, we're using more complicated way is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{^#maxClientCnxns=}) end # by default do not set client IP address it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{^#clientPortAddress=}) end end context 'extra environment_file parameter' do # set custom params let :pre_condition do 'class {"zookeeper": log4j_prop => "ERROR", environment_file => "java.env", }' end it do is_expected.to contain_file('/etc/zookeeper/conf/java.env').with_content(%r{ERROR}) is_expected.not_to contain_file('/etc/zookeeper/environment') end end context 'max allowed connections' do let :pre_condition do 'class {"zookeeper": max_allowed_connections => 15, }' end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{maxClientCnxns=15}) end end context 'set client ip address' do let :pre_condition do 'class {"zookeeper": client_ip => "192.168.1.1", }' end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{clientPortAddress=192.168.1.1}) end end context 'setting tick time' do let :pre_condition do 'class {"zookeeper": tick_time => 3000, }' end it do is_expected.to contain_file('/etc/zookeeper/conf/zoo.cfg').with_content(%r{tickTime=3000}) end end context 'setting init and sync limit' do let :pre_condition do 'class {"zookeeper": init_limit => 15, sync_limit => 10, }' end it do is_expected.to contain_file('/etc/zookeeper/conf/zoo.cfg').with_content(%r{initLimit=15}) end it do is_expected.to contain_file('/etc/zookeeper/conf/zoo.cfg').with_content(%r{syncLimit=10}) end end context 'setting leader' do let :pre_condition do 'class {"zookeeper": leader => false, }' end it do is_expected.to contain_file('/etc/zookeeper/conf/zoo.cfg').with_content(%r{leaderServes=no}) end end context 'myid link' do let :pre_condition do 'class {"zookeeper":}' end it do is_expected.to contain_file( '/var/lib/zookeeper/myid', ).with('ensure' => 'link', 'target' => '/etc/zookeeper/conf/myid') end end context 'without datalogstore parameter' do let :pre_condition do 'class {"zookeeper":}' end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{# dataLogDir=/disk2/zookeeper}) end end context 'with datalogstore parameter' do let :pre_condition do 'class {"zookeeper": datalogstore => "/zookeeper/transaction/device", }' end let(:datalogstore) { '/zookeeper/transaction/device' } it do is_expected.to contain_file(datalogstore).with('ensure' => 'directory') end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{dataLogDir=/zookeeper/transaction/device}) end end context 'setting quorum of servers with custom ports' do let :pre_condition do 'class {"zookeeper": election_port => 3000, leader_port => 4000, servers => ["192.168.1.1", "192.168.1.2"], }' end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{server.1=192.168.1.1:3000:4000}) end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{server.2=192.168.1.2:3000:4000}) end end context 'setting quorum of servers with custom ports with servers as hash' do let :pre_condition do 'class {"zookeeper": election_port => 3000, leader_port => 4000, servers => {"12" => "192.168.1.1", "23" => "192.168.1.2"}, }' end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{server.12=192.168.1.1:3000:4000}) end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{server.23=192.168.1.2:3000:4000}) end end context 'setting quorum of servers with default ports' do let :pre_condition do 'class {"zookeeper": servers => ["192.168.1.1", "192.168.1.2"] }' end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{server.1=192.168.1.1:2888:3888}) end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{server.2=192.168.1.2:2888:3888}) end end context 'setting quorum of servers with default ports with servers as hash' do let :pre_condition do 'class {"zookeeper": servers => {"12" => "192.168.1.1", "23" => "192.168.1.2"}, }' end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{server.12=192.168.1.1:2888:3888}) end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{server.23=192.168.1.2:2888:3888}) end end context 'setting quorum of servers with default ports with observer' do let :pre_condition do 'class {"zookeeper": servers => ["192.168.1.1", "192.168.1.2", "192.168.1.3", "192.168.1.4", "192.168.1.5"], observers => ["192.168.1.4", "192.168.1.5"] }' end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{server.1=192.168.1.1:2888:3888}) end it do is_expected.not_to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{server.1=192.168.1.1:2888:3888:observer}) end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{server.2=192.168.1.2:2888:3888}) end it do is_expected.not_to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{server.2=192.168.1.2:2888:3888:observer}) end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{server.3=192.168.1.3:2888:3888}) end it do is_expected.not_to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{server.3=192.168.1.3:2888:3888:observer}) end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{server.4=192.168.1.4:2888:3888:observer}) end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{server.5=192.168.1.5:2888:3888:observer}) end end context 'setting quorum of servers with default ports with observer with servers as hash' do let :pre_condition do 'class {"zookeeper": servers => {"12" => "192.168.1.1", "23" => "192.168.1.2", "34" => "192.168.1.3", "45" => "192.168.1.4", "56" => "192.168.1.5"}, observers => ["192.168.1.4", "192.168.1.5"] }' end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{server.12=192.168.1.1:2888:3888}) end it do is_expected.not_to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{server.12=192.168.1.1:2888:3888:observer}) end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{server.23=192.168.1.2:2888:3888}) end it do is_expected.not_to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{server.23=192.168.1.2:2888:3888:observer}) end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{server.34=192.168.1.3:2888:3888}) end it do is_expected.not_to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{server.34=192.168.1.3:2888:3888:observer}) end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{server.45=192.168.1.4:2888:3888:observer}) end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{server.56=192.168.1.5:2888:3888:observer}) end end context 'setting minSessionTimeout' do let :pre_condition do 'class {"zookeeper": min_session_timeout => 5000 }' end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{minSessionTimeout=5000}) end end context 'setting maxSessionTimeout' do let :pre_condition do 'class {"zookeeper": max_session_timeout => 50000 }' end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{maxSessionTimeout=50000}) end end context 'make sure port is not included in server IP/hostname' do let :pre_condition do 'class {"zookeeper": servers => ["192.168.1.1:2888", "192.168.1.2:2333"] }' end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{server.1=192.168.1.1:2888:3888}) end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{server.2=192.168.1.2:2888:3888}) end end context 'configure logging' do context 'by default set to INFO' do let :pre_condition do 'class {"zookeeper": }' end it do is_expected.to contain_file( '/etc/zookeeper/conf/log4j.properties', ).with_content(%r{zookeeper.log.threshold=INFO}) end it do is_expected.to contain_file( '/etc/zookeeper/conf/log4j.properties', ).with_content(%r{zookeeper.console.threshold=INFO}) end end context 'allow changing rollingfile loglevel' do let :pre_condition do 'class {"zookeeper": rollingfile_threshold => "TRACE", }' end it do is_expected.to contain_file( '/etc/zookeeper/conf/log4j.properties', ).with_content(%r{zookeeper.log.threshold=TRACE}) end end context 'allow changing console loglevel' do let :pre_condition do 'class {"zookeeper": console_threshold => "TRACE", }' end it do is_expected.to contain_file( '/etc/zookeeper/conf/log4j.properties', ).with_content(%r{zookeeper.console.threshold=TRACE}) end end context 'allow changing tracefile loglevel' do let :pre_condition do 'class {"zookeeper": tracefile_threshold => "DEBUG", }' end it do is_expected.to contain_file( '/etc/zookeeper/conf/log4j.properties', ).with_content(%r{log4j.appender.TRACEFILE.Threshold=DEBUG}) end end context 'setting 4lw whitelist' do let :pre_condition do 'class {"zookeeper": whitelist_4lw => ["ruok","stat"] }' end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{4lw.commands.whitelist=ruok,stat}) end end context 'setting metrics provider' do let :pre_condition do 'class {"zookeeper": metrics_provider_classname => "org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider", metrics_provider_http_port => 7007, }' end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{^metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider}) end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{^metricsProvider.httpPort=7007}) end end context 'set global outstanding limit' do let :pre_condition do 'class {"zookeeper": global_outstanding_limit => 2000 }' end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{globalOutstandingLimit=2000}) end end + + context 'set portUnification' do + let :pre_condition do + 'class {"zookeeper": + port_unification => true + }' + end + + it do + is_expected.to contain_file( + '/etc/zookeeper/conf/zoo.cfg', + ).with_content(%r{portUnification=true}) + end + end + context 'default does not set portUnification' do + let :pre_condition do + 'class {"zookeeper":}' + end + + it do + is_expected.not_to contain_file( + '/etc/zookeeper/conf/zoo.cfg', + ).with_content(%r{portUnification}) + end + end end context 'setting metrics provider' do let :pre_condition do 'class {"zookeeper": metrics_provider_classname => "org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider", metrics_provider_http_port => 7007, metrics_provider_export_jvm_info => false, }' end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider}) end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{metricsProvider.httpPort=7007}) end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{metricsProvider.exportJvmInfo=false}) end end end describe 'zookeeper::config' do on_supported_os.each do |os, os_facts| os_facts[:os]['hardware'] = 'x86_64' context "on #{os}" do let(:facts) do os_facts.merge(ipaddress: '192.168.1.1') end context 'with default parameters' do let(:user) { 'zookeeper' } let(:group) { 'zookeeper' } let(:cfg_dir) { '/etc/zookeeper/conf' } let(:log_dir) { '/var/lib/zookeeper' } let(:id_file) { '/etc/zookeeper/conf/myid' } let(:myid) { %r{^1} } precond = 'class {"zookeeper": }' include_examples 'zookeeper parameters', os_facts, precond end context 'with custom parameters' do let(:user) { 'zoo' } let(:group) { 'zoo' } let(:cfg_dir) { '/var/lib/zookeeper/conf' } let(:log_dir) { '/var/lib/zookeeper/log' } let(:id_file) { '/var/lib/zookeeper/conf/myid' } let(:myid) { %r{^2} } # set custom params precond = 'class {"zookeeper": id => "2", user => "zoo", group => "zoo", cfg_dir => "/var/lib/zookeeper/conf", log_dir => "/var/lib/zookeeper/log", }' include_examples 'zookeeper parameters', os_facts, precond end include_examples 'zookeeper common', os_facts end end end diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 04c2ef8..04fa081 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -1,280 +1,283 @@ require 'spec_helper' shared_examples 'zookeeper' do |os_facts| let(:user) { 'zookeeper' } let(:group) { 'zookeeper' } os_info = get_os_info(os_facts) service_name = os_info[:service_name] environment_file = os_info[:environment_file] init_provider = os_info[:init_provider] should_install_zookeeperd = os_info[:should_install_zookeeperd] it { is_expected.to contain_class('zookeeper::config') } it { is_expected.to contain_class('zookeeper::install') } it { is_expected.to contain_class('zookeeper::service') } it { is_expected.to compile.with_all_deps } it { is_expected.to contain_service(service_name) } it { is_expected.to contain_service(service_name).that_subscribes_to('File[/etc/zookeeper/conf/myid]') } it { is_expected.to contain_service(service_name).that_subscribes_to('File[/etc/zookeeper/conf/zoo.cfg]') } it { is_expected.to contain_service(service_name).that_subscribes_to("File[#{environment_file}]") } it { is_expected.to contain_service(service_name).that_subscribes_to('File[/etc/zookeeper/conf/log4j.properties]') } context 'skip service restart' do let(:params) do { restart_on_change: false, } end it { is_expected.to contain_service(service_name) } it { is_expected.not_to contain_service(service_name).that_subscribes_to('File[/etc/zookeeper/conf/myid]') } it { is_expected.not_to contain_service(service_name).that_subscribes_to('File[/etc/zookeeper/conf/zoo.cfg]') } it { is_expected.not_to contain_service(service_name).that_subscribes_to("File[#{environment_file}]") } it { is_expected.not_to contain_service(service_name).that_subscribes_to('File[/etc/zookeeper/conf/log4j.properties]') } end context 'allow installing multiple packages' do let(:params) do { packages: ['zookeeper', 'zookeeper-bin'], } end it { is_expected.to compile.with_all_deps } it { is_expected.to contain_package('zookeeper').with(ensure: 'present') } it { is_expected.to contain_package('zookeeper-bin').with(ensure: 'present') } it { is_expected.to contain_service(service_name).with(ensure: 'running') } # datastore exec is not included by default it { is_expected.not_to contain_exec('initialize_datastore') } it { is_expected.to contain_user('zookeeper').with(ensure: 'present') } it { is_expected.to contain_group('zookeeper').with(ensure: 'present') } end context 'Cloudera packaging' do let(:params) do { packages: ['zookeeper', 'zookeeper-server'], service_name: 'zookeeper-server', initialize_datastore: true, } end it { is_expected.to contain_package('zookeeper').with(ensure: 'present') } it { is_expected.to contain_package('zookeeper-server').with(ensure: 'present') } it { is_expected.to contain_service('zookeeper-server').with(ensure: 'running') } it { is_expected.to contain_exec('initialize_datastore') } end context 'setting minSessionTimeout' do let(:params) do { min_session_timeout: 3000, } end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{minSessionTimeout=3000}) end end context 'setting maxSessionTimeout' do let(:params) do { max_session_timeout: 60_000, } end it do is_expected.to contain_file( '/etc/zookeeper/conf/zoo.cfg', ).with_content(%r{maxSessionTimeout=60000}) end end context 'disable service management' do let(:params) do { manage_service: false, } end it { is_expected.to contain_package('zookeeper').with(ensure: 'present') } it { is_expected.not_to contain_service(service_name).with(ensure: 'running') } it { is_expected.not_to contain_class('zookeeper::service') } end if %r{RedHat|Suse}.match?(os_facts[:os]['family']) context 'Do not use cloudera by default' do it { is_expected.to compile.with_all_deps } it { is_expected.to contain_class('zookeeper::install::repo') } it { is_expected.not_to contain_yumrepo('cloudera-cdh5') } end - context 'use Cloudera RPM repo' do - let(:params) do - { - repo: 'cloudera', - cdhver: '5', - } - end - - it { is_expected.to compile.with_all_deps } - it { is_expected.to contain_class('zookeeper::install::repo') } - it { is_expected.to contain_yumrepo('cloudera-cdh5') } - - context 'custom RPM repo' do + if os_facts[:os]['release']['major'].to_i < 7 + context 'use Cloudera RPM repo' do let(:params) do { - repo: { - 'name' => 'myrepo', - 'url' => 'http://repo.url', - 'descr' => 'custom repo', - }, + repo: 'cloudera', cdhver: '5', } end - it { is_expected.to contain_yumrepo('myrepo').with(baseurl: 'http://repo.url') } + it { is_expected.to compile.with_all_deps } + it { is_expected.to contain_class('zookeeper::install::repo') } + + it { is_expected.to contain_yumrepo('cloudera-cdh5') } + + context 'custom RPM repo' do + let(:params) do + { + repo: { + 'name' => 'myrepo', + 'url' => 'http://repo.url', + 'descr' => 'custom repo', + }, + cdhver: '5', + } + end + + it { is_expected.to contain_yumrepo('myrepo').with(baseurl: 'http://repo.url') } + end end end end context 'service provider' do context 'autodetect provider' do it { is_expected.to contain_package('zookeeper').with(ensure: 'present') } if %r{RedHat|Suse}.match?(os_facts[:os]['family']) it { is_expected.to contain_package('zookeeper-server').with(ensure: 'present') } else it { is_expected.not_to contain_package('zookeeper-server').with(ensure: 'present') } end it do is_expected.to contain_service(service_name).with(ensure: 'running', provider: init_provider) end end it { is_expected.to contain_class('zookeeper::service') } end context 'allow passing specific version' do let(:version) { '3.4.5+dfsg-1' } let(:params) do { ensure: version, } end it { is_expected.to contain_package('zookeeper').with(ensure: version) } if should_install_zookeeperd it { is_expected.to contain_package('zookeeperd').with(ensure: version) } else it { is_expected.not_to contain_package('zookeeperd').with(ensure: version) } end it { is_expected.to contain_user('zookeeper').with(ensure: 'present') } end context 'set pid file for init provider' do let(:params) do { zoo_dir: '/usr/lib/zookeeper', log_dir: '/var/log/zookeeper', manage_service: true, manage_service_file: true, service_provider: 'init', } end it do is_expected.to contain_file( '/etc/zookeeper/conf/log4j.properties', ).with_content(%r{zookeeper.log.dir=/var/log/zookeeper}) end context 'set service provider' do it { is_expected.to contain_package('zookeeper').with(ensure: 'present') } it do is_expected.to contain_service(service_name).with(ensure: 'running', provider: 'init') end end if %r{RedHat|Suse}.match?(os_facts[:os]['family']) it do is_expected.to contain_file( "/etc/init.d/#{service_name}", ).with_content(%r{pidfile=/var/run/zookeeper.pid}) end else it do is_expected.to contain_file( environment_file, ).with_content(%r{PIDFILE=/var/run/zookeeper.pid}) end end end context 'create env file' do it do is_expected.to contain_file( environment_file, ) end end context 'managed by exhibitor' do let(:params) do { service_provider: 'exhibitor', service_name: 'zookeeper', cfg_dir: '/opt/zookeeper/conf', } end it { is_expected.not_to contain_class('zookeeper::service') } it { is_expected.not_to contain_service(service_name) } it { is_expected.not_to contain_file('/opt/zookeeper/conf/zoo.cfg') } it { is_expected.not_to contain_file('/opt/zookeeper/conf/myid') } end context 'install from archive' do let(:params) do { install_method: 'archive', archive_version: '3.4.9', } end it { is_expected.to compile.with_all_deps } it { is_expected.to contain_class('Zookeeper::Install::Archive') } it { is_expected.not_to contain_package('zookeeper').with(ensure: 'present') } it { is_expected.to contain_service(service_name).with(ensure: 'running') } it { is_expected.to contain_user('zookeeper').with(ensure: 'present') } it { is_expected.to contain_group('zookeeper').with(ensure: 'present') } end end describe 'zookeeper', type: :class do on_supported_os.each do |os, os_facts| os_facts[:os]['hardware'] = 'x86_64' context "on #{os}" do let(:facts) do os_facts.merge(ipaddress: '192.168.1.1') end include_examples 'zookeeper', os_facts end end end diff --git a/spec/classes/repo_spec.rb b/spec/classes/repo_spec.rb index 9e569f5..ac21c94 100644 --- a/spec/classes/repo_spec.rb +++ b/spec/classes/repo_spec.rb @@ -1,158 +1,160 @@ require 'spec_helper' shared_examples 'zookeeper repo release support' do |os_facts| os_name = if os_facts[:os]['family'] == 'RedHat' os_facts[:os]['family'].downcase else os_facts[:os]['name'].downcase end os_release = os_facts[:os]['release']['major'] context 'fail when release not supported' do let :pre_condition do 'class {"zookeeper": repo => "cloudera", cdhver => "5", }' end it do expect { is_expected.to compile }.to raise_error(%r{is not supported for #{os_name} version #{os_release}}) end end end shared_examples 'zookeeper repo arch support' do |os_facts| os_hardware = os_facts[:os]['hardware'] context 'fail when architecture not supported' do let :pre_condition do 'class {"zookeeper": repo => "cloudera", cdhver => "5", }' end it do expect { is_expected.to compile }.to raise_error(%r{is not supported for architecture #{os_hardware}}) end end end shared_examples 'zookeeper repo' do |os_facts| let(:user) { 'zookeeper' } let(:group) { 'zookeeper' } os_name = if os_facts[:os]['family'] == 'RedHat' os_facts[:os]['family'].downcase else os_facts[:os]['name'].downcase end os_release = os_facts[:os]['release']['major'] os_hardware = os_facts[:os]['hardware'] if %r{RedHat|Suse}.match?(os_facts[:os]['family']) context 'Cloudera repo' do let :pre_condition do 'class {"zookeeper": repo => "cloudera", cdhver => "5", }' end - it { - is_expected.to contain_yumrepo('cloudera-cdh5').with(baseurl: "http://archive.cloudera.com/cdh5/#{os_name}/#{os_release}/#{os_hardware}/cdh/5/") - } + if (os_facts[:os]['family'] == 'RedHat') && (os_release.to_i < 8) + it do + is_expected.to contain_yumrepo('cloudera-cdh5').with(baseurl: "http://archive.cloudera.com/cdh5/#{os_name}/#{os_release}/#{os_hardware}/cdh/5/") + end + end end end context 'fail when CDH version not supported' do let :pre_condition do 'class {"zookeeper": repo => "cloudera", cdhver => "6", }' end it do expect { is_expected.to compile }.to raise_error(%r{is not a supported cloudera repo.}) end end context 'fail when repository source not supported' do let :pre_condition do 'class {"zookeeper": repo => "another-repo", }' end it do expect { is_expected.to compile }.to raise_error(%r{provides no repository information for yum repository}) end end end describe 'zookeeper::install::repo' do on_supported_os.each do |os, os_facts| os_facts[:os]['hardware'] = 'x86_64' context "on #{os}" do let(:facts) do os_facts.merge(ipaddress: '192.168.1.1') end include_examples 'zookeeper repo', os_facts end end context 'test unsupported repo arch' do test_on = { hardwaremodels: ['arc'], supported_os: [ { 'operatingsystem' => 'RedHat', 'operatingsystemrelease' => ['7'], }, ], } on_supported_os(test_on).each do |os, os_facts| context "on #{os}" do let(:facts) do os_facts.merge(ipaddress: '192.168.1.1') end include_examples 'zookeeper repo arch support', os_facts end end end context 'test unsupported repo release' do test_on = { supported_os: [ { 'operatingsystem' => 'RedHat', 'operatingsystemrelease' => ['8'], }, ], } on_supported_os(test_on).each do |os, os_facts| os_facts[:os]['hardware'] = 'x86_64' context "on #{os}" do let(:facts) do os_facts.merge(ipaddress: '192.168.1.1') end include_examples 'zookeeper repo release support', os_facts end end end end diff --git a/templates/conf/environment.erb b/templates/conf/environment.erb index 6a3a7ef..da37066 100644 --- a/templates/conf/environment.erb +++ b/templates/conf/environment.erb @@ -1,29 +1,32 @@ NAME=zookeeper ZOOCFGDIR=<%= scope.lookupvar("zookeeper::cfg_dir") %> -<% if scope.lookupvar('zookeeper::install_method') != 'archive' and scope.lookupvar('zookeeper::service_provider') != 'systemd' -%> +<% if scope.lookupvar('zookeeper::install_method') != 'archive' and + (scope.lookupvar('zookeeper::service_provider') != 'systemd' or + (scope.lookupvar('zookeeper::service_provider') == 'systemd' and !scope.lookupvar('zookeeper::manage_service_file')) + )-%> # TODO this is really ugly # How to find out, which jars are needed? # seems, that log4j requires the log4j.properties file to be in the classpath CLASSPATH="<%= scope.lookupvar("zookeeper::cfg_dir") %>:/usr/share/java/jline.jar:/usr/share/java/log4j-1.2.jar:/usr/share/java/xercesImpl.jar:/usr/share/java/xmlParserAPIs.jar:/usr/share/java/netty.jar:/usr/share/java/slf4j-api.jar:/usr/share/java/slf4j-log4j12.jar:/usr/share/java/zookeeper.jar" <% end -%> ZOOCFG="<%= scope.lookupvar("zookeeper::cfg_dir") %>/zoo.cfg" ZOO_LOG_DIR=<%= scope.lookupvar("zookeeper::log_dir") %> USER=<%= scope.lookupvar("zookeeper::user") %> GROUP=<%= scope.lookupvar("zookeeper::group") %> PIDDIR=<%= scope.lookupvar("zookeeper::pid_dir") %> PIDFILE=<%= scope.lookupvar("zookeeper::pid_path") %> SCRIPTNAME=/etc/init.d/$NAME JAVA=<%= scope.lookupvar("zookeeper::java_bin") %> ZOOMAIN="<%= scope.lookupvar("zookeeper::zoo_main") %>" ZOO_LOG4J_PROP="<%= scope.lookupvar("zookeeper::log4j_prop") %>" JMXLOCALONLY=false <% if scope.lookupvar('zookeeper::use_sasl_auth') -%> JAVA_OPTS="<%= scope.lookupvar("zookeeper::java_opts") %> -Djava.security.auth.login.config=<%= File.join(scope.lookupvar("zookeeper::cfg_dir"), "jaas.conf") -%>" <% else -%> JAVA_OPTS="<%= scope.lookupvar("zookeeper::java_opts") %>" <% end -%> # will be concatenated with JVMFLAGS var # see https://github.com/apache/zookeeper/blob/master/bin/zkServer.sh#L78 SERVER_JVMFLAGS=$JAVA_OPTS diff --git a/templates/conf/zoo.cfg.erb b/templates/conf/zoo.cfg.erb index a045f7f..19fa3cc 100644 --- a/templates/conf/zoo.cfg.erb +++ b/templates/conf/zoo.cfg.erb @@ -1,158 +1,165 @@ # http://hadoop.apache.org/zookeeper/docs/current/zookeeperAdmin.html # The number of milliseconds of each tick tickTime=<%= scope.lookupvar("zookeeper::tick_time") %> # The number of ticks that the initial # synchronization phase can take initLimit=<%= scope.lookupvar("zookeeper::init_limit") %> # The number of ticks that can pass between # sending a request and getting an acknowledgement syncLimit=<%= scope.lookupvar("zookeeper::sync_limit") %> # ZooKeeper will throttle clients so that there is no more than globalOutstandingLimit outstanding requests in the system. globalOutstandingLimit=<%= scope.lookupvar('zookeeper::global_outstanding_limit') %> # the directory where the snapshot is stored. dataDir=<%= scope.lookupvar("zookeeper::datastore") %> # Place the dataLogDir to a separate physical disc for better performance <% if ! [nil, :undefined, :undef].include?(scope.lookupvar("zookeeper::datalogstore")) -%> dataLogDir=<%= scope.lookupvar("zookeeper::datalogstore") %> <% else -%> # dataLogDir=/disk2/zookeeper <% end -%> # the port at which the clients will connect clientPort=<%= scope.lookupvar("zookeeper::client_port") %> # interface to bind <% if ! [nil, :undefined, :undef].include?(scope.lookupvar("zookeeper::client_ip")) -%> clientPortAddress=<%= scope.lookupvar("zookeeper::client_ip") %> <% else -%> #clientPortAddress= <% end -%> # Supported since 3.5.1 <% if ! [nil, :undefined, :undef].include?(scope.lookupvar("zookeeper::secure_client_port")) -%> secureClientPort=<%= scope.lookupvar("zookeeper::secure_client_port") %> <% else -%> #secureClientPort=2281 <% end -%> +# Supported since 3.5.5 +<% if ! [nil, :undefined, :undef].include?(scope.lookupvar("zookeeper::port_unification")) -%> +portUnification=<%= scope.lookupvar("zookeeper::port_unification") %> +<% end -%> # specify all zookeeper servers # The first port is used by followers to connect to the leader # The second one is used for leader election #server.1=zookeeper1:2888:3888 #server.2=zookeeper2:2888:3888 #server.3=zookeeper3:2888:3888 <%- if scope.lookupvar("zookeeper::servers").is_a?(Hash) -%> <%- _servers = scope.lookupvar("zookeeper::servers") -%> <% else -%> <%# make sure @servers is a hash -%> <%- _servers = Hash.new -%> <%- scope.lookupvar("zookeeper::servers").map.each_with_index {|e, i| _servers[i + 1] = e } -%> <%- end -%> <%- _servers.each_pair do |id, host| -%> <%# make sure port is not included in hostname -%> <%- if host.index(':') -%> <%- host = host[0...(host.index(':'))] -%> <%- end -%> <%- if scope.lookupvar("zookeeper::observers").include? host -%> <%- observer_text=':observer' -%> <%- end -%> <%= "server.#{id}=#{host}:%s:%s%s" % [scope.lookupvar("zookeeper::election_port"), scope.lookupvar("zookeeper::leader_port"), observer_text ] %> <%- end -%> +# Bind election_port and leader_port to all interfaces (0.0.0.0) +quorumListenOnAllIPs=<%= scope.lookupvar("zookeeper::quorum_listen_on_all_ips") %> + # To avoid seeks ZooKeeper allocates space in the transaction log file in # blocks of preAllocSize kilobytes. The default block size is 64M. One reason # for changing the size of the blocks is to reduce the block size if snapshots # are taken more often. (Also, see snapCount). preAllocSize=<%= scope.lookupvar("zookeeper::pre_alloc_size") %> # Clients can submit requests faster than ZooKeeper can process them, # especially if there are a lot of clients. To prevent ZooKeeper from running # out of memory due to queued requests, ZooKeeper will throttle clients so that # there is no more than globalOutstandingLimit outstanding requests in the # system. The default limit is 1,000.ZooKeeper logs transactions to a # transaction log. After snapCount transactions are written to a log file a # snapshot is started and a new transaction log file is started. The default # snapCount is 10,000. snapCount=<%= scope.lookupvar("zookeeper::snap_count") %> # If this option is defined, requests will be will logged to a trace file named # traceFile.year.month.day. #traceFile= # Leader accepts client connections. Default value is "yes". The leader machine # coordinates updates. For higher update throughput at thes slight expense of # read throughput the leader can be configured to not accept clients and focus # on coordination. <% if scope.lookupvar("zookeeper::leader") -%> leaderServes=yes <% else -%> leaderServes=no <% end -%> # Since 3.4.0: When enabled, ZooKeeper auto purge feature retains the autopurge. # snapRetainCount most recent snapshots and the corresponding transaction logs # in the dataDir and dataLogDir respectively and deletes the rest. # Defaults to 3. Minimum value is 3. autopurge.snapRetainCount=<%= scope.lookupvar("zookeeper::snap_retain_count") %> # Since 3.4.0: The time interval in hours for which the purge task has to be # triggered. Set to a positive integer (1 and above) to enable the auto purging. # Defaults to 0. autopurge.purgeInterval=<%= scope.lookupvar("zookeeper::purge_interval") %> # Maximum allowed connections <% if ! [nil, :undefined, :undef].include?(scope.lookupvar("zookeeper::max_allowed_connections")) -%> maxClientCnxns=<%= scope.lookupvar("zookeeper::max_allowed_connections") %> <% else -%> #maxClientCnxns=60 <% end -%> <% if scope.lookupvar("zookeeper::peer_type") != 'UNSET' -%> # Zookeeper peer type peerType=<%= scope.lookupvar("zookeeper::peer_type") %> <% end -%> # The minimum session timeout in milliseconds that the server will allow the # client to negotiate. Defaults to 2 times the tickTime. <% if ! [nil, :undefined, :undef].include?(scope.lookupvar("zookeeper::min_session_timeout")) -%> minSessionTimeout=<%= scope.lookupvar("zookeeper::min_session_timeout") %> <% else -%> #minSessionTimeout=2 <% end -%> # The maximum session timeout in milliseconds that the server will allow the # client to negotiate. Defaults to 20 times the tickTime. <% if ! [nil, :undefined, :undef].include?(scope.lookupvar("zookeeper::max_session_timeout")) -%> maxSessionTimeout=<%= scope.lookupvar("zookeeper::max_session_timeout") %> <% else -%> #maxSessionTimeout=20 <% end -%> <% if scope.lookupvar("zookeeper::use_sasl_auth") -%> # Enable SASL authentication and use the default provider/renew provided by cloudera authProvider.1=org.apache.zookeeper.server.auth.SASLAuthenticationProvider jaasLoginRenew=3600000 <% if scope.lookupvar("zookeeper::remove_host_principal") -%> kerberos.removeHostFromPrincipal=true <% end -%> <% if scope.lookupvar("zookeeper::remove_realm_principal") -%> kerberos.removeRealmFromPrincipal=true <% end -%> <% end -%> <% unless scope.lookupvar("zookeeper::whitelist_4lw").empty? -%> # Supported since 3.4.10 4lw.commands.whitelist=<%= scope.lookupvar("zookeeper::whitelist_4lw").join(',') %> <% end -%> # Supported since 3.6 ## Metrics Providers # # https://prometheus.io Metrics Exporter <% unless [nil, :undefined, :undef].include?(scope.lookupvar("zookeeper::metrics_provider_classname")) -%> metricsProvider.className=<%= scope.lookupvar("zookeeper::metrics_provider_classname") %> metricsProvider.httpPort=<%= scope.lookupvar("zookeeper::metrics_provider_http_port") %> metricsProvider.exportJvmInfo=<%= scope.lookupvar("zookeeper::metrics_provider_export_jvm_info") %> <% else -%> #metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider #metricsProvider.httpPort=7000 #metricsProvider.exportJvmInfo=true <% end -%>