Skip to content

Commit

Permalink
Use $service_name for service resource title
Browse files Browse the repository at this point in the history
  • Loading branch information
fnoop authored and alexjfisher committed Nov 22, 2017
1 parent 60ef6cb commit 9b9121a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
$service_ensure = running,
$service_flags = undef,
$service_restart = undef,
$service_name = undef,
$service_name = 'nginx',
$service_manage = true,
### END Service Configuration ###

Expand Down
8 changes: 3 additions & 5 deletions manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,17 @@
if $service_manage {
case $::osfamily {
'OpenBSD': {
service { 'nginx':
service { $service_name:
ensure => $service_ensure_real,
name => $service_name,
enable => $service_enable,
flags => $service_flags,
hasstatus => true,
hasrestart => true,
}
}
default: {
service { 'nginx':
service { $service_name:
ensure => $service_ensure_real,
name => $service_name,
enable => $service_enable,
hasstatus => true,
hasrestart => true,
Expand All @@ -63,7 +61,7 @@

# Allow overriding of 'restart' of Service resource; not used by default
if $service_restart {
Service['nginx'] {
Service[$service_name] {
restart => $service_restart,
}
}
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/nginx_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
}
end

it { is_expected.to contain_service('nginx').with_name('nginx14') }
it { is_expected.to contain_service('nginx14') }
end

describe 'when service_manage => false' do
Expand Down

0 comments on commit 9b9121a

Please sign in to comment.