Support db schema upgrade
The rally db command provides the separate upgrade subcommand to upgrade schema of existing database. This change provides the option to use the upgrade command instead of the create command so that users can use the sync class for schema upgrade. Change-Id: I778381879c9aa6c790423262c90142a6b383c252
This commit is contained in:
parent
16a35f2fc6
commit
399172e192
|
@ -13,15 +13,27 @@
|
|||
# (Optional) Timeout for the execution of the db_sync
|
||||
# Defaults to 300
|
||||
#
|
||||
# [*upgrade*]
|
||||
# (Optional) Run rally db upgrade command instead of rally db create command.
|
||||
# Defaults to false
|
||||
#
|
||||
class rally::db::sync(
|
||||
$extra_params = '--config-file /etc/rally/rally.conf',
|
||||
$db_sync_timeout = 300,
|
||||
$upgrade = false,
|
||||
) {
|
||||
|
||||
include rally::deps
|
||||
|
||||
validate_legacy(Boolean, 'validate_bool', $upgrade)
|
||||
|
||||
$subcommand = $upgrade ? {
|
||||
true => 'upgrade',
|
||||
default => 'create'
|
||||
}
|
||||
|
||||
exec { 'rally db_sync':
|
||||
command => "rally ${extra_params} db create",
|
||||
command => "rally ${extra_params} db ${subcommand}",
|
||||
path => '/usr/bin',
|
||||
user => 'root',
|
||||
refreshonly => true,
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
features:
|
||||
- |
|
||||
The new ``rally::db::sync::upgrade`` parameter has been added. When this
|
||||
parameter is set to ``true``, ``rally db upgrade`` command is executed
|
||||
instead of ``rally db create`` command.
|
|
@ -50,6 +50,32 @@ describe 'rally::db::sync' do
|
|||
)
|
||||
}
|
||||
end
|
||||
|
||||
context "upgrade enabled" do
|
||||
let :params do
|
||||
{
|
||||
:upgrade => true
|
||||
}
|
||||
end
|
||||
|
||||
it {
|
||||
is_expected.to contain_exec('rally db_sync').with(
|
||||
:command => 'rally --config-file /etc/rally/rally.conf db upgrade',
|
||||
:user => 'root',
|
||||
:path => '/usr/bin',
|
||||
:refreshonly => 'true',
|
||||
:try_sleep => 5,
|
||||
:tries => 10,
|
||||
:timeout => 300,
|
||||
:logoutput => 'on_failure',
|
||||
:subscribe => ['Anchor[rally::install::end]',
|
||||
'Anchor[rally::config::end]',
|
||||
'Anchor[rally::dbsync::begin]'],
|
||||
:notify => 'Anchor[rally::dbsync::end]',
|
||||
:tag => 'openstack-db',
|
||||
)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
|
|
Loading…
Reference in New Issue