From 9b9121ae8882328287defb5fc9664cc2f50c9653 Mon Sep 17 00:00:00 2001 From: Fnoop Date: Wed, 22 Nov 2017 12:40:43 +0000 Subject: [PATCH] Use $service_name for service resource title Closes #1158 --- manifests/init.pp | 2 +- manifests/service.pp | 8 +++----- spec/classes/nginx_spec.rb | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index a6bcce0c5..7c1b468ac 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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 ### diff --git a/manifests/service.pp b/manifests/service.pp index 587ed2569..a797f57ef 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -40,9 +40,8 @@ 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, @@ -50,9 +49,8 @@ } } default: { - service { 'nginx': + service { $service_name: ensure => $service_ensure_real, - name => $service_name, enable => $service_enable, hasstatus => true, hasrestart => true, @@ -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, } } diff --git a/spec/classes/nginx_spec.rb b/spec/classes/nginx_spec.rb index 28b40c57b..527977531 100644 --- a/spec/classes/nginx_spec.rb +++ b/spec/classes/nginx_spec.rb @@ -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