Create a sync_db boolean for Glance.
Other components offer the option to decide whether or not to run the db sync command. Glance was missing this feature. This commit add this feature for Glance. Change-Id: Iec31d724370a40aee56ead5839ef47ceacf7223d
This commit is contained in:
parent
101ca5b088
commit
ab054853e1
@ -115,6 +115,10 @@
|
||||
# (optional) CA certificate file to use to verify connecting clients
|
||||
# Defaults to false, not set
|
||||
#
|
||||
# [*sync_db*]
|
||||
# (Optional) Run db sync on the node.
|
||||
# Defaults to true
|
||||
#
|
||||
# [*mysql_module*]
|
||||
# (optional) Deprecated. Does nothing.
|
||||
#
|
||||
@ -143,6 +147,7 @@ class glance::registry(
|
||||
$cert_file = false,
|
||||
$key_file = false,
|
||||
$ca_file = false,
|
||||
$sync_db = true,
|
||||
# DEPRECATED PARAMETERS
|
||||
$mysql_module = undef,
|
||||
$auth_host = '127.0.0.1',
|
||||
@ -354,15 +359,17 @@ class glance::registry(
|
||||
|
||||
if $manage_service {
|
||||
if $enabled {
|
||||
Exec['glance-manage db_sync'] ~> Service['glance-registry']
|
||||
if $sync_db {
|
||||
Exec['glance-manage db_sync'] ~> Service['glance-registry']
|
||||
|
||||
exec { 'glance-manage db_sync':
|
||||
command => $::glance::params::db_sync_command,
|
||||
path => '/usr/bin',
|
||||
user => 'glance',
|
||||
refreshonly => true,
|
||||
logoutput => on_failure,
|
||||
subscribe => [Package[$glance::params::registry_package_name], File['/etc/glance/glance-registry.conf']],
|
||||
exec { 'glance-manage db_sync':
|
||||
command => $::glance::params::db_sync_command,
|
||||
path => '/usr/bin',
|
||||
user => 'glance',
|
||||
refreshonly => true,
|
||||
logoutput => on_failure,
|
||||
subscribe => [Package[$glance::params::registry_package_name], File['/etc/glance/glance-registry.conf']],
|
||||
}
|
||||
}
|
||||
$service_ensure = 'running'
|
||||
} else {
|
||||
|
@ -28,6 +28,7 @@ describe 'glance::registry' do
|
||||
:keystone_user => 'glance',
|
||||
:keystone_password => 'ChangeMe',
|
||||
:purge_config => false,
|
||||
:sync_db => true,
|
||||
}
|
||||
end
|
||||
|
||||
@ -49,6 +50,7 @@ describe 'glance::registry' do
|
||||
:keystone_tenant => 'admin',
|
||||
:keystone_user => 'admin',
|
||||
:keystone_password => 'ChangeMe',
|
||||
:sync_db => false,
|
||||
}
|
||||
].each do |param_set|
|
||||
|
||||
@ -74,7 +76,7 @@ describe 'glance::registry' do
|
||||
|
||||
it 'is_expected.to only sync the db if the service is enabled' do
|
||||
|
||||
if param_hash[:enabled]
|
||||
if param_hash[:enabled] and param_hash[:sync_db]
|
||||
is_expected.to contain_exec('glance-manage db_sync').with(
|
||||
'path' => '/usr/bin',
|
||||
'command' => 'glance-manage --config-file=/etc/glance/glance-registry.conf db_sync',
|
||||
@ -85,6 +87,12 @@ describe 'glance::registry' do
|
||||
)
|
||||
end
|
||||
end
|
||||
it 'is_expected.to not sync the db if sync_db is set to false' do
|
||||
|
||||
if param_hash[:enabled] and !param_hash[:sync_db]
|
||||
is_expected.not_to contain_exec('glance-manage db_sync')
|
||||
end
|
||||
end
|
||||
it 'is_expected.to configure itself' do
|
||||
[
|
||||
'verbose',
|
||||
|
Loading…
Reference in New Issue
Block a user