Allow customization of db sync command line
Add parameter to glance::db::sync class to allow end users to add command line parameters to the db sync command. Change-Id: I043dd9560f7d5eb7bc18721e759e5f61186f5cf7 Partial-bug: #1472740
This commit is contained in:
parent
8a3981a43a
commit
9babb26d31
@ -1,7 +1,17 @@
|
|||||||
#
|
#
|
||||||
# Class to execute glance dbsync
|
# Class to execute glance dbsync
|
||||||
#
|
#
|
||||||
class glance::db::sync {
|
# == Parameters
|
||||||
|
#
|
||||||
|
# [*extra_params*]
|
||||||
|
# (optional) String of extra command line parameters to append
|
||||||
|
# to the glance-manage db sync command. These will be inserted
|
||||||
|
# in the command line between 'glance-manage' and 'db sync'.
|
||||||
|
# Defaults to undef
|
||||||
|
#
|
||||||
|
class glance::db::sync(
|
||||||
|
$extra_params = undef,
|
||||||
|
) {
|
||||||
|
|
||||||
include ::glance::params
|
include ::glance::params
|
||||||
|
|
||||||
@ -13,7 +23,7 @@ class glance::db::sync {
|
|||||||
Glance_cache_config<||> ~> Exec['glance-manage db_sync']
|
Glance_cache_config<||> ~> Exec['glance-manage db_sync']
|
||||||
|
|
||||||
exec { 'glance-manage db_sync':
|
exec { 'glance-manage db_sync':
|
||||||
command => $::glance::params::db_sync_command,
|
command => "glance-manage ${extra_params} db_sync",
|
||||||
path => '/usr/bin',
|
path => '/usr/bin',
|
||||||
user => 'glance',
|
user => 'glance',
|
||||||
refreshonly => true,
|
refreshonly => true,
|
||||||
|
@ -6,7 +6,7 @@ describe 'glance::db::sync' do
|
|||||||
|
|
||||||
it 'runs glance-manage db_sync' do
|
it 'runs glance-manage db_sync' do
|
||||||
is_expected.to contain_exec('glance-manage db_sync').with(
|
is_expected.to contain_exec('glance-manage db_sync').with(
|
||||||
:command => 'glance-manage --config-file=/etc/glance/glance-registry.conf db_sync',
|
:command => 'glance-manage db_sync',
|
||||||
:path => '/usr/bin',
|
:path => '/usr/bin',
|
||||||
:user => 'glance',
|
:user => 'glance',
|
||||||
:refreshonly => 'true',
|
:refreshonly => 'true',
|
||||||
@ -14,6 +14,24 @@ describe 'glance::db::sync' do
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "overriding extra_params" do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:extra_params => '--config-file /etc/glance/glance.conf',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it {is_expected.to contain_exec('glance-manage db_sync').with(
|
||||||
|
:command => 'glance-manage --config-file /etc/glance/glance.conf db_sync',
|
||||||
|
:path => '/usr/bin',
|
||||||
|
:user => 'glance',
|
||||||
|
:refreshonly => 'true',
|
||||||
|
:logoutput => 'on_failure'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'on a RedHat osfamily' do
|
context 'on a RedHat osfamily' do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user