Add designate::db::postgresql class.
This allows Designate to be used with PostgreSQL. Change-Id: Ief63f88ba323e3f20300b8ff6a5148a78413ac3d
This commit is contained in:
49
manifests/db/postgresql.pp
Normal file
49
manifests/db/postgresql.pp
Normal file
@@ -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']
|
||||||
|
}
|
||||||
4
releasenotes/notes/postgresql-441cce8804597ce3.yaml
Normal file
4
releasenotes/notes/postgresql-441cce8804597ce3.yaml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Add support for PostgreSQL database backend via designate::db::postgresql
|
||||||
45
spec/classes/designate_db_postgresql_spec.rb
Normal file
45
spec/classes/designate_db_postgresql_spec.rb
Normal file
@@ -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
|
||||||
Reference in New Issue
Block a user