Browse Source

Add designate::db::postgresql class.

This allows Designate to be used with PostgreSQL.

Backport note:
This backport includes modifications to accomodate for password_hash
function removed during Victoria cycle[1].

[1] https://review.opendev.org/728595

Change-Id: Ief63f88ba323e3f20300b8ff6a5148a78413ac3d
(cherry picked from commit fd43d18c0f)
(cherry picked from commit 47e3e4132f)
changes/56/781756/2
Christian Rohmann 4 weeks ago
committed by Takashi Kajinami
parent
commit
71b25d083e
3 changed files with 97 additions and 0 deletions
  1. +49
    -0
      manifests/db/postgresql.pp
  2. +4
    -0
      releasenotes/notes/postgresql-441cce8804597ce3.yaml
  3. +44
    -0
      spec/classes/designate_db_postgresql_spec.rb

+ 49
- 0
manifests/db/postgresql.pp View 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_hash => postgresql_password($user, $password),
dbname => $dbname,
user => $user,
encoding => $encoding,
privileges => $privileges,
}
Anchor['designate::db::begin']
~> Class['designate::db::postgresql']
~> Anchor['designate::db::end']
}

+ 4
- 0
releasenotes/notes/postgresql-441cce8804597ce3.yaml View File

@ -0,0 +1,4 @@
---
features:
- |
Add support for PostgreSQL database backend via designate::db::postgresql

+ 44
- 0
spec/classes/designate_db_postgresql_spec.rb View File

@ -0,0 +1,44 @@
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 { should contain_openstacklib__db__postgresql('designate').with(
:password_hash => 'md5919ed897e792e4768228d95591410cd1',
: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…
Cancel
Save