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). Change-Id: If748f8ff57d8aece1b4050bc4b841495088b2972 Implements: blueprint commmon-openstack-database-resource
This commit is contained in:
parent
2abfb25c9b
commit
ac2d812862
@ -9,8 +9,6 @@ fixtures:
|
||||
'openstacklib': 'git://github.com/stackforge/puppet-openstacklib.git'
|
||||
'stdlib': 'git://github.com/puppetlabs/puppetlabs-stdlib.git'
|
||||
'inifile': 'git://github.com/puppetlabs/puppetlabs-inifile'
|
||||
'postgresql':
|
||||
repo: 'git://github.com/puppetlabs/puppetlabs-postgresql.git'
|
||||
ref: '2.5.0'
|
||||
'postgresql': 'git://github.com/puppetlabs/puppetlabs-postgresql.git'
|
||||
symlinks:
|
||||
'keystone': "#{source_dir}"
|
||||
|
@ -1,47 +1,57 @@
|
||||
# == Class: keystone::db::postgresql
|
||||
#
|
||||
# implements postgresql backend for keystone
|
||||
# Class that configures postgresql for keystone
|
||||
# Requires the Puppetlabs postgresql module.
|
||||
#
|
||||
# This class can be used to create tables, users and grant
|
||||
# privelege for a postgresql keystone database.
|
||||
#
|
||||
# Requires Puppetlabs Postgresql module.
|
||||
#
|
||||
# [*Parameters*]
|
||||
#
|
||||
# [password] Password that will be used for the keystone db user.
|
||||
# Optional. Defaults to: 'keystone_default_password'
|
||||
#
|
||||
# [dbname] Name of keystone database. Optional. Defaults to keystone.
|
||||
#
|
||||
# [user] Name of keystone user. Optional. Defaults to keystone.
|
||||
#
|
||||
# == Dependencies
|
||||
# Class['postgresql::server']
|
||||
#
|
||||
# == Examples
|
||||
# == Authors
|
||||
#
|
||||
# Stackforge Contributors puppet-openstack@puppetlabs.com
|
||||
# Etienne Pelletier epelletier@morphlabs.com
|
||||
#
|
||||
# == Copyright
|
||||
#
|
||||
# Copyright 2013-2014 Stackforge Contributors
|
||||
# Copyright 2012 Etienne Pelletier, unless otherwise noted.
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*password*]
|
||||
# (Required) Password to connect to the database.
|
||||
#
|
||||
# [*dbname*]
|
||||
# (Optional) Name of the database.
|
||||
# Defaults to 'keystone'.
|
||||
#
|
||||
# [*user*]
|
||||
# (Optional) User to connect to the database.
|
||||
# Defaults to 'keystone'.
|
||||
#
|
||||
# [*encoding*]
|
||||
# (Optional) The charset to use for the database.
|
||||
# Default to undef.
|
||||
#
|
||||
# [*privileges*]
|
||||
# (Optional) Privileges given to the database user.
|
||||
# Default to 'ALL'
|
||||
#
|
||||
class keystone::db::postgresql(
|
||||
$password,
|
||||
$dbname = 'keystone',
|
||||
$user = 'keystone'
|
||||
$dbname = 'keystone',
|
||||
$user = 'keystone',
|
||||
$encoding = undef,
|
||||
$privileges = 'ALL',
|
||||
) {
|
||||
|
||||
Class['keystone::db::postgresql'] -> Service<| title == 'keystone' |>
|
||||
|
||||
require postgresql::python
|
||||
|
||||
postgresql::db { $dbname:
|
||||
user => $user,
|
||||
password => $password,
|
||||
::openstacklib::db::postgresql { 'keystone':
|
||||
password_hash => postgresql_password($user, $password),
|
||||
dbname => $dbname,
|
||||
user => $user,
|
||||
encoding => $encoding,
|
||||
privileges => $privileges,
|
||||
}
|
||||
|
||||
Postgresql::Db[$dbname] ~> Exec<| title == 'keystone-manage db_sync' |>
|
||||
::Openstacklib::Db::Postgresql['keystone'] ~> Exec<| title == 'keystone-manage db_sync' |>
|
||||
|
||||
}
|
||||
|
@ -3,24 +3,56 @@ require 'spec_helper'
|
||||
describe 'keystone::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('keystone').with(
|
||||
:user => 'keystone',
|
||||
:password => 'pw'
|
||||
) }
|
||||
|
||||
context 'with only required parameters' do
|
||||
let :params do
|
||||
req_params
|
||||
end
|
||||
|
||||
it { should contain_postgresql__server__db('keystone').with(
|
||||
:user => 'keystone',
|
||||
:password => 'md5c530c33636c58ae83ca933f39319273e'
|
||||
)}
|
||||
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('keystone').with(
|
||||
:user => 'keystone',
|
||||
:password => 'md5c530c33636c58ae83ca933f39319273e'
|
||||
)}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user