Add designate::db::postgresql class.
This allows Designate to be used with PostgreSQL. Change-Id: Ief63f88ba323e3f20300b8ff6a5148a78413ac3d (cherry picked from commit fd43d18c0f83c3401c7908fa60f160e4ae7ab4a2)
This commit is contained in:
parent
7fe41957f0
commit
47e3e4132f
|
@ -0,0 +1,49 @@
|
|||
# == Class: designate::db::postgresql
|
||||
#
|
||||
# Class that configures postgresql for designate
|
||||
# Requires the Puppetlabs postgresql module.
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*password*]
|
||||
# (Required) Password to connect to the database.
|
||||
#
|
||||
# [*dbname*]
|
||||
# (Optional) Name of the database.
|
||||
# Defaults to 'designate'.
|
||||
#
|
||||
# [*user*]
|
||||
# (Optional) User to connect to the database.
|
||||
# Defaults to 'designate'.
|
||||
#
|
||||
# [*encoding*]
|
||||
# (Optional) The charset to use for the database.
|
||||
# Default to undef.
|
||||
#
|
||||
# [*privileges*]
|
||||
# (Optional) Privileges given to the database user.
|
||||
# Default to 'ALL'
|
||||
#
|
||||
class designate::db::postgresql(
|
||||
$password,
|
||||
$dbname = 'designate',
|
||||
$user = 'designate',
|
||||
$encoding = undef,
|
||||
$privileges = 'ALL',
|
||||
) {
|
||||
|
||||
include designate::deps
|
||||
|
||||
::openstacklib::db::postgresql { 'designate':
|
||||
password => $password,
|
||||
dbname => $dbname,
|
||||
user => $user,
|
||||
encoding => $encoding,
|
||||
privileges => $privileges,
|
||||
}
|
||||
|
||||
|
||||
Anchor['designate::db::begin']
|
||||
~> Class['designate::db::postgresql']
|
||||
~> Anchor['designate::db::end']
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
features:
|
||||
- |
|
||||
Add support for PostgreSQL database backend via designate::db::postgresql
|
|
@ -0,0 +1,45 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'designate::db::postgresql' do
|
||||
|
||||
shared_examples 'designate::db::postgresql' do
|
||||
let :req_params do
|
||||
{ :password => 'pw' }
|
||||
end
|
||||
|
||||
let :pre_condition do
|
||||
'include postgresql::server'
|
||||
end
|
||||
|
||||
context 'with only required parameters' do
|
||||
let :params do
|
||||
req_params
|
||||
end
|
||||
|
||||
it { is_expected.to contain_class('designate::deps') }
|
||||
|
||||
it { should contain_openstacklib__db__postgresql('designate').with(
|
||||
:password => 'pw',
|
||||
:dbname => 'designate',
|
||||
:user => 'designate',
|
||||
:encoding => nil,
|
||||
:privileges => 'ALL',
|
||||
)}
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge(OSDefaults.get_facts({
|
||||
:os_workers => 8,
|
||||
:concat_basedir => '/var/lib/puppet/concat'
|
||||
}))
|
||||
end
|
||||
|
||||
it_configures 'designate::db::postgresql'
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue