Skip to content

Commit

Permalink
Use init service provider on <El7. Rename sysv references to init. Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
fatmcgav committed Mar 15, 2016
1 parent 85de0cd commit 7f6db63
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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' : {
Expand Down
6 changes: 3 additions & 3 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
Expand All @@ -67,7 +67,7 @@
} elsif $::operatingsystem == 'Darwin' {
$init_style = 'launchd'
} elsif $::operatingsystem == 'Amazon' {
$init_style = 'sysv'
$init_style = 'init'
} else {
$init_style = undef
}
Expand Down
22 changes: 11 additions & 11 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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/)
Expand Down Expand Up @@ -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

Expand All @@ -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

Expand Down
File renamed without changes.

0 comments on commit 7f6db63

Please sign in to comment.