From 7f6db63f65c7f498020a6e59e906efe1752533ca Mon Sep 17 00:00:00 2001 From: Gavin Williams Date: Tue, 15 Mar 2016 14:10:10 +0000 Subject: [PATCH] Use init service provider on consul.init.erb} | 0 4 files changed, 16 insertions(+), 16 deletions(-) rename templates/{consul.sysv.erb => consul.init.erb} (100%) diff --git a/manifests/config.pp b/manifests/config.pp index 5dff3990..0e178b54 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -46,12 +46,12 @@ refreshonly => true, } } - 'sysv' : { + 'init' : { file { '/etc/init.d/consul': mode => '0555', owner => 'root', group => 'root', - content => template('consul/consul.sysv.erb') + content => template('consul/consul.init.erb') } } 'debian' : { diff --git a/manifests/params.pp b/manifests/params.pp index 67138ea7..b6446c55 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -38,13 +38,13 @@ } } elsif $::operatingsystem =~ /Scientific|CentOS|RedHat|OracleLinux/ { if versioncmp($::operatingsystemrelease, '7.0') < 0 { - $init_style = 'sysv' + $init_style = 'init' } else { $init_style = 'systemd' } } elsif $::operatingsystem == 'Fedora' { if versioncmp($::operatingsystemrelease, '12') < 0 { - $init_style = 'sysv' + $init_style = 'init' } else { $init_style = 'systemd' } @@ -67,7 +67,7 @@ } elsif $::operatingsystem == 'Darwin' { $init_style = 'launchd' } elsif $::operatingsystem == 'Amazon' { - $init_style = 'sysv' + $init_style = 'init' } else { $init_style = undef } diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index cd7fdab3..4d1dbaeb 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -487,23 +487,23 @@ it { should contain_exec('reload consul service') } end - context "When using sysv" do + context "When using init" do let (:params) {{ - :init_style => 'sysv' + :init_style => 'init' }} let (:facts) {{ :ipaddress_lo => '127.0.0.1' }} - it { should contain_class('consul').with_init_style('sysv') } + it { should contain_class('consul').with_init_style('init') } it { should contain_file('/etc/init.d/consul'). with_content(/-rpc-addr=127.0.0.1:8400/) } end - context "When overriding default rpc port on sysv" do + context "When overriding default rpc port on init" do let (:params) {{ - :init_style => 'sysv', + :init_style => 'init', :config_hash => { 'ports' => { 'rpc' => '9999' @@ -513,21 +513,21 @@ } } }} - it { should contain_class('consul').with_init_style('sysv') } + it { should contain_class('consul').with_init_style('init') } it { should contain_file('/etc/init.d/consul'). with_content(/-rpc-addr=consul.example.com:9999/) } end - context "When rpc_addr defaults to client_addr on sysv" do + context "When rpc_addr defaults to client_addr on init" do let (:params) {{ - :init_style => 'sysv', + :init_style => 'init', :config_hash => { 'client_addr' => '192.168.34.56', } }} - it { should contain_class('consul').with_init_style('sysv') } + it { should contain_class('consul').with_init_style('init') } it { should contain_file('/etc/init.d/consul'). with_content(/-rpc-addr=192.168.34.56:8400/) @@ -606,7 +606,7 @@ :operatingsystemrelease => '6.5' }} - it { should contain_class('consul').with_init_style('sysv') } + it { should contain_class('consul').with_init_style('init') } it { should contain_file('/etc/init.d/consul').with_content(/daemon --user=consul/) } end @@ -625,7 +625,7 @@ :operatingsystemrelease => '3.10.34-37.137.amzn1.x86_64' }} - it { should contain_class('consul').with_init_style('sysv') } + it { should contain_class('consul').with_init_style('init') } it { should contain_file('/etc/init.d/consul').with_content(/daemon --user=consul/) } end diff --git a/templates/consul.sysv.erb b/templates/consul.init.erb similarity index 100% rename from templates/consul.sysv.erb rename to templates/consul.init.erb