db: Added postgresql backend using openstacklib helper
Standardize heat module, and add postgresql backend. Change-Id: I6f5479008f1fc82329e802a5204576e26f0e80d7 Implements: blueprint commmon-openstack-database-resource
This commit is contained in:
parent
50ae53a95b
commit
2aad2eba46
@ -1,12 +1,14 @@
|
|||||||
fixtures:
|
fixtures:
|
||||||
repositories:
|
repositories:
|
||||||
"inifile": "git://github.com/puppetlabs/puppetlabs-inifile"
|
"inifile": "git://github.com/puppetlabs/puppetlabs-inifile"
|
||||||
|
'concat': 'git://github.com/puppetlabs/puppetlabs-concat.git'
|
||||||
"keystone": "git://github.com/stackforge/puppet-keystone.git"
|
"keystone": "git://github.com/stackforge/puppet-keystone.git"
|
||||||
"mysql":
|
"mysql":
|
||||||
repo: 'git://github.com/puppetlabs/puppetlabs-mysql.git'
|
repo: 'git://github.com/puppetlabs/puppetlabs-mysql.git'
|
||||||
ref: 'origin/2.2.x'
|
ref: 'origin/2.2.x'
|
||||||
"nova": "git://github.com/stackforge/puppet-nova.git"
|
"nova": "git://github.com/stackforge/puppet-nova.git"
|
||||||
'openstacklib': 'git://github.com/stackforge/puppet-openstacklib.git'
|
'openstacklib': 'git://github.com/stackforge/puppet-openstacklib.git'
|
||||||
|
'postgresql': 'git://github.com/puppetlabs/puppet-postgresql.git'
|
||||||
"stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git"
|
"stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git"
|
||||||
symlinks:
|
symlinks:
|
||||||
"heat": "#{source_dir}"
|
"heat": "#{source_dir}"
|
||||||
|
45
manifests/db/postgresql.pp
Normal file
45
manifests/db/postgresql.pp
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
# == Class: heat::db::postgresql
|
||||||
|
#
|
||||||
|
# Class that configures postgresql for heat
|
||||||
|
# Requires the Puppetlabs postgresql module.
|
||||||
|
#
|
||||||
|
# === Parameters
|
||||||
|
#
|
||||||
|
# [*password*]
|
||||||
|
# (Required) Password to connect to the database.
|
||||||
|
#
|
||||||
|
# [*dbname*]
|
||||||
|
# (Optional) Name of the database.
|
||||||
|
# Defaults to 'heat'.
|
||||||
|
#
|
||||||
|
# [*user*]
|
||||||
|
# (Optional) User to connect to the database.
|
||||||
|
# Defaults to 'heat'.
|
||||||
|
#
|
||||||
|
# [*encoding*]
|
||||||
|
# (Optional) The charset to use for the database.
|
||||||
|
# Default to undef.
|
||||||
|
#
|
||||||
|
# [*privileges*]
|
||||||
|
# (Optional) Privileges given to the database user.
|
||||||
|
# Default to 'ALL'
|
||||||
|
#
|
||||||
|
class heat::db::postgresql(
|
||||||
|
$password,
|
||||||
|
$dbname = 'heat',
|
||||||
|
$user = 'heat',
|
||||||
|
$encoding = undef,
|
||||||
|
$privileges = 'ALL',
|
||||||
|
) {
|
||||||
|
|
||||||
|
::openstacklib::db::postgresql { 'heat':
|
||||||
|
password_hash => postgresql_password($user, $password),
|
||||||
|
dbname => $dbname,
|
||||||
|
user => $user,
|
||||||
|
encoding => $encoding,
|
||||||
|
privileges => $privileges,
|
||||||
|
}
|
||||||
|
|
||||||
|
::Openstacklib::Db::Postgresql['heat'] ~> Exec<| title == 'heat-dbsync' |>
|
||||||
|
|
||||||
|
}
|
58
spec/classes/heat_db_postgresql_spec.rb
Normal file
58
spec/classes/heat_db_postgresql_spec.rb
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe 'heat::db::postgresql' do
|
||||||
|
|
||||||
|
let :req_params do
|
||||||
|
{ :password => 'pw' }
|
||||||
|
end
|
||||||
|
|
||||||
|
let :pre_condition do
|
||||||
|
'include postgresql::server'
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'on a RedHat osfamily' do
|
||||||
|
let :facts do
|
||||||
|
{
|
||||||
|
:osfamily => 'RedHat',
|
||||||
|
:operatingsystemrelease => '7.0',
|
||||||
|
:concat_basedir => '/var/lib/puppet/concat'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with only required parameters' do
|
||||||
|
let :params do
|
||||||
|
req_params
|
||||||
|
end
|
||||||
|
|
||||||
|
it { should contain_postgresql__server__db('heat').with(
|
||||||
|
:user => 'heat',
|
||||||
|
:password => 'md5fd5c4fca491370aab732f903e2fb7c99'
|
||||||
|
)}
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'on a Debian osfamily' do
|
||||||
|
let :facts do
|
||||||
|
{
|
||||||
|
:operatingsystemrelease => '7.8',
|
||||||
|
:operatingsystem => 'Debian',
|
||||||
|
:osfamily => 'Debian',
|
||||||
|
:concat_basedir => '/var/lib/puppet/concat'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with only required parameters' do
|
||||||
|
let :params do
|
||||||
|
req_params
|
||||||
|
end
|
||||||
|
|
||||||
|
it { should contain_postgresql__server__db('heat').with(
|
||||||
|
:user => 'heat',
|
||||||
|
:password => 'md5fd5c4fca491370aab732f903e2fb7c99'
|
||||||
|
)}
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user