Merge "Migrate postgresql backend to use openstacklib::db::postgresql"
This commit is contained in:
@@ -1,15 +1,14 @@
|
|||||||
fixtures:
|
fixtures:
|
||||||
repositories:
|
repositories:
|
||||||
'cinder': 'git://github.com/stackforge/puppet-cinder.git'
|
'cinder': 'git://github.com/stackforge/puppet-cinder.git'
|
||||||
|
'concat': 'git://github.com/puppetlabs/puppetlabs-concat.git'
|
||||||
'inifile': 'git://github.com/puppetlabs/puppetlabs-inifile'
|
'inifile': 'git://github.com/puppetlabs/puppetlabs-inifile'
|
||||||
'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'
|
||||||
ref: 'origin/2.2.x'
|
ref: 'origin/2.2.x'
|
||||||
'openstacklib': 'git://github.com/stackforge/puppet-openstacklib.git'
|
'openstacklib': 'git://github.com/stackforge/puppet-openstacklib.git'
|
||||||
'postgresql':
|
'postgresql': 'git://github.com/puppetlabs/puppet-postgresql.git'
|
||||||
repo: "git://github.com/puppetlabs/puppet-postgresql.git"
|
|
||||||
ref: '2.5.0'
|
|
||||||
'qpid': 'git://github.com/dprince/puppet-qpid.git'
|
'qpid': 'git://github.com/dprince/puppet-qpid.git'
|
||||||
'rabbitmq':
|
'rabbitmq':
|
||||||
repo: 'git://github.com/puppetlabs/puppetlabs-rabbitmq'
|
repo: 'git://github.com/puppetlabs/puppetlabs-rabbitmq'
|
||||||
|
@@ -3,34 +3,44 @@
|
|||||||
# Class that configures postgresql for nova
|
# Class that configures postgresql for nova
|
||||||
# Requires the Puppetlabs postgresql module.
|
# Requires the Puppetlabs postgresql module.
|
||||||
#
|
#
|
||||||
# === Parameters:
|
# === Parameters
|
||||||
#
|
#
|
||||||
# [*password*]
|
# [*password*]
|
||||||
# Password to use to connect to postgresql
|
# (Required) Password to connect to the database.
|
||||||
#
|
#
|
||||||
# [*dbname*]
|
# [*dbname*]
|
||||||
# (optional) Name of the database to create for nova
|
# (Optional) Name of the database.
|
||||||
# Defaults to 'nova'
|
# Defaults to 'nova'.
|
||||||
#
|
#
|
||||||
# [*user*]
|
# [*user*]
|
||||||
# (optional) Name of the user to connect to postgresql
|
# (Optional) User to connect to the database.
|
||||||
# Defaults to 'nova'
|
# Defaults to 'nova'.
|
||||||
|
#
|
||||||
|
# [*encoding*]
|
||||||
|
# (Optional) The charset to use for the database.
|
||||||
|
# Default to undef.
|
||||||
|
#
|
||||||
|
# [*privileges*]
|
||||||
|
# (Optional) Privileges given to the database user.
|
||||||
|
# Default to 'ALL'
|
||||||
#
|
#
|
||||||
class nova::db::postgresql(
|
class nova::db::postgresql(
|
||||||
$password,
|
$password,
|
||||||
$dbname = 'nova',
|
$dbname = 'nova',
|
||||||
$user = 'nova'
|
$user = 'nova',
|
||||||
|
$encoding = undef,
|
||||||
|
$privileges = 'ALL',
|
||||||
) {
|
) {
|
||||||
|
|
||||||
require 'postgresql::python'
|
::openstacklib::db::postgresql { 'nova':
|
||||||
|
password_hash => postgresql_password($user, $password),
|
||||||
Postgresql::Db[$dbname] -> Anchor<| title == 'nova-start' |>
|
dbname => $dbname,
|
||||||
Postgresql::Db[$dbname] ~> Exec<| title == 'nova-db-sync' |>
|
user => $user,
|
||||||
Package['python-psycopg2'] -> Exec<| title == 'nova-db-sync' |>
|
encoding => $encoding,
|
||||||
|
privileges => $privileges,
|
||||||
postgresql::db { $dbname:
|
|
||||||
user => $user,
|
|
||||||
password => $password,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::Openstacklib::Db::Postgresql['nova'] ~> Exec<| title == 'nova-db-sync' |>
|
||||||
|
::Openstacklib::Db::Postgresql['nova'] -> Anchor<| title == 'nova-start' |>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,26 +1,32 @@
|
|||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe 'nova::db::postgresql' do
|
describe 'nova::db::postgresql' do
|
||||||
let :required_params do
|
|
||||||
{ :password => "qwerty" }
|
let :req_params do
|
||||||
|
{ :password => 'pw' }
|
||||||
|
end
|
||||||
|
|
||||||
|
let :pre_condition do
|
||||||
|
'include postgresql::server'
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'on a RedHat osfamily' do
|
context 'on a RedHat osfamily' do
|
||||||
let :facts do
|
let :facts do
|
||||||
{
|
{
|
||||||
:postgres_default_version => '8.4',
|
:osfamily => 'RedHat',
|
||||||
:osfamily => 'RedHat'
|
:operatingsystemrelease => '7.0',
|
||||||
|
:concat_basedir => '/var/lib/puppet/concat'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with only required parameters' do
|
context 'with only required parameters' do
|
||||||
let :params do
|
let :params do
|
||||||
required_params
|
req_params
|
||||||
end
|
end
|
||||||
|
|
||||||
it { should contain_postgresql__db('nova').with(
|
it { should contain_postgresql__server__db('nova').with(
|
||||||
:user => 'nova',
|
:user => 'nova',
|
||||||
:password => 'qwerty'
|
:password => 'md557ae0608fad632bf0155cb9502a6b454'
|
||||||
)}
|
)}
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -29,19 +35,21 @@ describe 'nova::db::postgresql' do
|
|||||||
context 'on a Debian osfamily' do
|
context 'on a Debian osfamily' do
|
||||||
let :facts do
|
let :facts do
|
||||||
{
|
{
|
||||||
:postgres_default_version => '8.4',
|
:operatingsystemrelease => '7.8',
|
||||||
:osfamily => 'Debian'
|
:operatingsystem => 'Debian',
|
||||||
|
:osfamily => 'Debian',
|
||||||
|
:concat_basedir => '/var/lib/puppet/concat'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with only required parameters' do
|
context 'with only required parameters' do
|
||||||
let :params do
|
let :params do
|
||||||
required_params
|
req_params
|
||||||
end
|
end
|
||||||
|
|
||||||
it { should contain_postgresql__db('nova').with(
|
it { should contain_postgresql__server__db('nova').with(
|
||||||
:user => 'nova',
|
:user => 'nova',
|
||||||
:password => 'qwerty'
|
:password => 'md557ae0608fad632bf0155cb9502a6b454'
|
||||||
)}
|
)}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user