Merge "Add a refreshonly parameter to service_validation"

This commit is contained in:
Jenkins 2016-09-27 23:43:01 +00:00 committed by Gerrit Code Review
commit c6644f3162
2 changed files with 40 additions and 31 deletions

View File

@ -37,6 +37,10 @@
# The provider to use for the exec command;
# string; optional; default to 'shell'
#
# [*refreshonly*]
# If the service validation should only occur on a refresh/notification;
# boolean; optional; default to false
#
# [*timeout*]
# The maximum time the command should take;
# string; optional; default to '60'
@ -62,11 +66,12 @@ define openstacklib::service_validation(
$service_name = $name,
$path = '/usr/bin:/bin:/usr/sbin:/sbin',
$provider = shell,
$refreshonly = false,
$timeout = '60',
$tries = '10',
$try_sleep = '2',
$onlyif = undef,
$unless = undef,
$timeout = '60',
) {
if $onlyif and $unless {
@ -74,15 +79,16 @@ define openstacklib::service_validation(
}
exec { "execute ${service_name} validation":
path => $path,
provider => $provider,
command => $command,
timeout => $timeout,
tries => $tries,
try_sleep => $try_sleep,
onlyif => $onlyif,
unless => $unless,
logoutput => 'on_failure',
command => $command,
path => $path,
provider => $provider,
refreshonly => $refreshonly,
timeout => $timeout,
tries => $tries,
try_sleep => $try_sleep,
onlyif => $onlyif,
unless => $unless,
logoutput => 'on_failure',
}
anchor { "create ${service_name} anchor":

View File

@ -33,13 +33,14 @@ describe 'openstacklib::service_validation' do
end
it { is_expected.to contain_exec("execute #{title} validation").with(
:path => '/usr/bin:/bin:/usr/sbin:/sbin',
:provider => 'shell',
:command => 'nova list',
:timeout => '60',
:tries => '10',
:try_sleep => '2',
:logoutput => 'on_failure',
:path => '/usr/bin:/bin:/usr/sbin:/sbin',
:provider => 'shell',
:command => 'nova list',
:refreshonly => false,
:timeout => '60',
:tries => '10',
:try_sleep => '2',
:logoutput => 'on_failure',
)}
it { is_expected.to contain_anchor("create #{title} anchor").with(
@ -54,13 +55,14 @@ describe 'openstacklib::service_validation' do
end
it { is_expected.to contain_exec("execute #{title} validation").with(
:path => '/usr/bin:/bin:/usr/sbin:/sbin',
:provider => 'shell',
:command => 'nova list',
:timeout => '60',
:tries => '10',
:try_sleep => '2',
:unless => 'pwd',
:path => '/usr/bin:/bin:/usr/sbin:/sbin',
:provider => 'shell',
:command => 'nova list',
:refreshonly => false,
:timeout => '60',
:tries => '10',
:try_sleep => '2',
:unless => 'pwd',
)}
it { is_expected.to contain_anchor("create #{title} anchor").with(
@ -75,13 +77,14 @@ describe 'openstacklib::service_validation' do
end
it { is_expected.to contain_exec("execute #{title} validation").with(
:path => '/usr/bin:/bin:/usr/sbin:/sbin',
:provider => 'shell',
:command => 'nova list',
:timeout => '60',
:tries => '10',
:try_sleep => '2',
:onlyif => 'pwd',
:path => '/usr/bin:/bin:/usr/sbin:/sbin',
:provider => 'shell',
:command => 'nova list',
:refreshonly => false,
:timeout => '60',
:tries => '10',
:try_sleep => '2',
:onlyif => 'pwd',
)}
it { is_expected.to contain_anchor("create #{title} anchor").with(