diff --git a/deployment_scripts/puppet/manifests/midonet-disable-services.pp b/deployment_scripts/puppet/manifests/midonet-disable-services.pp index 78f477e..8db00aa 100644 --- a/deployment_scripts/puppet/manifests/midonet-disable-services.pp +++ b/deployment_scripts/puppet/manifests/midonet-disable-services.pp @@ -36,11 +36,13 @@ if member($roles, 'primary-controller') { } -> exec {'stop-l3-agent': command => 'crm resource stop p_neutron-l3-agent', - path => '/usr/bin:/usr/sbin' + path => '/usr/bin:/usr/sbin', + onlyif => 'crm resource status p_neutron-l3-agent' } -> exec {'delete-l3-agent': command => 'crm configure delete p_neutron-l3-agent', - path => '/usr/bin:/usr/sbin' + path => '/usr/bin:/usr/sbin', + onlyif => 'crm resource status p_neutron-l3-agent' } } else { service {$ovs_agent_name: diff --git a/deployment_scripts/puppet/manifests/midonet-recreate-neutron-db.pp b/deployment_scripts/puppet/manifests/midonet-recreate-neutron-db.pp index f3f2402..afe5322 100644 --- a/deployment_scripts/puppet/manifests/midonet-recreate-neutron-db.pp +++ b/deployment_scripts/puppet/manifests/midonet-recreate-neutron-db.pp @@ -1,21 +1,25 @@ exec { 'drop_neutron_db': command => "mysql -e 'drop database if exists neutron;'", path => '/usr/bin', + unless => 'mysql neutron -e "SELECT * FROM alembic_version_midonet LIMIT 1;"' } exec { 'create_neutron_db': command => "mysql -e 'create database neutron character set utf8;'", path => '/usr/bin', + unless => 'mysql neutron -e "SELECT * FROM alembic_version_midonet LIMIT 1;"' } exec { 'grant_neutron_db': command => "mysql -e \"grant all on neutron.* to 'neutron'@'%';\"", path => '/usr/bin', + unless => 'mysql neutron -e "SELECT * FROM alembic_version_midonet LIMIT 1;"' } exec { 'neutron_db_sync': command => 'neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugin.ini upgrade head', path => '/usr/bin', + unless => 'mysql neutron -e "SELECT * FROM alembic_version_midonet LIMIT 1;"' timeout => 500, }