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' |>
|
|
||||||
|
|
||||||
postgresql::db { $dbname:
|
|
||||||
user => $user,
|
user => $user,
|
||||||
password => $password,
|
encoding => $encoding,
|
||||||
|
privileges => $privileges,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::Openstacklib::Db::Postgresql['cinder'] ~> Exec<| title == 'cinder-manage db_sync' |>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,21 +6,53 @@ describe 'cinder::db::postgresql' do
|
|||||||
{ :password => 'pw' }
|
{ :password => 'pw' }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
let :pre_condition do
|
||||||
|
'include postgresql::server'
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'on a RedHat osfamily' do
|
||||||
let :facts do
|
let :facts do
|
||||||
{
|
{
|
||||||
:postgres_default_version => '8.4',
|
|
||||||
:osfamily => 'RedHat',
|
:osfamily => 'RedHat',
|
||||||
|
:operatingsystemrelease => '7.0',
|
||||||
|
:concat_basedir => '/var/lib/puppet/concat'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'with only required params' do
|
context 'with only required parameters' do
|
||||||
let :params do
|
let :params do
|
||||||
req_params
|
req_params
|
||||||
end
|
end
|
||||||
it { should contain_postgresql__db('cinder').with(
|
|
||||||
|
it { should contain_postgresql__server__db('cinder').with(
|
||||||
:user => 'cinder',
|
:user => 'cinder',
|
||||||
:password => 'pw'
|
:password => 'md506736c3030793e09882cc536063d433f'
|
||||||
)}
|
)}
|
||||||
end
|
end
|
||||||
|
|
||||||
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
|
||||||
|
Loading…
Reference in New Issue
Block a user