Skip to content

Commit

Permalink
Update zookeeper to b0f26bc
Browse files Browse the repository at this point in the history
b0f26bc [blacksmith] Bump version to 0.4.1
22c03e8 reintroduce `manage_systemd` parameter redhat-openstack#26
2750d55 optionally manage service, alternative solution to redhat-openstack#26, redhat-openstack#31
3365261 Merge pull request redhat-openstack#26 from cristifalcas/manage_systemd
08a9365 Merge pull request redhat-openstack#31 from cornelf/centos7-handle-service-when-it-exist
6fff06d version bump 0.4.0, don't use sudo on travis
99b4658 Merge pull request redhat-openstack#30 from jmktam/master
719a9a8 drop ruby 1.8.7 support
a7f35b8 Merge pull request redhat-openstack#32 from MrAlias/upstream-000
84f8132 Update project non-development dependencies.
c5d997f 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.
3e62bed replacing debian with redhat in the redhat manifest
b91d9b4 fix var name
de8c916 manage systemd unit files optionally
2617a4e support minSessionTimeout, specs for redhat-openstack#25
09fc5da don't version Puppetfile.lock
a1d1f74 Merge pull request redhat-openstack#25 from enovance/max_session_timeout
582f0bf zoo.cfg: Add maxSessionTimeout in the template
9a4bcb6 [blacksmith] Bump version to 0.3.10

Change-Id: I2c38be2c34b4df4eb2d543e2977e035d3320a1b2
  • Loading branch information
xbezdick committed Dec 15, 2015
1 parent 56e6695 commit a9beda8
Show file tree
Hide file tree
Showing 15 changed files with 120 additions and 37 deletions.
2 changes: 1 addition & 1 deletion Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'

2 changes: 2 additions & 0 deletions zookeeper/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@
pkg/*
Gemfile.lock
spec/fixtures/modules/*
.vagrant
Puppetfile.lock
6 changes: 3 additions & 3 deletions zookeeper/.travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
sudo: false
bundler_args: --without development
script:
- RAKE_ENV=ci bundle exec puppet --version
- RAKE_ENV=ci bundle exec rake validate
- 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"
Expand All @@ -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"
12 changes: 5 additions & 7 deletions zookeeper/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
end
10 changes: 0 additions & 10 deletions zookeeper/Puppetfile.lock

This file was deleted.

14 changes: 9 additions & 5 deletions zookeeper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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.

Expand Down
2 changes: 2 additions & 0 deletions zookeeper/manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
$init_limit = 10,
$sync_limit = 5,
$leader = true,
$min_session_timeout = undef,
$max_session_timeout = undef,
) {
require zookeeper::install

Expand Down
24 changes: 18 additions & 6 deletions zookeeper/manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down Expand Up @@ -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': }

}
6 changes: 3 additions & 3 deletions zookeeper/manifests/os/redhat.pp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# ZooKeeper installation on Debian
# ZooKeeper installation on Redhat
class zookeeper::os::redhat(
$ensure = present,
$snap_retain_count = 3,
Expand Down Expand Up @@ -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']}
)
}

Expand Down
3 changes: 2 additions & 1 deletion zookeeper/manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
$cfg_dir = '/etc/zookeeper/conf',
$service_name = 'zookeeper',
$service_ensure = 'running',
$manage_systemd = true,
){
require zookeeper::install

Expand All @@ -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'),
Expand Down
2 changes: 1 addition & 1 deletion zookeeper/metadata.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
20 changes: 20 additions & 0 deletions zookeeper/spec/classes/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
31 changes: 31 additions & 0 deletions zookeeper/spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 13 additions & 0 deletions zookeeper/spec/classes/service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 10 additions & 0 deletions zookeeper/templates/conf/zoo.cfg.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 -%>

0 comments on commit a9beda8

Please sign in to comment.