Add glance::db::postgresql class.
This allows Glance to be used with PostgreSQL. Requires the puppetlabs/postgresql module. NOTE: I did add this dependency to fixtures but did not add it to the Modulefile due to the fact that the postgresql::python module hasn't been released to puppetforge yet (although it is committed and tests pass). Change-Id: I3522d50935c81c8859c9f597df64aa0af6ca4e71
This commit is contained in:
parent
ce05af0ea8
commit
1598196ae7
@ -6,5 +6,6 @@ fixtures:
|
|||||||
"stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git"
|
"stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git"
|
||||||
"rabbitmq": "git://github.com/puppetlabs/puppetlabs-rabbitmq.git"
|
"rabbitmq": "git://github.com/puppetlabs/puppetlabs-rabbitmq.git"
|
||||||
'inifile': 'git://github.com/cprice-puppet/puppetlabs-inifile'
|
'inifile': 'git://github.com/cprice-puppet/puppetlabs-inifile'
|
||||||
|
"postgresql": "git://github.com/puppetlabs/puppet-postgresql.git"
|
||||||
symlinks:
|
symlinks:
|
||||||
"glance": "#{source_dir}"
|
"glance": "#{source_dir}"
|
||||||
|
21
manifests/db/postgresql.pp
Normal file
21
manifests/db/postgresql.pp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#
|
||||||
|
# Class that configures postgresql for glance
|
||||||
|
#
|
||||||
|
# Requires the Puppetlabs postgresql module.
|
||||||
|
class glance::db::postgresql(
|
||||||
|
$password,
|
||||||
|
$dbname = 'glance',
|
||||||
|
$user = 'glance'
|
||||||
|
) {
|
||||||
|
|
||||||
|
require 'postgresql::python'
|
||||||
|
|
||||||
|
Postgresql::Db[$dbname] ~> Exec<| title == 'glance-manage db_sync' |>
|
||||||
|
Package['python-psycopg2'] -> Exec<| title == 'glance-manage db_sync' |>
|
||||||
|
|
||||||
|
postgresql::db { "${dbname}":
|
||||||
|
user => "${user}",
|
||||||
|
password => "${password}",
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
26
spec/classes/glance_db_postgresql_spec.rb
Normal file
26
spec/classes/glance_db_postgresql_spec.rb
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe 'glance::db::postgresql' do
|
||||||
|
|
||||||
|
let :req_params do
|
||||||
|
{:password => 'pw'}
|
||||||
|
end
|
||||||
|
|
||||||
|
let :facts do
|
||||||
|
{
|
||||||
|
:postgres_default_version => '8.4',
|
||||||
|
:osfamily => 'RedHat',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'with only required params' do
|
||||||
|
let :params do
|
||||||
|
req_params
|
||||||
|
end
|
||||||
|
it { should contain_postgresql__db('glance').with(
|
||||||
|
:user => 'glance',
|
||||||
|
:password => 'pw'
|
||||||
|
) }
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user