Migrate postgresql backend to use openstacklib::db::postgresql
Let migrate to the new openstacklib::db::postgresql helper for postgresql backend. This commit also unpin postgresql fixture (openstacklib support now the latest version of postgre module). Implements: blueprint commmon-openstack-database-resource Change-Id: I45b034b9495ea02a143dad895c116077772c6b73
This commit is contained in:
parent
62823628ca
commit
6c792b9b64
@ -1,15 +1,14 @@
|
|||||||
fixtures:
|
fixtures:
|
||||||
repositories:
|
repositories:
|
||||||
'apt': 'git://github.com/puppetlabs/puppetlabs-apt.git'
|
'apt': 'git://github.com/puppetlabs/puppetlabs-apt.git'
|
||||||
|
'concat': 'git://github.com/puppetlabs/puppetlabs-concat.git'
|
||||||
'inifile': 'git://github.com/puppetlabs/puppetlabs-inifile'
|
'inifile': 'git://github.com/puppetlabs/puppetlabs-inifile'
|
||||||
'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'
|
||||||
'openstacklib': 'git://github.com/stackforge/puppet-openstacklib.git'
|
'openstacklib': 'git://github.com/stackforge/puppet-openstacklib.git'
|
||||||
'postgresql':
|
'postgresql': 'git://github.com/puppetlabs/puppet-postgresql.git'
|
||||||
repo: 'git://github.com/puppetlabs/puppet-postgresql.git'
|
|
||||||
ref: '2.5.0'
|
|
||||||
'qpid': 'git://github.com/dprince/puppet-qpid.git'
|
'qpid': 'git://github.com/dprince/puppet-qpid.git'
|
||||||
'rabbitmq':
|
'rabbitmq':
|
||||||
repo: 'git://github.com/puppetlabs/puppetlabs-rabbitmq'
|
repo: 'git://github.com/puppetlabs/puppetlabs-rabbitmq'
|
||||||
|
@ -16,20 +16,30 @@
|
|||||||
# (Optional) User to connect to the database.
|
# (Optional) User to connect to the database.
|
||||||
# Defaults to 'cinder'.
|
# Defaults to 'cinder'.
|
||||||
#
|
#
|
||||||
|
# [*encoding*]
|
||||||
|
# (Optional) The charset to use for the database.
|
||||||
|
# Default to undef.
|
||||||
|
#
|
||||||
|
# [*privileges*]
|
||||||
|
# (Optional) Privileges given to the database user.
|
||||||
|
# Default to 'ALL'
|
||||||
|
#
|
||||||
class cinder::db::postgresql(
|
class cinder::db::postgresql(
|
||||||
$password,
|
$password,
|
||||||
$dbname = 'cinder',
|
$dbname = 'cinder',
|
||||||
$user = 'cinder'
|
$user = 'cinder',
|
||||||
|
$encoding = undef,
|
||||||
|
$privileges = 'ALL',
|
||||||
) {
|
) {
|
||||||
|
|
||||||
require postgresql::python
|
::openstacklib::db::postgresql { 'cinder':
|
||||||
|
password_hash => postgresql_password($user, $password),
|
||||||
Postgresql::Db[$dbname] ~> Exec<| title == 'cinder-manage db_sync' |>
|
dbname => $dbname,
|
||||||
Package['python-psycopg2'] -> Exec<| title == 'cinder-manage db_sync' |>
|
user => $user,
|
||||||
|
encoding => $encoding,
|
||||||
postgresql::db { $dbname:
|
privileges => $privileges,
|
||||||
user => $user,
|
|
||||||
password => $password,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::Openstacklib::Db::Postgresql['cinder'] ~> Exec<| title == 'cinder-manage db_sync' |>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,24 +3,56 @@ require 'spec_helper'
|
|||||||
describe 'cinder::db::postgresql' do
|
describe 'cinder::db::postgresql' do
|
||||||
|
|
||||||
let :req_params do
|
let :req_params do
|
||||||
{:password => 'pw'}
|
{ :password => 'pw' }
|
||||||
end
|
end
|
||||||
|
|
||||||
let :facts do
|
let :pre_condition do
|
||||||
{
|
'include postgresql::server'
|
||||||
:postgres_default_version => '8.4',
|
|
||||||
:osfamily => 'RedHat',
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'with only required params' do
|
context 'on a RedHat osfamily' do
|
||||||
let :params do
|
let :facts do
|
||||||
req_params
|
{
|
||||||
|
:osfamily => 'RedHat',
|
||||||
|
:operatingsystemrelease => '7.0',
|
||||||
|
:concat_basedir => '/var/lib/puppet/concat'
|
||||||
|
}
|
||||||
end
|
end
|
||||||
it { should contain_postgresql__db('cinder').with(
|
|
||||||
:user => 'cinder',
|
context 'with only required parameters' do
|
||||||
:password => 'pw'
|
let :params do
|
||||||
) }
|
req_params
|
||||||
|
end
|
||||||
|
|
||||||
|
it { should contain_postgresql__server__db('cinder').with(
|
||||||
|
:user => 'cinder',
|
||||||
|
:password => 'md506736c3030793e09882cc536063d433f'
|
||||||
|
)}
|
||||||
|
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('cinder').with(
|
||||||
|
:user => 'cinder',
|
||||||
|
:password => 'md506736c3030793e09882cc536063d433f'
|
||||||
|
)}
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user