diff --git a/manifests/config.pp b/manifests/config.pp index fce61b6a..c489c37d 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -15,7 +15,7 @@ $purge = true, ) { - if $::consul::init_style { + if $::consul::manage_init { case $::consul::init_style { 'upstart': { diff --git a/manifests/init.pp b/manifests/init.pp index e9116529..2d012484 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -161,6 +161,7 @@ $install_method = $::consul::params::install_method, $join_wan = $::consul::params::join_wan, $manage_group = $::consul::params::manage_group, + $manage_init = $::consul::params::manage_init, $manage_service = $::consul::params::manage_service, $manage_user = $::consul::params::manage_user, $os = $::consul::params::os, @@ -201,6 +202,7 @@ validate_hash($watches) validate_hash($checks) validate_hash($acls) + validate_bool($manage_init) $config_hash_real = deep_merge($config_defaults, $config_hash) diff --git a/manifests/params.pp b/manifests/params.pp index b0cf905d..ba87ebd8 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -20,6 +20,7 @@ $group = 'consul' $install_method = 'url' $join_wan = false + $manage_init = true $manage_group = true $manage_service = true $manage_user = true @@ -93,9 +94,6 @@ } elsif $::operatingsystem == 'Amazon' { $init_style = 'init' } else { - $init_style = undef - } - if $init_style == undef { - fail('Unsupported OS') + fail('Cannot determine init_style, unsupported OS') } } diff --git a/manifests/run_service.pp b/manifests/run_service.pp index e1042763..c7e2b94c 100644 --- a/manifests/run_service.pp +++ b/manifests/run_service.pp @@ -10,7 +10,7 @@ default => 'consul', } - if $::consul::manage_service == true and $::consul::init_style { + if $::consul::manage_service == true { service { 'consul': ensure => $::consul::service_ensure, name => $init_selector, diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 8466b70d..4110db71 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -694,9 +694,9 @@ it { should contain_file('/lib/systemd/system/consul.service').with_content(/consul agent/) } end - context "When asked not to manage the init_style" do - let(:params) {{ :init_style => false }} - it { should contain_class('consul').with_init_style(false) } + context "When asked not to manage the init system" do + let(:params) {{ :manage_init => false }} + it { should contain_class('consul').with_manage_init(false) } it { should_not contain_file("/etc/init.d/consul") } it { should_not contain_file("/lib/systemd/system/consul.service") } end