Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support for Debian (6, 7) and Ubuntu (10.04, 12.04, 14.04) #143

Merged
merged 1 commit into from
Mar 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,7 @@ class { 'zookeeper':

Some reasonable values are:

* `init` - RHEL6, Debian 7
* `upstart` - Ubuntu
* `systemd` - RHEL 7, Debian 8
* `systemd`
* `runit`
* `exhibitor` - zookeeper process and config will be managed by exhibitor (https://github.com/soabase/exhibitor). Exhibitor is not managed by this module.
* `none` - service won't be installed
Expand Down Expand Up @@ -371,12 +369,11 @@ rake beaker:sets
## Supported platforms

* Debian/Ubuntu
* Debian 6 Squeeze: you can get ZooKeeper package from [Wheezy](http://packages.debian.org/wheezy/zookeeper) or [Sid](http://packages.debian.org/sid/zookeeper) repo.
* Debian 7 Wheezy: available in apt repository
* RedHat/CentOS/Fedora

### Tested on:

* Debian 6 - Squeeze, 7 - Wheezy, 8 - Jessie
* Ubuntu 12.04.03 LTS, 14.04
* RHEL 6, RHEL 7, CentOS 6
* Debian (8, 9, 10)
* Ubuntu (16.04, 18.04)
* RHEL (6, 7)
* CentOS (6, 7)
30 changes: 4 additions & 26 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,8 @@
case $os_family {
'Debian': {
case $os_name {
'Debian': {
if versioncmp($os_release, '8') < 0 {
$initstyle = 'init'
} else {
$initstyle = 'systemd'
}
}
'Ubuntu': {
if versioncmp($os_release, '15.04') < 0 {
$initstyle = 'upstart'
} else {
$initstyle = 'systemd'
}
'Debian', 'Ubuntu': {
$initstyle = 'systemd'
}
default: { $initstyle = undef }
}
Expand All @@ -42,19 +31,8 @@
}
'RedHat': {
case $os_name {
'RedHat': {
if versioncmp($os_release, '7') < 0 {
$initstyle = 'redhat'
} else {
$initstyle = 'systemd'
}
}
'CentOS' : {
if versioncmp($os_release, '7') < 0 {
$initstyle = 'redhat'
} else {
$initstyle = 'systemd'
}
'RedHat', 'CentOS': {
$initstyle = 'systemd'
}
default: {
$initstyle = undef
Expand Down
15 changes: 2 additions & 13 deletions manifests/post_install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,8 @@
case $os_family {
'Debian': {
case $os_name {
'Debian': {
if versioncmp($os_release, '8') < 0 { # 3.3.5
$_clean = true
} else { # future releases
$_clean = false
}
}
'Ubuntu': {
if versioncmp($os_release, '12.04') < 0 { # 3.3.5
$_clean = true
} else { # future releases
$_clean = false
}
'Debian', 'Ubuntu': {
$_clean = false
}
default: {
fail ("Family: '${os_family}' OS: '${os_name}' is not supported yet")
Expand Down
30 changes: 8 additions & 22 deletions manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,14 @@
}

if $::zookeeper::manage_service_file == true {
if $::zookeeper::service_provider == 'systemd' {
file { "${::zookeeper::systemd_path}/${::zookeeper::service_name}.service":
ensure => 'present',
content => template("${module_name}/zookeeper.service.erb"),
}
~> exec { 'systemctl daemon-reload # for zookeeper':
refreshonly => true,
path => $::path,
notify => Service[$::zookeeper::service_name],
}
} elsif (
$::zookeeper::service_provider == 'init'
or $::zookeeper::service_provider == 'redhat'
or $::zookeeper::service_provider == 'debian'
) {
file { "/etc/init.d/${::zookeeper::service_name}":
ensure => present,
content => template("${module_name}/zookeeper.${facts['os']['family']}.init.erb"),
mode => '0755',
before => Service[$::zookeeper::service_name],
notify => Service[$::zookeeper::service_name],
}
file { "${::zookeeper::systemd_path}/${::zookeeper::service_name}.service":
ensure => 'present',
content => template("${module_name}/zookeeper.service.erb"),
}
~> exec { 'systemctl daemon-reload # for zookeeper':
refreshonly => true,
path => $::path,
notify => Service[$::zookeeper::service_name],
}
}

Expand Down
4 changes: 0 additions & 4 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@
{
"operatingsystem": "Debian",
"operatingsystemrelease": [
"6",
"7",
"8",
"9",
"10"
Expand All @@ -54,8 +52,6 @@
{
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [
"12.04",
"14.04",
"16.04",
"18.04"
]
Expand Down
42 changes: 0 additions & 42 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -178,48 +178,6 @@
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(/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 os_facts[:osfamily] == 'RedHat'
it do
is_expected.to contain_file(
"/etc/init.d/#{service_name}"
).with_content(/pidfile=\/var\/run\/zookeeper.pid/)
end
else
it do
is_expected.to contain_file(
environment_file
).with_content(/PIDFILE=\/var\/run\/zookeeper.pid/)
end
end
end

context 'create env file' do
it do
is_expected.to contain_file(
Expand Down
29 changes: 0 additions & 29 deletions spec/classes/service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,36 +125,7 @@
end
end
end
when 'init'
context 'init' do
let :pre_condition do
'class {"zookeeper":
zoo_dir => "/usr/lib/zookeeper",
log_dir => "/var/log/zookeeper",
manage_service_file => true,
service_provider => "init",
}'
end

it do
is_expected.to contain_file(
'/etc/init.d/zookeeper'
).with({
'ensure' => 'present',
})
end

it do
is_expected.to contain_service('zookeeper').with(
:ensure => 'running',
:enable => true,
:provider => 'init',
)
end
end
end

if init_provider != 'upstart'
context 'custom service name' do
let :pre_condition do
'class {"zookeeper":
Expand Down
55 changes: 4 additions & 51 deletions spec/spec_helper_local.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,64 +16,17 @@ def get_os_info(facts)
info[:environment_file] = '/etc/zookeeper/conf/environment'
info[:should_install_zookeeperd] = true
info[:zookeeper_shell] = '/bin/false'

case facts[:os]['name']
when 'Debian'
if Puppet::Util::Package.versioncmp(facts[:os]['release']['major'], '8') < 0
info[:init_provider] = 'init'
info[:should_install_cron] = true
else
info[:init_provider] = 'systemd'
end
when 'Ubuntu'
if Puppet::Util::Package.versioncmp(facts[:os]['release']['major'], '15.04') < 0
info[:init_provider] = 'upstart'
else
info[:init_provider] = 'systemd'
end

if Puppet::Util::Package.versioncmp(facts[:os]['release']['major'], '12.04') < 0
info[:should_install_cron] = true
end
end
info[:init_provider] = 'systemd'
when 'RedHat'
info[:service_name] = 'zookeeper-server'
info[:environment_file] = '/etc/zookeeper/conf/java.env'
info[:should_install_zookeeperd] = false
info[:zookeeper_shell] = '/sbin/nologin'

case facts[:os]['name']
when 'RedHat'
if Puppet::Util::Package.versioncmp(facts[:os]['release']['major'], '7') < 0
info[:init_provider] = 'redhat'
else
info[:init_provider] = 'systemd'
end
when 'CentOS'
if Puppet::Util::Package.versioncmp(facts[:os]['release']['major'], '7') < 0
info[:init_provider] = 'redhat'
else
info[:init_provider] = 'systemd'
end
end
info[:init_provider] = 'systemd'
end

case info[:init_provider]
when 'init'
info[:init_dir] = '/etc/init.d'
when 'systemd'
info[:init_dir] = '/etc/systemd/system'
when 'upstart'
info[:init_dir] = '/etc/init'
when 'redhat'
info[:init_dir] = '/etc/init.d'
end

if info[:init_provider] == 'systemd'
info[:service_file] = "#{info[:init_dir]}/#{info[:service_name]}.service"
else
info[:service_file] = "#{info[:init_dir]}/#{info[:service_name]}"
end
info[:init_dir] = '/etc/systemd/system'
info[:service_file] = "#{info[:init_dir]}/#{info[:service_name]}.service"

return info
end
Loading