From 82a32eaee054a80bc9874b006911a9bb0056c99a Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Tue, 4 Feb 2014 15:04:28 +0100 Subject: [PATCH] add path for grep command Signed-off-by: Emilien Macchi --- manifests/compute.pp | 2 +- manifests/identity.pp | 2 +- manifests/network/controller.pp | 2 +- manifests/orchestration.pp | 2 +- manifests/volume.pp | 2 +- spec/classes/cloud_compute_controller_spec.rb | 7 +++++++ spec/classes/cloud_compute_hypervisor_spec.rb | 7 +++++++ spec/classes/cloud_identity_spec.rb | 7 +++++++ spec/classes/cloud_image_spec.rb | 2 +- spec/classes/cloud_network_controller_spec.rb | 8 ++++++++ spec/classes/cloud_orchestration_api_spec.rb | 7 +++++++ spec/classes/cloud_volume_controller_spec.rb | 7 +++++++ spec/classes/cloud_volume_storage_spec.rb | 7 +++++++ 13 files changed, 56 insertions(+), 6 deletions(-) diff --git a/manifests/compute.pp b/manifests/compute.pp index f780496b..9ed72562 100644 --- a/manifests/compute.pp +++ b/manifests/compute.pp @@ -96,7 +96,7 @@ class cloud::compute( # It's a hack to fit with our setup where we run MySQL/Galera exec {'nova_db_sync': command => '/usr/bin/nova-manage db sync', - unless => "/usr/bin/mysql nova -h ${nova_db_host} -u ${encoded_user} -p${encoded_password} -e \"show tables\" | grep Tables" + unless => "/usr/bin/mysql nova -h ${nova_db_host} -u ${encoded_user} -p${encoded_password} -e \"show tables\" | /bin/grep Tables" } } diff --git a/manifests/identity.pp b/manifests/identity.pp index 69c361a2..63e5828c 100644 --- a/manifests/identity.pp +++ b/manifests/identity.pp @@ -530,7 +530,7 @@ class cloud::identity ( # It's a hack to fit with our setup where we run MySQL/Galera exec {'keystone_db_sync': command => '/usr/bin/keystone-manage db_sync', - unless => "/usr/bin/mysql keystone -h ${keystone_db_host} -u ${encoded_user} -p${encoded_password} -e \"show tables\" | grep Tables" + unless => "/usr/bin/mysql keystone -h ${keystone_db_host} -u ${encoded_user} -p${encoded_password} -e \"show tables\" | /bin/grep Tables" } @@haproxy::balancermember{"${::fqdn}-keystone_api": diff --git a/manifests/network/controller.pp b/manifests/network/controller.pp index 9424d3d9..f973965b 100644 --- a/manifests/network/controller.pp +++ b/manifests/network/controller.pp @@ -50,7 +50,7 @@ class cloud::network::controller( # It's a hack to fit with our setup where we run MySQL/Galera exec {'neutron_db_sync': command => '/usr/bin/neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head', - unless => "/usr/bin/mysql neutron -h ${neutron_db_host} -u ${encoded_user} -p${encoded_password} -e \"show tables\" | grep Tables" + unless => "/usr/bin/mysql neutron -h ${neutron_db_host} -u ${encoded_user} -p${encoded_password} -e \"show tables\" | /bin/grep Tables" } @@haproxy::balancermember{"${::fqdn}-neutron_api": diff --git a/manifests/orchestration.pp b/manifests/orchestration.pp index da578f5c..682ec6d8 100644 --- a/manifests/orchestration.pp +++ b/manifests/orchestration.pp @@ -57,7 +57,7 @@ class cloud::orchestration( # It's a hack to fit with our setup where we run MySQL/Galera exec {'heat_db_sync': command => '/usr/bin/heat-manage --config-file /etc/heat/heat.conf db_sync', - unless => "/usr/bin/mysql heat -h ${heat_db_host} -u ${encoded_user} -p${encoded_password} -e \"show tables\" | grep Tables" + unless => "/usr/bin/mysql heat -h ${heat_db_host} -u ${encoded_user} -p${encoded_password} -e \"show tables\" | /bin/grep Tables" } } diff --git a/manifests/volume.pp b/manifests/volume.pp index 93fc5375..39a709a9 100644 --- a/manifests/volume.pp +++ b/manifests/volume.pp @@ -51,7 +51,7 @@ class cloud::volume( # It's a hack to fit with our setup where we run MySQL/Galera exec {'cinder_db_sync': command => '/usr/bin/cinder-manage db sync', - unless => "/usr/bin/mysql cinder -h ${cinder_db_host} -u ${encoded_user} -p${encoded_password} -e \"show tables\" | grep Tables" + unless => "/usr/bin/mysql cinder -h ${cinder_db_host} -u ${encoded_user} -p${encoded_password} -e \"show tables\" | /bin/grep Tables" } } diff --git a/spec/classes/cloud_compute_controller_spec.rb b/spec/classes/cloud_compute_controller_spec.rb index b656c6c5..73ca45c0 100644 --- a/spec/classes/cloud_compute_controller_spec.rb +++ b/spec/classes/cloud_compute_controller_spec.rb @@ -60,6 +60,13 @@ describe 'cloud::compute::controller' do should contain_nova_config('DEFAULT/resume_guests_state_on_host_boot').with('value' => true) end + it 'checks if Nova DB is populated' do + should contain_exec('nova_db_sync').with( + :command => '/usr/bin/nova-manage db sync', + :unless => '/usr/bin/mysql nova -h 10.0.0.1 -u nova -psecrete -e "show tables" | /bin/grep Tables' + ) + end + it 'configure nova-scheduler' do should contain_class('nova::scheduler').with(:enabled => true) end diff --git a/spec/classes/cloud_compute_hypervisor_spec.rb b/spec/classes/cloud_compute_hypervisor_spec.rb index 94d26c86..ba24e17b 100644 --- a/spec/classes/cloud_compute_hypervisor_spec.rb +++ b/spec/classes/cloud_compute_hypervisor_spec.rb @@ -59,6 +59,13 @@ describe 'cloud::compute::hypervisor' do should contain_nova_config('DEFAULT/resume_guests_state_on_host_boot').with('value' => true) end + it 'checks if Nova DB is populated' do + should contain_exec('nova_db_sync').with( + :command => '/usr/bin/nova-manage db sync', + :unless => '/usr/bin/mysql nova -h 10.0.0.1 -u nova -psecrete -e "show tables" | /bin/grep Tables' + ) + end + it 'insert and activate nbd module' do should contain_exec('insert_module_nbd').with('command' => '/bin/echo "nbd" > /etc/modules', 'unless' => '/bin/grep "nbd" /etc/modules') should contain_exec('/sbin/modprobe nbd').with('unless' => '/bin/grep -q "^nbd " "/proc/modules"') diff --git a/spec/classes/cloud_identity_spec.rb b/spec/classes/cloud_identity_spec.rb index 1c8536a3..f8f5f42b 100644 --- a/spec/classes/cloud_identity_spec.rb +++ b/spec/classes/cloud_identity_spec.rb @@ -110,6 +110,13 @@ describe 'cloud::identity' do should contain_keystone_config('ec2/driver').with('value' => 'keystone.contrib.ec2.backends.sql.Ec2') end + it 'checks if Keystone DB is populated' do + should contain_exec('keystone_db_sync').with( + :command => '/usr/bin/keystone-manage db_sync', + :unless => '/usr/bin/mysql keystone -h 10.0.0.1 -u keystone -psecrete -e "show tables" | /bin/grep Tables' + ) + end + it 'configure keystone admin role' do should contain_class('keystone::roles::admin').with( :email => 'admin@openstack.org', diff --git a/spec/classes/cloud_image_spec.rb b/spec/classes/cloud_image_spec.rb index de8a4623..1d9d1833 100644 --- a/spec/classes/cloud_image_spec.rb +++ b/spec/classes/cloud_image_spec.rb @@ -98,7 +98,7 @@ describe 'cloud::image' do it 'checks if Glance DB is populated' do should contain_exec('glance_db_sync').with( :command => '/usr/bin/glance-manage db_sync', - :unless => '/usr/bin/mysql glance -e "show tables" | /bin/grep Tables' + :unless => '/usr/bin/mysql glance -h 10.0.0.1 -u glance -psecrete -e "show tables" | /bin/grep Tables' ) end end diff --git a/spec/classes/cloud_network_controller_spec.rb b/spec/classes/cloud_network_controller_spec.rb index 71322b2a..7c6886e0 100644 --- a/spec/classes/cloud_network_controller_spec.rb +++ b/spec/classes/cloud_network_controller_spec.rb @@ -80,6 +80,14 @@ describe 'cloud::network::controller' do :api_workers => '2' ) end + + it 'checks if Neutron DB is populated' do + should contain_exec('neutron_db_sync').with( + :command => '/usr/bin/neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head', + :unless => '/usr/bin/mysql neutron -h 10.0.0.1 -u neutron -psecrete -e "show tables" | /bin/grep Tables' + ) + end + end context 'on Debian platforms' do diff --git a/spec/classes/cloud_orchestration_api_spec.rb b/spec/classes/cloud_orchestration_api_spec.rb index e4cc23fe..12c8ae15 100644 --- a/spec/classes/cloud_orchestration_api_spec.rb +++ b/spec/classes/cloud_orchestration_api_spec.rb @@ -80,6 +80,13 @@ describe 'cloud::orchestration::api' do ) end + it 'checks if Heat DB is populated' do + should contain_exec('heat_db_sync').with( + :command => '/usr/bin/heat-manage --config-file /etc/heat/heat.conf db_sync', + :unless => '/usr/bin/mysql heat -h 10.0.0.1 -u heat -psecrete -e "show tables" | /bin/grep Tables' + ) + end + end context 'on Debian platforms' do diff --git a/spec/classes/cloud_volume_controller_spec.rb b/spec/classes/cloud_volume_controller_spec.rb index c3b7d748..bb96106e 100644 --- a/spec/classes/cloud_volume_controller_spec.rb +++ b/spec/classes/cloud_volume_controller_spec.rb @@ -60,6 +60,13 @@ describe 'cloud::volume::controller' do should contain_class('cinder::ceilometer') end + it 'checks if Cinder DB is populated' do + should contain_exec('cinder_db_sync').with( + :command => '/usr/bin/cinder-manage db sync', + :unless => '/usr/bin/mysql cinder -h 10.0.0.1 -u cinder -psecrete -e "show tables" | /bin/grep Tables' + ) + end + it 'configure cinder scheduler' do should contain_class('cinder::scheduler') end diff --git a/spec/classes/cloud_volume_storage_spec.rb b/spec/classes/cloud_volume_storage_spec.rb index dc5bde48..d86ab186 100644 --- a/spec/classes/cloud_volume_storage_spec.rb +++ b/spec/classes/cloud_volume_storage_spec.rb @@ -58,6 +58,13 @@ describe 'cloud::volume::storage' do end + it 'checks if Cinder DB is populated' do + should contain_exec('cinder_db_sync').with( + :command => '/usr/bin/cinder-manage db sync', + :unless => '/usr/bin/mysql cinder -h 10.0.0.1 -u cinder -psecrete -e "show tables" | /bin/grep Tables' + ) + end + it 'configure cinder volume with rbd backend' do should include_class('cinder::volume')