Skip to content

Commit

Permalink
service: hasrestart/hasstatus: use Puppet defaults
Browse files Browse the repository at this point in the history
This is a followup of 86b83d3. We don't
need to explicitly set hasrestart to false/true. All systems run systemd
and the units have a working restart option so we can use it. And
instead of hardcoding this we can just set it to undef so puppet figures
this out on its own.
  • Loading branch information
bastelfreak committed Apr 16, 2024
1 parent 171fc7f commit 1b003d1
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 28 deletions.
8 changes: 5 additions & 3 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,17 +177,19 @@ Default value: `'running'`

##### <a name="-keepalived--service_hasrestart"></a>`service_hasrestart`

Data type: `Boolean`
Data type: `Optional[Boolean]`



Default value: `undef`

##### <a name="-keepalived--service_hasstatus"></a>`service_hasstatus`

Data type: `Boolean`
Data type: `Optional[Boolean]`



Default value: `true`
Default value: `undef`

##### <a name="-keepalived--service_manage"></a>`service_manage`

Expand Down
1 change: 0 additions & 1 deletion data/os/Debian.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
keepalived::sysconf_dir: 'default'
keepalived::sysconf_options: ''
keepalived::service_hasrestart: false
1 change: 0 additions & 1 deletion data/os/Gentoo.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
keepalived::sysconf_dir: 'conf.d'
keepalived::sysconf_options: '-D'
keepalived::service_hasrestart: false
1 change: 0 additions & 1 deletion data/os/RedHat.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
keepalived::sysconf_dir: 'sysconfig'
keepalived::sysconf_options: '-D'
keepalived::service_hasrestart: true
4 changes: 2 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
class keepalived (
String[1] $sysconf_dir,
String $sysconf_options,
Boolean $service_hasrestart,
Boolean $service_hasstatus = true,
Optional[Boolean] $service_hasrestart = undef,
Optional[Boolean] $service_hasstatus = undef,

Stdlib::Absolutepath $config_dir = '/etc/keepalived',
Stdlib::Filemode $config_dir_mode = '0755',
Expand Down
26 changes: 6 additions & 20 deletions spec/classes/keepalived_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,12 @@
)
}

case facts[:osfamily]
when 'Debian'
it {
is_expected.to contain_service('keepalived').with(
'ensure' => 'running',
'enable' => 'true',
'hasrestart' => 'false',
'hasstatus' => 'true'
)
}
else
it {
is_expected.to contain_service('keepalived').with(
'ensure' => 'running',
'enable' => 'true',
'hasrestart' => 'true',
'hasstatus' => 'true'
)
}
end
it {
is_expected.to contain_service('keepalived').with(
'ensure' => 'running',
'enable' => 'true'
)
}
end

describe 'with parameter: config_dir' do
Expand Down

0 comments on commit 1b003d1

Please sign in to comment.