Add a refreshonly parameter to service_validation
This will allow to run the service_validation on demand when required from a notification, for example. Change-Id: I18ea45f39cd7f4930de4916d658653d22d8530b3
This commit is contained in:
@@ -37,6 +37,10 @@
|
|||||||
# The provider to use for the exec command;
|
# The provider to use for the exec command;
|
||||||
# string; optional; default to 'shell'
|
# string; optional; default to 'shell'
|
||||||
#
|
#
|
||||||
|
# [*refreshonly*]
|
||||||
|
# If the service validation should only occur on a refresh/notification;
|
||||||
|
# boolean; optional; default to false
|
||||||
|
#
|
||||||
# [*timeout*]
|
# [*timeout*]
|
||||||
# The maximum time the command should take;
|
# The maximum time the command should take;
|
||||||
# string; optional; default to '60'
|
# string; optional; default to '60'
|
||||||
@@ -62,11 +66,12 @@ define openstacklib::service_validation(
|
|||||||
$service_name = $name,
|
$service_name = $name,
|
||||||
$path = '/usr/bin:/bin:/usr/sbin:/sbin',
|
$path = '/usr/bin:/bin:/usr/sbin:/sbin',
|
||||||
$provider = shell,
|
$provider = shell,
|
||||||
|
$refreshonly = false,
|
||||||
|
$timeout = '60',
|
||||||
$tries = '10',
|
$tries = '10',
|
||||||
$try_sleep = '2',
|
$try_sleep = '2',
|
||||||
$onlyif = undef,
|
$onlyif = undef,
|
||||||
$unless = undef,
|
$unless = undef,
|
||||||
$timeout = '60',
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if $onlyif and $unless {
|
if $onlyif and $unless {
|
||||||
@@ -74,9 +79,10 @@ define openstacklib::service_validation(
|
|||||||
}
|
}
|
||||||
|
|
||||||
exec { "execute ${service_name} validation":
|
exec { "execute ${service_name} validation":
|
||||||
|
command => $command,
|
||||||
path => $path,
|
path => $path,
|
||||||
provider => $provider,
|
provider => $provider,
|
||||||
command => $command,
|
refreshonly => $refreshonly,
|
||||||
timeout => $timeout,
|
timeout => $timeout,
|
||||||
tries => $tries,
|
tries => $tries,
|
||||||
try_sleep => $try_sleep,
|
try_sleep => $try_sleep,
|
||||||
|
@@ -36,6 +36,7 @@ describe 'openstacklib::service_validation' do
|
|||||||
:path => '/usr/bin:/bin:/usr/sbin:/sbin',
|
:path => '/usr/bin:/bin:/usr/sbin:/sbin',
|
||||||
:provider => 'shell',
|
:provider => 'shell',
|
||||||
:command => 'nova list',
|
:command => 'nova list',
|
||||||
|
:refreshonly => false,
|
||||||
:timeout => '60',
|
:timeout => '60',
|
||||||
:tries => '10',
|
:tries => '10',
|
||||||
:try_sleep => '2',
|
:try_sleep => '2',
|
||||||
@@ -57,6 +58,7 @@ describe 'openstacklib::service_validation' do
|
|||||||
:path => '/usr/bin:/bin:/usr/sbin:/sbin',
|
:path => '/usr/bin:/bin:/usr/sbin:/sbin',
|
||||||
:provider => 'shell',
|
:provider => 'shell',
|
||||||
:command => 'nova list',
|
:command => 'nova list',
|
||||||
|
:refreshonly => false,
|
||||||
:timeout => '60',
|
:timeout => '60',
|
||||||
:tries => '10',
|
:tries => '10',
|
||||||
:try_sleep => '2',
|
:try_sleep => '2',
|
||||||
@@ -78,6 +80,7 @@ describe 'openstacklib::service_validation' do
|
|||||||
:path => '/usr/bin:/bin:/usr/sbin:/sbin',
|
:path => '/usr/bin:/bin:/usr/sbin:/sbin',
|
||||||
:provider => 'shell',
|
:provider => 'shell',
|
||||||
:command => 'nova list',
|
:command => 'nova list',
|
||||||
|
:refreshonly => false,
|
||||||
:timeout => '60',
|
:timeout => '60',
|
||||||
:tries => '10',
|
:tries => '10',
|
||||||
:try_sleep => '2',
|
:try_sleep => '2',
|
||||||
|
Reference in New Issue
Block a user