Added retries for db_sync
If db sync fails, it is never retried leading to errors. So, this patch adds retries for db_sync to avoid sync fails. Change-Id: I3eb965550b53e7cedffc58fddfc8e8cd96b9859f Closes-Bug: #1628580
This commit is contained in:
parent
748caaf1f0
commit
af276afb5f
|
@ -6,9 +6,8 @@
|
|||
# [*extra_params*]
|
||||
# (optional) String of extra command line parameters to append
|
||||
# to the glare-db-manage command.
|
||||
# Defaults to '--config-file /etc/glare.conf'
|
||||
# Defaults to ''
|
||||
#
|
||||
|
||||
class glare::db::sync(
|
||||
$extra_params = '',
|
||||
) {
|
||||
|
@ -20,6 +19,8 @@ class glare::db::sync(
|
|||
user => 'glare',
|
||||
path => [ '/bin/', '/usr/bin/' , '/usr/local/bin' ],
|
||||
refreshonly => true,
|
||||
try_sleep => 5,
|
||||
tries => 10,
|
||||
subscribe => [
|
||||
Anchor['glare::install::end'],
|
||||
Anchor['glare::config::end'],
|
||||
|
|
|
@ -1,20 +1,62 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'glare::db::sync' do
|
||||
context 'exec has proper name' do
|
||||
it { is_expected.to contain_exec('glare-db-sync') }
|
||||
end
|
||||
|
||||
context 'class sync default command' do
|
||||
it { is_expected.to contain_exec('glare-db-sync').with_command(
|
||||
'glare-db-manage upgrade') }
|
||||
end
|
||||
shared_examples_for 'glare-dbsync' do
|
||||
|
||||
context 'class sync work with parameters' do
|
||||
let :params do
|
||||
{ :extra_params => '-yyy' }
|
||||
it 'runs glare-manage db_sync' do
|
||||
is_expected.to contain_exec('glare-db-sync').with(
|
||||
:command => 'glare-db-manage upgrade',
|
||||
:user => 'glare',
|
||||
:path => ["/bin/","/usr/bin/" ,"/usr/local/bin"],
|
||||
:refreshonly => 'true',
|
||||
:try_sleep => 5,
|
||||
:tries => 10,
|
||||
:subscribe => ['Anchor[glare::install::end]',
|
||||
'Anchor[glare::config::end]',
|
||||
'Anchor[glare::dbsync::begin]'],
|
||||
:notify => 'Anchor[glare::dbsync::end]',
|
||||
)
|
||||
end
|
||||
|
||||
describe "overriding extra_params" do
|
||||
let :params do
|
||||
{
|
||||
:extra_params => '--config-file /etc/glare/glare.conf',
|
||||
}
|
||||
end
|
||||
|
||||
it {
|
||||
is_expected.to contain_exec('glare-db-sync').with(
|
||||
:command => 'glare-db-manage --config-file /etc/glare/glare.conf upgrade',
|
||||
:user => 'glare',
|
||||
:path => ["/bin/","/usr/bin/" ,"/usr/local/bin"],
|
||||
:refreshonly => 'true',
|
||||
:try_sleep => 5,
|
||||
:tries => 10,
|
||||
:subscribe => ['Anchor[glare::install::end]',
|
||||
'Anchor[glare::config::end]',
|
||||
'Anchor[glare::dbsync::begin]'],
|
||||
:notify => 'Anchor[glare::dbsync::end]',
|
||||
)
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge(OSDefaults.get_facts({
|
||||
:os_workers => 8,
|
||||
:concat_basedir => '/var/lib/puppet/concat'
|
||||
}))
|
||||
end
|
||||
|
||||
it_configures 'glare-dbsync'
|
||||
end
|
||||
it { is_expected.to contain_exec('glare-db-sync').with_command('glare-db-manage -yyy upgrade') }
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue