Merge "Migrate postgresql backend to use openstacklib::db::postgresql"

This commit is contained in:
Jenkins 2015-01-11 23:54:03 +00:00 committed by Gerrit Code Review
commit 112f4a1817
3 changed files with 51 additions and 34 deletions

View File

@ -1,15 +1,14 @@
fixtures:
repositories:
'cinder': 'git://github.com/stackforge/puppet-cinder.git'
'concat': 'git://github.com/puppetlabs/puppetlabs-concat.git'
'inifile': 'git://github.com/puppetlabs/puppetlabs-inifile'
'keystone': 'git://github.com/stackforge/puppet-keystone.git'
'mysql':
repo: 'git://github.com/puppetlabs/puppetlabs-mysql.git'
ref: 'origin/2.2.x'
'openstacklib': 'git://github.com/stackforge/puppet-openstacklib.git'
'postgresql':
repo: "git://github.com/puppetlabs/puppet-postgresql.git"
ref: '2.5.0'
'postgresql': 'git://github.com/puppetlabs/puppet-postgresql.git'
'qpid': 'git://github.com/dprince/puppet-qpid.git'
'rabbitmq':
repo: 'git://github.com/puppetlabs/puppetlabs-rabbitmq'

View File

@ -3,34 +3,44 @@
# Class that configures postgresql for nova
# Requires the Puppetlabs postgresql module.
#
# === Parameters:
# === Parameters
#
# [*password*]
# Password to use to connect to postgresql
# (Required) Password to connect to the database.
#
# [*dbname*]
# (optional) Name of the database to create for nova
# Defaults to 'nova'
# (Optional) Name of the database.
# Defaults to 'nova'.
#
# [*user*]
# (optional) Name of the user to connect to postgresql
# Defaults to 'nova'
# (Optional) User to connect to the database.
# Defaults to 'nova'.
#
# [*encoding*]
# (Optional) The charset to use for the database.
# Default to undef.
#
# [*privileges*]
# (Optional) Privileges given to the database user.
# Default to 'ALL'
#
class nova::db::postgresql(
$password,
$dbname = 'nova',
$user = 'nova'
$dbname = 'nova',
$user = 'nova',
$encoding = undef,
$privileges = 'ALL',
) {
require 'postgresql::python'
Postgresql::Db[$dbname] -> Anchor<| title == 'nova-start' |>
Postgresql::Db[$dbname] ~> Exec<| title == 'nova-db-sync' |>
Package['python-psycopg2'] -> Exec<| title == 'nova-db-sync' |>
postgresql::db { $dbname:
user => $user,
password => $password,
::openstacklib::db::postgresql { 'nova':
password_hash => postgresql_password($user, $password),
dbname => $dbname,
user => $user,
encoding => $encoding,
privileges => $privileges,
}
::Openstacklib::Db::Postgresql['nova'] ~> Exec<| title == 'nova-db-sync' |>
::Openstacklib::Db::Postgresql['nova'] -> Anchor<| title == 'nova-start' |>
}

View File

@ -1,26 +1,32 @@
require 'spec_helper'
describe 'nova::db::postgresql' do
let :required_params do
{ :password => "qwerty" }
let :req_params do
{ :password => 'pw' }
end
let :pre_condition do
'include postgresql::server'
end
context 'on a RedHat osfamily' do
let :facts do
{
:postgres_default_version => '8.4',
:osfamily => 'RedHat'
:osfamily => 'RedHat',
:operatingsystemrelease => '7.0',
:concat_basedir => '/var/lib/puppet/concat'
}
end
context 'with only required parameters' do
let :params do
required_params
req_params
end
it { should contain_postgresql__db('nova').with(
:user => 'nova',
:password => 'qwerty'
it { should contain_postgresql__server__db('nova').with(
:user => 'nova',
:password => 'md557ae0608fad632bf0155cb9502a6b454'
)}
end
@ -29,19 +35,21 @@ describe 'nova::db::postgresql' do
context 'on a Debian osfamily' do
let :facts do
{
:postgres_default_version => '8.4',
:osfamily => 'Debian'
:operatingsystemrelease => '7.8',
:operatingsystem => 'Debian',
:osfamily => 'Debian',
:concat_basedir => '/var/lib/puppet/concat'
}
end
context 'with only required parameters' do
let :params do
required_params
req_params
end
it { should contain_postgresql__db('nova').with(
:user => 'nova',
:password => 'qwerty'
it { should contain_postgresql__server__db('nova').with(
:user => 'nova',
:password => 'md557ae0608fad632bf0155cb9502a6b454'
)}
end