diff --git a/manifests/image.pp b/manifests/image.pp index aa7d1cb4..89897310 100644 --- a/manifests/image.pp +++ b/manifests/image.pp @@ -126,6 +126,15 @@ class cloud::image( class { 'glance::cache::cleaner': } class { 'glance::cache::pruner': } + # Note(EmilienM): + # We check if DB tables are created, if not we populate Glance DB. + # It's a hack to fit with our setup where we run MySQL/Galera + exec {'glance_db_sync': + command => 'glance-manage db_sync', + path => '/usr/bin', + unless => 'mysql glance -e "show tables" | grep Tables' + } + # TODO(EmilienM) For later, I'll also add internal network support in HAproxy for all OpenStack API, to optimize North / South network traffic @@haproxy::balancermember{"${::fqdn}-glance_api": listening_service => 'glance_api_cluster', diff --git a/spec/classes/cloud_image_spec.rb b/spec/classes/cloud_image_spec.rb index 9dce90f0..162d931d 100644 --- a/spec/classes/cloud_image_spec.rb +++ b/spec/classes/cloud_image_spec.rb @@ -95,6 +95,13 @@ describe 'cloud::image' do should contain_class('glance::cache::pruner') end + it 'checks if Glance DB is populated' do + should contain_exec('glance_db_sync').with( + :command => 'glance-manage db_sync', + :path => '/usr/bin', + :unless => 'mysql glance -e "show tables" | grep Tables' + ) + end end context 'on Debian platforms' do