Skip to content

Commit

Permalink
Add parameter: $service_restart
Browse files Browse the repository at this point in the history
  • Loading branch information
arioch committed Nov 14, 2014
1 parent 4d02d36 commit 72ae45e
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 5 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,14 @@ class { 'keepalived::global_defs':
}
```

### Soft-restart the Keepalived daemon

```puppet
class { '::keepalived':
service_restart => 'service keepalived reload',
}
```

### Opt out of having the service managed by the module

```puppet
Expand Down
2 changes: 1 addition & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
$service_hasstatus = $::keepalived::params::service_hasstatus,
$service_manage = $::keepalived::params::service_manage,
$service_name = $::keepalived::params::service_name,
$service_restart = $::keepalived::params::service_restart,
) inherits keepalived::params {

validate_absolute_path($config_dir)
validate_re($config_dir_mode, '^[0-9]+$')
validate_re($config_file_mode, '^[0-9]+$')
Expand Down
9 changes: 5 additions & 4 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
#
class keepalived::params {

$pkg_ensure = 'present'
$service_enable = true
$service_ensure = 'running'
$service_manage = true
$pkg_ensure = 'present'
$service_enable = true
$service_ensure = 'running'
$service_manage = true
$service_restart = undef

case $::osfamily {
'redhat': {
Expand Down
1 change: 1 addition & 0 deletions manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
hasrestart => $::keepalived::service_hasrestart,
hasstatus => $::keepalived::service_hasstatus,
require => Class['::keepalived::config'],
restart => $::keepalived::service_restart,
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions spec/classes/keepalived_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,14 @@
)
}
end

describe 'with parameter: service_restart' do
let (:params) { { :service_restart => '_VALUE_' } }

it { should contain_service('keepalived').with(
'restart' => '_VALUE_'
)
}
end
end

0 comments on commit 72ae45e

Please sign in to comment.