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

This commit is contained in:
Jenkins 2015-01-11 23:55:57 +00:00 committed by Gerrit Code Review
commit 2dae7deda3
3 changed files with 82 additions and 27 deletions

View File

@ -1,6 +1,7 @@
fixtures:
repositories:
"apt": "git://github.com/puppetlabs/puppetlabs-apt.git"
'concat': 'git://github.com/puppetlabs/puppetlabs-concat.git'
"keystone": "git://github.com/stackforge/puppet-keystone.git"
"mysql":
repo: "git://github.com/puppetlabs/puppetlabs-mysql.git"
@ -11,8 +12,6 @@ fixtures:
repo: "git://github.com/puppetlabs/puppetlabs-rabbitmq"
ref: 'origin/2.x'
'inifile': 'git://github.com/puppetlabs/puppetlabs-inifile'
"postgresql":
repo: "git://github.com/puppetlabs/puppet-postgresql.git"
ref: "2.5.0"
'postgresql': 'git://github.com/puppetlabs/puppet-postgresql.git'
symlinks:
"glance": "#{source_dir}"

View File

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

View File

@ -6,21 +6,53 @@ describe 'glance::db::postgresql' 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',
:operatingsystemrelease => '7.0',
:concat_basedir => '/var/lib/puppet/concat'
}
end
describe 'with only required params' do
context 'with only required parameters' do
let :params do
req_params
end
it { should contain_postgresql__db('glance').with(
it { should contain_postgresql__server__db('glance').with(
:user => 'glance',
:password => 'pw'
:password => 'md56c7c03b193c2c1e0667bc5bd891703db'
)}
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('glance').with(
:user => 'glance',
:password => 'md56c7c03b193c2c1e0667bc5bd891703db'
)}
end
end
end