diff --git a/manifests/service.pp b/manifests/service.pp index 5284643..2c0b3c2 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -58,20 +58,20 @@ # Check https://www.puppet.com/docs/puppet/7/types/service.html#service-attribute-stop for more information. # define types::service ( - Stdlib::Ensure::Service $ensure = 'running', - Optional[String[1]] $binary = undef, - Optional[String[1]] $control = undef, - Variant[Boolean, Enum['true', 'false', 'manual']] $enable = true, - Optional[Variant[Boolean, Enum['true', 'false']]] $hasrestart = undef, - Optional[Variant[Boolean, Enum['true', 'false']]] $hasstatus = undef, - Optional[String[1]] $manifest = undef, - Optional[String[1]] $path = undef, - Optional[String[1]] $pattern = undef, - Optional[String[1]] $provider = undef, - Optional[String[1]] $restart = undef, - Optional[String[1]] $start = undef, - Optional[String[1]] $status = undef, - Optional[String[1]] $stop = undef, + Stdlib::Ensure::Service $ensure = 'running', + Optional[String[1]] $binary = undef, + Optional[String[1]] $control = undef, + Variant[Boolean, Enum['manual']] $enable = true, + Optional[Boolean] $hasrestart = undef, + Optional[Boolean] $hasstatus = undef, + Optional[String[1]] $manifest = undef, + Optional[String[1]] $path = undef, + Optional[String[1]] $pattern = undef, + Optional[String[1]] $provider = undef, + Optional[String[1]] $restart = undef, + Optional[String[1]] $start = undef, + Optional[String[1]] $status = undef, + Optional[String[1]] $stop = undef, ) { service { $name: ensure => $ensure, diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 4c8ea71..caf55e1 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -536,11 +536,11 @@ services: { 'service-stopped' => { 'ensure' => 'stopped', - 'enable' => 'false', + 'enable' => false, }, 'service-running' => { 'ensure' => 'running', - 'enable' => 'true', + 'enable' => true, } } } @@ -552,7 +552,7 @@ is_expected.to contain_service('service-stopped').with( { 'ensure' => 'stopped', - 'enable' => 'false', + 'enable' => false, }, ) end @@ -561,7 +561,7 @@ is_expected.to contain_service('service-running').with( { 'ensure' => 'running', - 'enable' => 'true', + 'enable' => true, }, ) end diff --git a/spec/defines/service_spec.rb b/spec/defines/service_spec.rb index ea7963e..7ba4256 100644 --- a/spec/defines/service_spec.rb +++ b/spec/defines/service_spec.rb @@ -21,8 +21,8 @@ binary: '/bin/true', control: 'SERVICE_MAXIMUM_START', enable: 'manual', - hasrestart: 'true', - hasstatus: 'false', + hasrestart: true, + hasstatus: false, manifest: '/bin/manifest', path: '/etc/init.d', pattern: 'service_maximum', @@ -68,7 +68,7 @@ end describe 'with parameter enable' do - ['true', true, 'false', false, 'manual'].each do |value| + [true, false, 'manual'].each do |value| context "set to #{value}" do let(:title) { 'my_service' } let(:params) { { enable: value } }