Renames cinder::base to cinder.

This makes things consistent with other puppet openstack modules
(Nova in particular).

For backwards compat we still have a cinder::base module which
uses init.pp but prints out a warning message.

Change-Id: Ie101ae192b7ff08825809aff975f6cc6e655e6b3
This commit is contained in:
Dan Prince 2013-04-10 16:08:47 -04:00
parent 027435aa6b
commit ac1f51ce88
4 changed files with 86 additions and 52 deletions

View File

@ -16,57 +16,19 @@ class cinder::base (
$verbose = 'False'
) {
include cinder::params
warning('The "cinder::base" class is deprecated. Use "cinder" instead.')
Package['cinder'] -> Cinder_config<||>
Package['cinder'] -> Cinder_api_paste_ini<||>
package { 'cinder':
name => $::cinder::params::package_name,
ensure => $package_ensure,
}
file { $::cinder::params::cinder_conf:
ensure => present,
owner => 'cinder',
group => 'cinder',
mode => '0600',
require => Package[$::cinder::params::package_name],
}
file { $::cinder::params::cinder_paste_api_ini:
ensure => present,
owner => 'cinder',
group => 'cinder',
mode => '0600',
require => Package[$::cinder::params::package_name],
}
if $rabbit_hosts {
cinder_config {
'DEFAULT/rabbit_hosts': value => join($rabbit_hosts, ',');
}
} else {
cinder_config {
'DEFAULT/rabbit_host': value => $rabbit_host;
'DEFAULT/rabbit_port': value => $rabbit_port;
'DEFAULT/rabbit_hosts': value => "$rabbit_host:$rabbit_port";
}
}
cinder_config {
'DEFAULT/rabbit_password': value => $rabbit_password;
'DEFAULT/rabbit_virtual_host': value => $rabbit_virtual_host;
'DEFAULT/rabbit_userid': value => $rabbit_userid;
'DEFAULT/sql_connection': value => $sql_connection;
'DEFAULT/verbose': value => $verbose;
'DEFAULT/api_paste_config': value => $api_paste_config;
}
if size($rabbit_hosts) > 1 {
cinder_config { 'DEFAULT/rabbit_ha_queues': value => 'true' }
} else {
cinder_config { 'DEFAULT/rabbit_ha_queues': value => 'false' }
class { "cinder":
rabbit_password => $rabbit_password,
sql_connection => $sql_connection,
rabbit_host => $rabbit_host,
rabbit_port => $rabbit_port,
rabbit_hosts => $rabbit_hosts,
rabbit_virtual_host => $rabbit_virtual_host,
rabbit_userid => $rabbit_userid,
package_ensure => $package_ensure,
api_paste_config => $api_paste_config,
verbose => $verbose,
}
}

72
manifests/init.pp Normal file
View File

@ -0,0 +1,72 @@
#
# parameters that may need to be added
# $state_path = /opt/stack/data/cinder
# $osapi_volume_extension = cinder.api.openstack.volume.contrib.standard_extensions
# $root_helper = sudo /usr/local/bin/cinder-rootwrap /etc/cinder/rootwrap.conf
class cinder (
$rabbit_password,
$sql_connection,
$rabbit_host = '127.0.0.1',
$rabbit_port = 5672,
$rabbit_hosts = undef,
$rabbit_virtual_host = '/',
$rabbit_userid = 'nova',
$package_ensure = 'present',
$api_paste_config = '/etc/cinder/api-paste.ini',
$verbose = 'False'
) {
include cinder::params
Package['cinder'] -> Cinder_config<||>
Package['cinder'] -> Cinder_api_paste_ini<||>
package { 'cinder':
name => $::cinder::params::package_name,
ensure => $package_ensure,
}
file { $::cinder::params::cinder_conf:
ensure => present,
owner => 'cinder',
group => 'cinder',
mode => '0600',
require => Package[$::cinder::params::package_name],
}
file { $::cinder::params::cinder_paste_api_ini:
ensure => present,
owner => 'cinder',
group => 'cinder',
mode => '0600',
require => Package[$::cinder::params::package_name],
}
if $rabbit_hosts {
cinder_config {
'DEFAULT/rabbit_hosts': value => join($rabbit_hosts, ',');
}
} else {
cinder_config {
'DEFAULT/rabbit_host': value => $rabbit_host;
'DEFAULT/rabbit_port': value => $rabbit_port;
'DEFAULT/rabbit_hosts': value => "$rabbit_host:$rabbit_port";
}
}
cinder_config {
'DEFAULT/rabbit_password': value => $rabbit_password;
'DEFAULT/rabbit_virtual_host': value => $rabbit_virtual_host;
'DEFAULT/rabbit_userid': value => $rabbit_userid;
'DEFAULT/sql_connection': value => $sql_connection;
'DEFAULT/verbose': value => $verbose;
'DEFAULT/api_paste_config': value => $api_paste_config;
}
if size($rabbit_hosts) > 1 {
cinder_config { 'DEFAULT/rabbit_ha_queues': value => 'true' }
} else {
cinder_config { 'DEFAULT/rabbit_ha_queues': value => 'false' }
}
}

View File

@ -1,5 +1,5 @@
require 'spec_helper'
describe 'cinder::base' do
describe 'cinder' do
let :req_params do
{:rabbit_password => 'rpw', :sql_connection => 'mysql://user:password@host/database'}
end

View File

@ -3,7 +3,7 @@ require 'spec_helper'
describe 'cinder::volume' do
let :pre_condition do
'class { "cinder::base": rabbit_password => "fpp", sql_connection => "mysql://a:b@c/d" }'
'class { "cinder": rabbit_password => "fpp", sql_connection => "mysql://a:b@c/d" }'
end
let :facts do