From c47abd42ac551e2fefe6d0ae449c92ee56ebfd64 Mon Sep 17 00:00:00 2001 From: olevole Date: Mon, 26 Oct 2020 20:54:31 +0300 Subject: [PATCH 1/2] do not systemctl daemon-reload on systemd-free distros --- manifests/service.pp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/manifests/service.pp b/manifests/service.pp index 6102d5d..7d13c97 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -58,7 +58,11 @@ File["${zookeeper::cfg_dir}/${zookeeper::environment_file}"] ~> Service[$zookeeper::service_name] File["${zookeeper::cfg_dir}/log4j.properties"] ~> Service[$zookeeper::service_name] if $::zookeeper::manage_service_file { - Exec['systemctl daemon-reload # for zookeeper'] ~> Service[$::zookeeper::service_name] - } + if $zookeeper::service_provider == 'systemd' { + Exec['systemctl daemon-reload # for zookeeper'] ~> Service[$::zookeeper::service_name] + } else { + Service[$::zookeeper::service_name] + } + } } } From 6dc8b5148dc38db845dd0e0ff08382722452b68b Mon Sep 17 00:00:00 2001 From: olevole Date: Mon, 26 Oct 2020 21:59:59 +0300 Subject: [PATCH 2/2] allow to overwrite initialize datastore script Ive just realized that /usr/bin/zookeeper-server-initialize is caldera-package only wrapper. When you use alternative build or install prefix, you may need to change script name. Added as initialize_datastore_bin params --- manifests/config.pp | 2 +- manifests/init.pp | 1 + manifests/params.pp | 28 ++++++++++++++++------------ 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index f4776e5..7f60614 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -81,7 +81,7 @@ # 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 3fd3ff9..edfed20 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -69,6 +69,7 @@ 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, diff --git a/manifests/params.pp b/manifests/params.pp index 594f5e5..62e399e 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -20,10 +20,11 @@ } $_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 @@ -44,10 +45,11 @@ } $_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' } @@ -60,10 +62,11 @@ } $_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' } @@ -134,6 +137,7 @@ $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'