Merge "Migrate postgresql backend to use openstacklib::db::postgresql"
This commit is contained in:
commit
2dae7deda3
@ -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}"
|
||||
|
@ -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'
|
||||
$dbname = '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:
|
||||
user => $user,
|
||||
password => $password,
|
||||
::openstacklib::db::postgresql { 'glance':
|
||||
password_hash => postgresql_password($user, $password),
|
||||
dbname => $dbname,
|
||||
user => $user,
|
||||
encoding => $encoding,
|
||||
privileges => $privileges,
|
||||
}
|
||||
|
||||
::Openstacklib::Db::Postgresql['glance'] ~> Exec<| title == 'glance-manage db_sync' |>
|
||||
|
||||
}
|
||||
|
@ -3,24 +3,56 @@ require 'spec_helper'
|
||||
describe 'glance::db::postgresql' do
|
||||
|
||||
let :req_params do
|
||||
{:password => 'pw'}
|
||||
{ :password => 'pw' }
|
||||
end
|
||||
|
||||
let :facts do
|
||||
{
|
||||
:postgres_default_version => '8.4',
|
||||
:osfamily => 'RedHat',
|
||||
}
|
||||
let :pre_condition do
|
||||
'include postgresql::server'
|
||||
end
|
||||
|
||||
describe 'with only required params' do
|
||||
let :params do
|
||||
req_params
|
||||
context 'on a RedHat osfamily' do
|
||||
let :facts do
|
||||
{
|
||||
:osfamily => 'RedHat',
|
||||
:operatingsystemrelease => '7.0',
|
||||
:concat_basedir => '/var/lib/puppet/concat'
|
||||
}
|
||||
end
|
||||
it { should contain_postgresql__db('glance').with(
|
||||
:user => 'glance',
|
||||
:password => 'pw'
|
||||
) }
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user