From a9beda8fe28641c068ee5b7af65652eebb8aba00 Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Tue, 15 Dec 2015 18:54:12 +0100 Subject: [PATCH] Update zookeeper to b0f26bcb900084440d2c290880523658963fca09 b0f26bcb900084440d2c290880523658963fca09 [blacksmith] Bump version to 0.4.1 22c03e86f946a24f92c200f36c3dbcd417105f00 reintroduce `manage_systemd` parameter #26 2750d55d7eae6e0da017b328a40e2fa11ab1312f optionally manage service, alternative solution to #26, #31 3365261789a998388f35ee60b94407dcbd2cce47 Merge pull request #26 from cristifalcas/manage_systemd 08a93656f775ef9f03ace5cdc400bfb8a29329c1 Merge pull request #31 from cornelf/centos7-handle-service-when-it-exist 6fff06d9316a8daf163a40f68cf27bd9350e58d7 version bump 0.4.0, don't use sudo on travis 99b465838c63b6fdac6950df1685cc5333c0674c Merge pull request #30 from jmktam/master 719a9a8464f09677a6585d67bf2a4520cc93e81c drop ruby 1.8.7 support a7f35b814b35d1b47771718bcc721e692715ea13 Merge pull request #32 from MrAlias/upstream-000 84f81322faa1914fd553a58d3ac5848be53a3109 Update project non-development dependencies. c5d997fa306c162d3ee93662365b15c23b23a2da only create zookeper service if it does not exist - e.g. when zookeeper is installed from cdh5-el6; in case of using mesosphere repo which has an centos7 el7 package for zookeeper - the service is created properly and the template would break zookeeper installation if applied to replace the existing service file. 3e62bedfe028066f78be290acd4e9decd7f8ca6b replacing debian with redhat in the redhat manifest b91d9b48d059f2d246978f6c38edb80ad52ea3c0 fix var name de8c91661dee20a082aa46735d0da238295a4c6b manage systemd unit files optionally 2617a4e5e01aaa7b597c533a3229cba71db4517b support minSessionTimeout, specs for #25 09fc5dae935a790bf466e49a4bcea77e47bf2222 don't version Puppetfile.lock a1d1f74bd98fedc6acfb4db50ccc436a168b88af Merge pull request #25 from enovance/max_session_timeout 582f0bf6a400b958bfb9ab119e4b6c62a556e7d2 zoo.cfg: Add maxSessionTimeout in the template 9a4bcb6f2a0477b4f8da4f9fca26ec50c1a48e76 [blacksmith] Bump version to 0.3.10 Change-Id: I2c38be2c34b4df4eb2d543e2977e035d3320a1b2 --- Puppetfile | 2 +- zookeeper/.gitignore | 2 ++ zookeeper/.travis.yml | 6 ++--- zookeeper/Gemfile | 12 +++++----- zookeeper/Puppetfile.lock | 10 --------- zookeeper/README.md | 14 +++++++----- zookeeper/manifests/config.pp | 2 ++ zookeeper/manifests/init.pp | 24 +++++++++++++++----- zookeeper/manifests/os/redhat.pp | 6 ++--- zookeeper/manifests/service.pp | 3 ++- zookeeper/metadata.json | 2 +- zookeeper/spec/classes/config_spec.rb | 20 +++++++++++++++++ zookeeper/spec/classes/init_spec.rb | 31 ++++++++++++++++++++++++++ zookeeper/spec/classes/service_spec.rb | 13 +++++++++++ zookeeper/templates/conf/zoo.cfg.erb | 10 +++++++++ 15 files changed, 120 insertions(+), 37 deletions(-) delete mode 100644 zookeeper/Puppetfile.lock diff --git a/Puppetfile b/Puppetfile index 363b923ec..6c43a42d5 100644 --- a/Puppetfile +++ b/Puppetfile @@ -291,6 +291,6 @@ mod 'xinetd', :git => 'https://github.com/puppetlabs/puppetlabs-xinetd.git' mod 'zookeeper', - :commit => 'b1912045ac65f13e53d60f73515ad08fff4f4f25', + :commit => 'b0f26bcb900084440d2c290880523658963fca09', :git => 'https://github.com/deric/puppet-zookeeper.git' diff --git a/zookeeper/.gitignore b/zookeeper/.gitignore index 5196beace..a64027fab 100644 --- a/zookeeper/.gitignore +++ b/zookeeper/.gitignore @@ -6,3 +6,5 @@ pkg/* Gemfile.lock spec/fixtures/modules/* +.vagrant +Puppetfile.lock diff --git a/zookeeper/.travis.yml b/zookeeper/.travis.yml index 02d3e02f3..733a3046c 100644 --- a/zookeeper/.travis.yml +++ b/zookeeper/.travis.yml @@ -1,3 +1,4 @@ +sudo: false bundler_args: --without development script: - RAKE_ENV=ci bundle exec puppet --version @@ -5,10 +6,9 @@ script: - RAKE_ENV=ci bundle exec rake spec - RAKE_ENV=ci bundle exec rake lint rvm: - - 1.8.7 - 1.9.3 - 2.0.0 - - 2.1.5 + - 2.1.6 env: - PUPPET_VERSION="~> 2.7.0" - PUPPET_VERSION="~> 3.4.0" @@ -21,5 +21,5 @@ matrix: exclude: - rvm: 2.0.0 env: PUPPET_VERSION="~> 2.7.0" - - rvm: 2.1.5 + - rvm: 2.1.6 env: PUPPET_VERSION="~> 2.7.0" diff --git a/zookeeper/Gemfile b/zookeeper/Gemfile index 5cf8211c0..a7a2a80f0 100644 --- a/zookeeper/Gemfile +++ b/zookeeper/Gemfile @@ -5,20 +5,18 @@ gem 'puppet', puppetversion gem 'puppet-lint' gem 'puppetlabs_spec_helper' gem 'rake' -# librarian 2 does not support ruby 1.8.7 -gem 'librarian-puppet', '< 2.0' -gem 'highline', '< 1.7' # 1.7 is not compatible with ruby 1.8.7 +gem 'librarian-puppet', '>= 2.0' +gem 'highline' gem 'rspec-system-puppet', :require => false gem 'serverspec', :require => false gem 'rspec-system-serverspec', :require => false # coverage reports will be in release 2.0 gem 'rspec-puppet', '> 2.0' gem 'rspec', '~> 2.13' +gem 'metadata-json-lint', :require => false -# blacksmith > 3.0 does not support ruby 1.8.7 group :development do - gem 'puppet-blacksmith', '~> 3.0' - gem 'metadata-json-lint', :require => false + gem 'puppet-blacksmith' gem 'beaker' gem 'beaker-rspec', :require => false -end \ No newline at end of file +end diff --git a/zookeeper/Puppetfile.lock b/zookeeper/Puppetfile.lock deleted file mode 100644 index 0f9dc06d8..000000000 --- a/zookeeper/Puppetfile.lock +++ /dev/null @@ -1,10 +0,0 @@ -FORGE - remote: https://forgeapi.puppetlabs.com - specs: - puppetlabs/stdlib (4.1.0) - richardc/datacat (0.4.3) - -DEPENDENCIES - puppetlabs/stdlib (>= 2.3.3) - richardc/datacat (>= 0) - diff --git a/zookeeper/README.md b/zookeeper/README.md index 720fe95a4..06b17747a 100644 --- a/zookeeper/README.md +++ b/zookeeper/README.md @@ -7,8 +7,8 @@ A puppet receipt for [Apache Zookeeper](http://zookeeper.apache.org/). ZooKeeper ## Requirements - * Puppet 2.7, Puppet 3.x - * Ruby 1.8.7, 1.9.3, 2.0.0, 2.1.x + * Puppet >= 2.7, Puppet 3.x + * Ruby 1.9.3, 2.0.0, 2.1.x * binary package of ZooKeeper ## Basic Usage: @@ -90,10 +90,14 @@ This is a workaround for a a [Facter issue](https://tickets.puppetlabs.com/brows - `id` - cluster-unique zookeeper's instance id (1-255) - `datastore` - - `datalogstore` - specifying this configures the dataLogDir Zookeeper config values and allows for transaction logs to be stored in a different location, improving IO performance + - `datalogstore` - specifying this configures the dataLogDir ZooKeeper config values and allows for transaction logs to be stored in a different location, improving IO performance - `log_dir` - - `purge_interval` - automatically will delete zookeeper logs (available since 3.4.0) - - `snap_retain_count` - number of snapshots that will be kept after purging (since 3.4.0) + - `purge_interval` - automatically will delete zookeeper logs (available since ZooKeeper 3.4.0) + - `snap_retain_count` - number of snapshots that will be kept after purging (since ZooKeeper 3.4.0) + - `min_session_timeout` - the minimum session timeout in milliseconds that the server will allow the client to negotiate. Defaults to 2 times the **tickTime** (since ZooKeeper 3.3.0) + - `max_session_timeout` - the maximum session timeout in milliseconds that the server will allow the client to negotiate. Defaults to 20 times the **tickTime** (since ZooKeeper 3.3.0) + - `manage_service` (default: `true`) whether Puppet should ensure running service + - `manage_systemd` when enabled on RHEL 7.0 a service configuration will be managed and many others, see the `init.pp` file for more details. diff --git a/zookeeper/manifests/config.pp b/zookeeper/manifests/config.pp index f62053f6a..5615a5a60 100644 --- a/zookeeper/manifests/config.pp +++ b/zookeeper/manifests/config.pp @@ -55,6 +55,8 @@ $init_limit = 10, $sync_limit = 5, $leader = true, + $min_session_timeout = undef, + $max_session_timeout = undef, ) { require zookeeper::install diff --git a/zookeeper/manifests/init.pp b/zookeeper/manifests/init.pp index 30b89fa02..50970bdb3 100644 --- a/zookeeper/manifests/init.pp +++ b/zookeeper/manifests/init.pp @@ -54,11 +54,16 @@ $packages = ['zookeeper'], $repo = undef, $install_java = false, - $java_package = undef + $java_package = undef, + $min_session_timeout = undef, + $max_session_timeout = undef, + $manage_service = true, + $manage_systemd = true, ) { validate_array($packages) validate_bool($ensure_cron) + validate_bool($manage_service) anchor { 'zookeeper::start': }-> class { 'zookeeper::install': @@ -102,12 +107,19 @@ tracefile_threshold => $tracefile_threshold, max_allowed_connections => $max_allowed_connections, peer_type => $peer_type, - }-> - class { 'zookeeper::service': - cfg_dir => $cfg_dir, - service_name => $service_name, + min_session_timeout => $min_session_timeout, + max_session_timeout => $max_session_timeout, + } + + if ($manage_service) { + class { 'zookeeper::service': + cfg_dir => $cfg_dir, + service_name => $service_name, + require => Class['zookeeper::config'], + before => Anchor['zookeeper::end'], + manage_systemd => $manage_systemd, + } } - -> anchor { 'zookeeper::end': } } diff --git a/zookeeper/manifests/os/redhat.pp b/zookeeper/manifests/os/redhat.pp index fe512b86d..391395205 100644 --- a/zookeeper/manifests/os/redhat.pp +++ b/zookeeper/manifests/os/redhat.pp @@ -1,5 +1,5 @@ # -# ZooKeeper installation on Debian +# ZooKeeper installation on Redhat class zookeeper::os::redhat( $ensure = present, $snap_retain_count = 3, @@ -30,12 +30,12 @@ if versioncmp($::puppetversion, '3.6.0') >= 0 { ensure_resource('package', $java_package, {'ensure' => $ensure, 'allow_virtual' => true, - 'before' => Anchor['zookeeper::os::debian::java']} + 'before' => Anchor['zookeeper::os::redhat::java']} ) } else { ensure_resource('package', $java_package, {'ensure' => $ensure, - 'before' => Anchor['zookeeper::os::debian::java']} + 'before' => Anchor['zookeeper::os::redhat::java']} ) } diff --git a/zookeeper/manifests/service.pp b/zookeeper/manifests/service.pp index a415fab2a..e433264be 100644 --- a/zookeeper/manifests/service.pp +++ b/zookeeper/manifests/service.pp @@ -4,6 +4,7 @@ $cfg_dir = '/etc/zookeeper/conf', $service_name = 'zookeeper', $service_ensure = 'running', + $manage_systemd = true, ){ require zookeeper::install @@ -18,7 +19,7 @@ default: { $initstyle = 'unknown' } } - if ($initstyle == 'systemd') { + if ($initstyle == 'systemd' and $manage_systemd == true) { file { '/usr/lib/systemd/system/zookeeper.service': ensure => 'present', content => template('zookeeper/zookeeper.service.erb'), diff --git a/zookeeper/metadata.json b/zookeeper/metadata.json index 74afa340c..051bab273 100644 --- a/zookeeper/metadata.json +++ b/zookeeper/metadata.json @@ -1,6 +1,6 @@ { "name": "deric-zookeeper", - "version": "0.3.9", + "version": "0.4.1", "author": "Tomas Barton", "summary": "Module for managing Apache Zookeeper", "license": "Apache-2.0", diff --git a/zookeeper/spec/classes/config_spec.rb b/zookeeper/spec/classes/config_spec.rb index 12fd5ce3e..6faa1e4fa 100644 --- a/zookeeper/spec/classes/config_spec.rb +++ b/zookeeper/spec/classes/config_spec.rb @@ -280,4 +280,24 @@ ).with_content(/server.5=192.168.1.5:2888:3888:observer/) } end + context 'setting minSessionTimeout' do + let(:params) {{ + :min_session_timeout => 5000 + }} + + it { should contain_file( + '/etc/zookeeper/conf/zoo.cfg' + ).with_content(/minSessionTimeout=5000/) } + end + + context 'setting maxSessionTimeout' do + let(:params) {{ + :max_session_timeout => 50000 + }} + + it { should contain_file( + '/etc/zookeeper/conf/zoo.cfg' + ).with_content(/maxSessionTimeout=50000/) } + end + end diff --git a/zookeeper/spec/classes/init_spec.rb b/zookeeper/spec/classes/init_spec.rb index a4d25f645..0291b7919 100644 --- a/zookeeper/spec/classes/init_spec.rb +++ b/zookeeper/spec/classes/init_spec.rb @@ -46,5 +46,36 @@ it { should contain_exec('initialize_datastore') } end + context 'setting minSessionTimeout' do + let(:params) {{ + :min_session_timeout => 3000 + }} + it { should contain_file( + '/etc/zookeeper/conf/zoo.cfg' + ).with_content(/minSessionTimeout=3000/) } + end + + context 'setting maxSessionTimeout' do + let(:params) {{ + :max_session_timeout => 60000 + }} + + it { should contain_file( + '/etc/zookeeper/conf/zoo.cfg' + ).with_content(/maxSessionTimeout=60000/) } + end + + context 'disable service management' do + let(:user) { 'zookeeper' } + let(:group) { 'zookeeper' } + + let(:params) { { + :manage_service => false, + } } + + it { should contain_package('zookeeper').with({:ensure => 'present'}) } + it { should_not contain_service('zookeeper').with({:ensure => 'running'}) } + it { should_not contain_class('zookeeper::service') } + end end \ No newline at end of file diff --git a/zookeeper/spec/classes/service_spec.rb b/zookeeper/spec/classes/service_spec.rb index 0c92458f4..55685e41c 100644 --- a/zookeeper/spec/classes/service_spec.rb +++ b/zookeeper/spec/classes/service_spec.rb @@ -40,5 +40,18 @@ :ensure => 'running', :enable => true )} + + context 'do not manage systemd' do + let(:params){{ + :manage_systemd => false, + }} + + it { should_not contain_file( + '/usr/lib/systemd/system/zookeeper.service' + ).with({ + 'ensure' => 'present', + }) + } + end end end diff --git a/zookeeper/templates/conf/zoo.cfg.erb b/zookeeper/templates/conf/zoo.cfg.erb index f2f07e90a..2c876ab19 100644 --- a/zookeeper/templates/conf/zoo.cfg.erb +++ b/zookeeper/templates/conf/zoo.cfg.erb @@ -83,3 +83,13 @@ maxClientCnxns=<%= @max_allowed_connections %> # Zookeeper peer type peerType=<%= @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 @min_session_timeout -%> +minSessionTimeout=<%= @min_session_timeout %> +<% end -%> + +# The maximum session timeout in milliseconds that the server will allow the # client to negotiate. Defaults to 20 times the tickTime. +<% if @max_session_timeout -%> +maxSessionTimeout=<%= @max_session_timeout %> +<% end -%>