Skip to content

Commit

Permalink
Remove support for stringified booleans
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil Friderici committed Oct 27, 2023
1 parent c8e9b42 commit 33cd25f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
28 changes: 14 additions & 14 deletions manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -536,11 +536,11 @@
services: {
'service-stopped' => {
'ensure' => 'stopped',
'enable' => 'false',
'enable' => false,
},
'service-running' => {
'ensure' => 'running',
'enable' => 'true',
'enable' => true,
}
}
}
Expand All @@ -552,7 +552,7 @@
is_expected.to contain_service('service-stopped').with(
{
'ensure' => 'stopped',
'enable' => 'false',
'enable' => false,
},
)
end
Expand All @@ -561,7 +561,7 @@
is_expected.to contain_service('service-running').with(
{
'ensure' => 'running',
'enable' => 'true',
'enable' => true,
},
)
end
Expand Down
6 changes: 3 additions & 3 deletions spec/defines/service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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 } }
Expand Down

0 comments on commit 33cd25f

Please sign in to comment.