puppet-heat/manifests/db.pp
Emilien Macchi 03ef6a7b7f Update the module for new config file method
Since we have now an only config file (heat.conf) with this patch:
https://review.openstack.org/#/c/36476/

This patch updates the module and delete old configuration files
support and add a test.

Also, I fixed some tab issues in manifests.
Fix bug #1207858

Change-Id: If3d044e2581156fa5ce4de19f5c740328efa0aa8
2013-08-06 23:28:31 +02:00

47 lines
1.1 KiB
Puppet

# Configures the heat database
# This class will install the required libraries depending on the driver
# specified in the connection_string parameter
#
# == Parameters
# [*database_connection*]
# the connection string. format: [driver]://[user]:[password]@[host]/[database]
#
class heat::db (
$sql_connection = 'mysql://heat:heat@localhost/heat'
) {
include heat::params
Package<| title == 'heat-common' |> -> Class['heat::db']
validate_re($sql_connection,
'(sqlite|mysql|posgres):\/\/(\S+:\S+@\S+\/\S+)?')
case $sql_connection {
/^mysql:\/\//: {
$backend_package = false
include mysql::python
}
/^postgres:\/\//: {
$backend_package = 'python-psycopg2'
}
/^sqlite:\/\//: {
$backend_package = 'python-pysqlite2'
}
default: {
fail('Unsupported backend configured')
}
}
if $backend_package and !defined(Package[$backend_package]) {
package {'heat-backend-package':
ensure => present,
name => $backend_package,
}
}
heat_config {
'DEFAULT/sql_connection': value => $sql_connection;
}
}