From 4c065a9696d3f2bc938b3f524c8ec8397e524d27 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Mon, 3 Feb 2014 19:07:49 +0100 Subject: [PATCH] image: Ensure Glance DB is populated With an exec, we check that Glance database is populated with tables, otherwise we do it "by hand". This is an hack because we use Galera + HAproxy, which would not appear in a simple use-case (with mysql on single node only). Close #142 Signed-off-by: Emilien Macchi --- manifests/image.pp | 5 ++--- spec/classes/cloud_image_spec.rb | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/manifests/image.pp b/manifests/image.pp index 89897310..3ec21252 100644 --- a/manifests/image.pp +++ b/manifests/image.pp @@ -130,9 +130,8 @@ class cloud::image( # 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' + command => '/usr/bin/glance-manage db_sync', + unless => '/usr/bin/mysql glance -e "show tables" | /bin/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 diff --git a/spec/classes/cloud_image_spec.rb b/spec/classes/cloud_image_spec.rb index 162d931d..de8a4623 100644 --- a/spec/classes/cloud_image_spec.rb +++ b/spec/classes/cloud_image_spec.rb @@ -97,9 +97,8 @@ describe 'cloud::image' do 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' + :command => '/usr/bin/glance-manage db_sync', + :unless => '/usr/bin/mysql glance -e "show tables" | /bin/grep Tables' ) end end