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: Ibf9bf074f1fb1712c0c5d70faa7d29a3b72bce29 Implements: blueprint commmon-openstack-database-resource
This commit is contained in:
parent
ff63106551
commit
fda22053b3
@ -1,12 +1,11 @@
|
||||
fixtures:
|
||||
repositories:
|
||||
'inifile': 'git://github.com/puppetlabs/puppetlabs-inifile.git'
|
||||
'concat': 'git://github.com/puppetlabs/puppetlabs-concat.git'
|
||||
'keystone': 'git://github.com/stackforge/puppet-keystone.git'
|
||||
'mysql': 'git://github.com/puppetlabs/puppetlabs-mysql.git'
|
||||
'openstacklib': 'git://github.com/stackforge/puppet-openstacklib.git'
|
||||
'postgresql':
|
||||
repo: 'git://github.com/puppetlabs/puppet-postgresql.git'
|
||||
ref: '2.5.0'
|
||||
'postgresql': 'git://github.com/puppetlabs/puppet-postgresql.git'
|
||||
'stdlib': 'git://github.com/puppetlabs/puppetlabs-stdlib.git'
|
||||
symlinks:
|
||||
'tuskar': "#{source_dir}"
|
||||
|
@ -1,36 +1,47 @@
|
||||
# == Class: tuskar::db::postgresql
|
||||
#
|
||||
# Manage the tuskar postgresql database
|
||||
# Class that configures postgresql for tuskar
|
||||
# Requires the Puppetlabs postgresql module.
|
||||
#
|
||||
# === Parameters:
|
||||
#
|
||||
# [*password*]
|
||||
# (required) Password that will be used for the tuskar db user.
|
||||
# (Required) Password to connect to the database.
|
||||
#
|
||||
# [*dbname*]
|
||||
# (optionnal) Name of tuskar database.
|
||||
# Defaults to tuskar
|
||||
# (Optional) Name of the database.
|
||||
# Defaults to 'tuskar'.
|
||||
#
|
||||
# [*user*]
|
||||
# (optionnal) Name of tuskar user.
|
||||
# Defaults to tuskar
|
||||
# (Optional) User to connect to the database.
|
||||
# Defaults to 'tuskar'.
|
||||
#
|
||||
# [*encoding*]
|
||||
# (Optional) The charset to use for the database.
|
||||
# Default to undef.
|
||||
#
|
||||
# [*privileges*]
|
||||
# (Optional) Privileges given to the database user.
|
||||
# Default to 'ALL'
|
||||
#
|
||||
class tuskar::db::postgresql(
|
||||
$password,
|
||||
$dbname = 'tuskar',
|
||||
$user = 'tuskar'
|
||||
$dbname = 'tuskar',
|
||||
$user = 'tuskar',
|
||||
$encoding = undef,
|
||||
$privileges = 'ALL',
|
||||
) {
|
||||
|
||||
require postgresql::python
|
||||
|
||||
Class['tuskar::db::postgresql'] -> Service<| title == 'tuskar' |>
|
||||
Postgresql::Db[$dbname] ~> Exec<| title == 'tuskar-dbsync' |>
|
||||
Package['python-psycopg2'] -> Exec<| title == 'tuskar-dbsync' |>
|
||||
|
||||
|
||||
postgresql::db { $dbname:
|
||||
user => $user,
|
||||
password => $password,
|
||||
::openstacklib::db::postgresql { 'tuskar':
|
||||
password_hash => postgresql_password($user, $password),
|
||||
dbname => $dbname,
|
||||
user => $user,
|
||||
encoding => $encoding,
|
||||
privileges => $privileges,
|
||||
}
|
||||
|
||||
::Openstacklib::Db::Postgresql['tuskar'] ~> Exec<| title == 'tuskar-dbsync' |>
|
||||
|
||||
}
|
||||
|
@ -3,24 +3,56 @@ require 'spec_helper'
|
||||
describe 'tuskar::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 { is_expected.to contain_postgresql__db('tuskar').with(
|
||||
:user => 'tuskar',
|
||||
:password => 'pw'
|
||||
) }
|
||||
|
||||
context 'with only required parameters' do
|
||||
let :params do
|
||||
req_params
|
||||
end
|
||||
|
||||
it { should contain_postgresql__server__db('tuskar').with(
|
||||
:user => 'tuskar',
|
||||
:password => 'md532cc9d9d42efb508bc9d6267d873d63d'
|
||||
)}
|
||||
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('tuskar').with(
|
||||
:user => 'tuskar',
|
||||
:password => 'md532cc9d9d42efb508bc9d6267d873d63d'
|
||||
)}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user