Add sync_db option to glare init class

This will allow to manage db sync from init class.

Change-Id: I88f32bd9fe2e9cd168f03ec4a81aa5d572ee993a
This commit is contained in:
Mykyta Karpin 2017-04-06 18:30:08 +03:00
parent abbf6d8347
commit 14f6c92538
2 changed files with 24 additions and 6 deletions

View File

@ -95,6 +95,10 @@
# in the glare config.
# Defaults to false.
#
# [*sync_db*]
# (Optional) Run db sync on the node.
# Defaults to true
#
class glare (
$package_ensure = 'present',
$bind_host = $::os_service_default,
@ -114,6 +118,7 @@ class glare (
$os_region_name = 'RegionOne',
$allow_anonymous_access = $::os_service_default,
$purge_config = false,
$sync_db = true,
) {
include ::glare::params
@ -121,6 +126,10 @@ class glare (
include ::glare::logging
include ::glare::deps
if $sync_db {
include ::glare::db::sync
}
ensure_packages ( 'glare' , {
ensure => $package_ensure,
name => $::glare::params::glare_package_name,

View File

@ -1,17 +1,16 @@
require 'spec_helper'
describe 'glare' do
let :pre_condition do
"class { '::glare::keystone::authtoken':
password => 'ChangeMe' }"
end
shared_examples 'glare' do
context 'with default parameters' do
let :params do
{ :purge_config => false }
end
let :pre_condition do
"class { '::glare::keystone::authtoken':
password => 'ChangeMe' }"
{ :purge_config => false }
end
it 'contains the params class' do
@ -43,6 +42,8 @@ describe 'glare' do
it { is_expected.to contain_glare_config('DEFAULT/bind_port').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_glare_config('DEFAULT/backlog').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_class('glare::db::sync') }
it 'configures storage' do
is_expected.to contain_glare_config('glance_store/os_region_name').with_value('RegionOne')
is_expected.to contain_glare_config('glance_store/stores').with_value('<SERVICE DEFAULT>')
@ -68,6 +69,14 @@ describe 'glare' do
'enable' => true,
) }
end
context 'with db sync disabled' do
let :params do
{ :sync_db => false }
end
it { is_expected.not_to contain_class('glare::db::sync') }
end
end
on_supported_os({