diff --git a/manifests/init.pp b/manifests/init.pp index bad654c..2a39f5c 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -51,7 +51,6 @@ $extra_groups = [], $purge_config_dir = true, $group = 'nomad', - $join_wan = false, $bin_dir = '/usr/local/bin', $arch = $nomad::params::arch, $version = $nomad::params::version, diff --git a/manifests/run_service.pp b/manifests/run_service.pp index 8dd7362..9b62117 100644 --- a/manifests/run_service.pp +++ b/manifests/run_service.pp @@ -5,27 +5,22 @@ # class nomad::run_service { - $init_selector = $nomad::init_style ? { + $init_selector = $::nomad::init_style ? { 'launchd' => 'io.nomad.daemon', default => 'nomad', } - if $nomad::manage_service == true { - service { 'nomad': - ensure => $nomad::service_ensure, - name => $init_selector, - enable => $nomad::service_enable, - provider => $nomad::init_style, - } + $service_provider = $::nomad::init_style ? { + 'unmanaged' => undef, + default => $::nomad::init_style, } - if $nomad::join_wan { - exec { 'join nomad wan': - cwd => $nomad::config_dir, - path => [$nomad::bin_dir,'/bin','/usr/bin'], - command => "nomad join -wan ${nomad::join_wan}", - unless => "nomad members -wan -detailed | grep -vP \"dc=${nomad::config_hash_real['datacenter']}\" | grep -P 'alive'", - subscribe => Service['nomad'], + if $::nomad::manage_service == true { + service { 'nomad': + ensure => $::nomad::service_ensure, + name => $init_selector, + enable => $::nomad::service_enable, + provider => $service_provider, } } diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 3e50263..70222d8 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -56,17 +56,6 @@ it { should_not contain_class('nomad::config').that_notifies(['Class[nomad::run_service]']) } end - context 'When joining nomad to a wan cluster by a known URL' do - let(:params) {{ - :join_wan => 'wan_host.test.com' - }} - it { should contain_exec('join nomad wan').with(:command => 'nomad join -wan wan_host.test.com') } - end - - context 'By default, should not attempt to join a wan cluster' do - it { should_not contain_exec('join nomad wan') } - end - context 'When requesting to install via a package with defaults' do let(:params) {{ :install_method => 'package'