Merge "Migrate postgresql backend to use openstacklib::db::postgresql"
This commit is contained in:
commit
2dae7deda3
@ -1,6 +1,7 @@
|
|||||||
fixtures:
|
fixtures:
|
||||||
repositories:
|
repositories:
|
||||||
"apt": "git://github.com/puppetlabs/puppetlabs-apt.git"
|
"apt": "git://github.com/puppetlabs/puppetlabs-apt.git"
|
||||||
|
'concat': 'git://github.com/puppetlabs/puppetlabs-concat.git'
|
||||||
"keystone": "git://github.com/stackforge/puppet-keystone.git"
|
"keystone": "git://github.com/stackforge/puppet-keystone.git"
|
||||||
"mysql":
|
"mysql":
|
||||||
repo: "git://github.com/puppetlabs/puppetlabs-mysql.git"
|
repo: "git://github.com/puppetlabs/puppetlabs-mysql.git"
|
||||||
@ -11,8 +12,6 @@ fixtures:
|
|||||||
repo: "git://github.com/puppetlabs/puppetlabs-rabbitmq"
|
repo: "git://github.com/puppetlabs/puppetlabs-rabbitmq"
|
||||||
ref: 'origin/2.x'
|
ref: 'origin/2.x'
|
||||||
'inifile': 'git://github.com/puppetlabs/puppetlabs-inifile'
|
'inifile': 'git://github.com/puppetlabs/puppetlabs-inifile'
|
||||||
"postgresql":
|
'postgresql': 'git://github.com/puppetlabs/puppet-postgresql.git'
|
||||||
repo: "git://github.com/puppetlabs/puppet-postgresql.git"
|
|
||||||
ref: "2.5.0"
|
|
||||||
symlinks:
|
symlinks:
|
||||||
"glance": "#{source_dir}"
|
"glance": "#{source_dir}"
|
||||||
|
@ -1,21 +1,45 @@
|
|||||||
|
# == Class: glance::db::postgresql
|
||||||
#
|
#
|
||||||
# Class that configures postgresql for glance
|
# Class that configures postgresql for glance
|
||||||
#
|
|
||||||
# Requires the Puppetlabs postgresql module.
|
# Requires the Puppetlabs postgresql module.
|
||||||
|
#
|
||||||
|
# === Parameters
|
||||||
|
#
|
||||||
|
# [*password*]
|
||||||
|
# (Required) Password to connect to the database.
|
||||||
|
#
|
||||||
|
# [*dbname*]
|
||||||
|
# (Optional) Name of the database.
|
||||||
|
# Defaults to 'glance'.
|
||||||
|
#
|
||||||
|
# [*user*]
|
||||||
|
# (Optional) User to connect to the database.
|
||||||
|
# Defaults to 'glance'.
|
||||||
|
#
|
||||||
|
# [*encoding*]
|
||||||
|
# (Optional) The charset to use for the database.
|
||||||
|
# Default to undef.
|
||||||
|
#
|
||||||
|
# [*privileges*]
|
||||||
|
# (Optional) Privileges given to the database user.
|
||||||
|
# Default to 'ALL'
|
||||||
|
#
|
||||||
class glance::db::postgresql(
|
class glance::db::postgresql(
|
||||||
$password,
|
$password,
|
||||||
$dbname = 'glance',
|
$dbname = 'glance',
|
||||||
$user = 'glance'
|
$user = 'glance',
|
||||||
|
$encoding = undef,
|
||||||
|
$privileges = 'ALL',
|
||||||
) {
|
) {
|
||||||
|
|
||||||
require postgresql::python
|
::openstacklib::db::postgresql { 'glance':
|
||||||
|
password_hash => postgresql_password($user, $password),
|
||||||
Postgresql::Db[$dbname] ~> Exec<| title == 'glance-manage db_sync' |>
|
dbname => $dbname,
|
||||||
Package['python-psycopg2'] -> Exec<| title == 'glance-manage db_sync' |>
|
user => $user,
|
||||||
|
encoding => $encoding,
|
||||||
postgresql::db { $dbname:
|
privileges => $privileges,
|
||||||
user => $user,
|
|
||||||
password => $password,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::Openstacklib::Db::Postgresql['glance'] ~> Exec<| title == 'glance-manage db_sync' |>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,24 +3,56 @@ require 'spec_helper'
|
|||||||
describe 'glance::db::postgresql' do
|
describe 'glance::db::postgresql' do
|
||||||
|
|
||||||
let :req_params do
|
let :req_params do
|
||||||
{:password => 'pw'}
|
{ :password => 'pw' }
|
||||||
end
|
end
|
||||||
|
|
||||||
let :facts do
|
let :pre_condition do
|
||||||
{
|
'include postgresql::server'
|
||||||
:postgres_default_version => '8.4',
|
|
||||||
:osfamily => 'RedHat',
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'with only required params' do
|
context 'on a RedHat osfamily' do
|
||||||
let :params do
|
let :facts do
|
||||||
req_params
|
{
|
||||||
|
:osfamily => 'RedHat',
|
||||||
|
:operatingsystemrelease => '7.0',
|
||||||
|
:concat_basedir => '/var/lib/puppet/concat'
|
||||||
|
}
|
||||||
end
|
end
|
||||||
it { should contain_postgresql__db('glance').with(
|
|
||||||
:user => 'glance',
|
context 'with only required parameters' do
|
||||||
:password => 'pw'
|
let :params do
|
||||||
) }
|
req_params
|
||||||
|
end
|
||||||
|
|
||||||
|
it { should contain_postgresql__server__db('glance').with(
|
||||||
|
:user => 'glance',
|
||||||
|
:password => 'md56c7c03b193c2c1e0667bc5bd891703db'
|
||||||
|
)}
|
||||||
|
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('glance').with(
|
||||||
|
:user => 'glance',
|
||||||
|
:password => 'md56c7c03b193c2c1e0667bc5bd891703db'
|
||||||
|
)}
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user