Refactor heat_db_sync
This commit is contained in:
parent
68b085cfe2
commit
e83322a8f9
@ -35,25 +35,25 @@ class heat::db (
|
|||||||
'DEFAULT/sql_connection': value => $sql_connection;
|
'DEFAULT/sql_connection': value => $sql_connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
exec { 'db_sync' :
|
file { 'db_sync_script' :
|
||||||
command => $db_sync_command,
|
ensure => present,
|
||||||
path => '/usr/bin',
|
path => $::heat::params::heat_db_sync_command,
|
||||||
user => 'heat',
|
owner => 'root',
|
||||||
refreshonly => true,
|
group => 'root',
|
||||||
logoutput => on_failure,
|
mode => '0755',
|
||||||
onlyif => "test -f $db_sync_command",
|
content => template('heat/heat_db_sync.sh.erb'),
|
||||||
subscribe => [Package['heat-engine'], Package['heat-api'],],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Lagacy part - support old rpms before 2013.2.xx without heat-manage tool
|
exec { 'heat_db_sync' :
|
||||||
exec { 'legacy_db_sync' :
|
command => $::heat::params::heat_db_sync_command,
|
||||||
command => $legacy_db_sync_command,
|
path => [ '/bin', '/sbin', '/usr/bin', '/usr/sbin', '/usr/local/bin', '/usr/local/sbin' ],
|
||||||
path => '/usr/bin',
|
|
||||||
user => 'heat',
|
user => 'heat',
|
||||||
refreshonly => true,
|
refreshonly => true,
|
||||||
logoutput => on_failure,
|
logoutput => 'on_failure',
|
||||||
unless => "test -f $db_sync_command",
|
|
||||||
subscribe => [Package['heat-engine'], Package['heat-api'],],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File['db_sync_script'] ~> Exec['heat_db_sync']
|
||||||
|
Package['heat-engine'] ~> Exec['heat_db_sync']
|
||||||
|
Package['heat-api'] ~> Exec['heat_db_sync']
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,6 @@ class heat::db::mysql(
|
|||||||
grant => ['all'],
|
grant => ['all'],
|
||||||
}
|
}
|
||||||
|
|
||||||
Class['mysql::server'] -> Mysql::Db[$dbname]
|
Class['mysql::server'] -> Mysql::Db[$dbname] ~> Exec['heat_db_sync']
|
||||||
Mysql::Db[$dbname] ~> Exec['db_sync']
|
|
||||||
Mysql::Db[$dbname] ~> Exec['legacy_db_sync']
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,5 +19,6 @@ class heat::params {
|
|||||||
|
|
||||||
$db_sync_command = '/usr/bin/heat-manage db_sync'
|
$db_sync_command = '/usr/bin/heat-manage db_sync'
|
||||||
$legacy_db_sync_command = '/usr/bin/python -m heat.db.sync'
|
$legacy_db_sync_command = '/usr/bin/python -m heat.db.sync'
|
||||||
|
$heat_db_sync_command = '/usr/local/bin/heat_db_sync'
|
||||||
|
|
||||||
}
|
}
|
||||||
|
7
deployment/puppet/heat/templates/heat_db_sync.sh.erb
Normal file
7
deployment/puppet/heat/templates/heat_db_sync.sh.erb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ -f "/usr/bin/heat-manage" ]; then
|
||||||
|
/usr/bin/heat-manage db_sync
|
||||||
|
else
|
||||||
|
/usr/bin/python -m heat.db.sync
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user