commit
fb153e9e31
12
.fixtures.yml
Normal file
12
.fixtures.yml
Normal file
@ -0,0 +1,12 @@
|
||||
fixtures:
|
||||
repositories:
|
||||
"apt": "git://github.com/puppetlabs/puppetlabs-apt.git"
|
||||
"keystone": "git://github.com/puppetlabs/puppetlabs-keystone.git"
|
||||
"mysql": "git://github.com/puppetlabs/puppetlabs-mysql.git"
|
||||
"stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git"
|
||||
"sysctl": "git://github.com/duritong/puppet-sysctl.git"
|
||||
"rabbitmq": "git://github.com/puppetlabs/puppetlabs-rabbitmq.git"
|
||||
'inifile': 'git://github.com/cprice-puppet/puppetlabs-inifile'
|
||||
"create_resources": 'git://github.com/puppetlabs/puppetlabs-create_resources'
|
||||
symlinks:
|
||||
"cinder": "#{source_dir}"
|
5
.gemfile
Normal file
5
.gemfile
Normal file
@ -0,0 +1,5 @@
|
||||
source :rubygems
|
||||
|
||||
puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 2.7']
|
||||
gem 'puppet', puppetversion
|
||||
gem 'puppetlabs_spec_helper', '>= 0.1.0'
|
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
spec/fixtures/modules/*
|
||||
spec/fixtures/manifests/site.pp
|
||||
*.swp
|
18
.travis.yml
Normal file
18
.travis.yml
Normal file
@ -0,0 +1,18 @@
|
||||
language: ruby
|
||||
rvm:
|
||||
- 1.8.7
|
||||
before_script:
|
||||
after_script:
|
||||
script: "rake spec"
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- folsom
|
||||
- essex
|
||||
env:
|
||||
- PUPPET_VERSION=2.7.13
|
||||
- PUPPET_VERSION=2.7.6
|
||||
- PUPPET_VERSION=2.6.9
|
||||
notifications:
|
||||
email: false
|
||||
gemfile: .gemfile
|
@ -1,8 +1,8 @@
|
||||
name 'puppet-cinder'
|
||||
version '0.0.1'
|
||||
source 'https://github.com/jtopjian/puppet-cinder'
|
||||
source 'https://github.com/puppetlabs/puppetlabs-cinder'
|
||||
author 'Joe Topjian'
|
||||
license 'Apache License 2.0'
|
||||
summary 'install openstack cinder'
|
||||
description 'install openstack cinder'
|
||||
project_page 'https://github.com/jtopjian/puppet-cinder'
|
||||
project_page 'https://github.com/puppetlabs/puppetlabs-cinder'
|
||||
|
@ -11,7 +11,7 @@ class cinder::base (
|
||||
$rabbit_virtual_host = '/',
|
||||
$rabbit_userid = 'nova',
|
||||
$package_ensure = 'present',
|
||||
$verbose = 'True'
|
||||
$verbose = 'False'
|
||||
) {
|
||||
|
||||
include cinder::params
|
||||
|
@ -4,20 +4,19 @@ class cinder::params {
|
||||
$cinder_conf = '/etc/cinder/cinder.conf'
|
||||
$cinder_paste_api_ini = '/etc/cinder/api-paste.ini'
|
||||
|
||||
case $::osfamily {
|
||||
'Debian': {
|
||||
$package_name = 'cinder-common'
|
||||
$api_package = 'cinder-api'
|
||||
$api_service = 'cinder-api'
|
||||
$scheduler_package = 'cinder-scheduler'
|
||||
$scheduler_service = 'cinder-scheduler'
|
||||
$volume_package = 'cinder-volume'
|
||||
$volume_service = 'cinder-volume'
|
||||
$db_sync_command = 'cinder-manage db sync'
|
||||
if $::osfamily == 'Debian' {
|
||||
$package_name = 'cinder-common'
|
||||
$api_package = 'cinder-api'
|
||||
$api_service = 'cinder-api'
|
||||
$scheduler_package = 'cinder-scheduler'
|
||||
$scheduler_service = 'cinder-scheduler'
|
||||
$volume_package = 'cinder-volume'
|
||||
$volume_service = 'cinder-volume'
|
||||
$db_sync_command = 'cinder-manage db sync'
|
||||
|
||||
$tgt_package_name = 'tgt'
|
||||
$tgt_service_name = 'tgt'
|
||||
|
||||
}
|
||||
$tgt_package_name = 'tgt'
|
||||
$tgt_service_name = 'tgt'
|
||||
} else {
|
||||
fail("unsuported osfamily ${::osfamily}, currently Debian is the only supported platform")
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ class cinder::volume (
|
||||
name => $::cinder::params::volume_service,
|
||||
enable => $enabled,
|
||||
ensure => $ensure,
|
||||
require => Package[$::cinder::params::volume_package],
|
||||
require => Package['cinder-volume'],
|
||||
subscribe => File[$::cinder::params::cinder_conf],
|
||||
}
|
||||
|
||||
|
50
spec/classes/cinder_api_spec.rb
Normal file
50
spec/classes/cinder_api_spec.rb
Normal file
@ -0,0 +1,50 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cinder::api' do
|
||||
|
||||
let :req_params do
|
||||
{:keystone_password => 'foo'}
|
||||
end
|
||||
let :facts do
|
||||
{:osfamily => 'Debian'}
|
||||
end
|
||||
|
||||
describe 'with only required params' do
|
||||
let :params do
|
||||
req_params
|
||||
end
|
||||
it 'should configure cinder api correctly' do
|
||||
should contain_cinder_config('DEFAULT/auth_strategy').with(
|
||||
:value => 'keystone'
|
||||
)
|
||||
should contain_cinder_api_paste_ini('filter:authtoken/service_protocol').with(
|
||||
:value => 'http'
|
||||
)
|
||||
should contain_cinder_api_paste_ini('filter:authtoken/service_host').with(
|
||||
:value => 'localhost'
|
||||
)
|
||||
should contain_cinder_api_paste_ini('filter:authtoken/service_port').with(
|
||||
:value => '5000'
|
||||
)
|
||||
should contain_cinder_api_paste_ini('filter:authtoken/auth_protocol').with(
|
||||
:value => 'http'
|
||||
)
|
||||
should contain_cinder_api_paste_ini('filter:authtoken/auth_host').with(
|
||||
:value => 'localhost'
|
||||
)
|
||||
should contain_cinder_api_paste_ini('filter:authtoken/auth_port').with(
|
||||
:value => '35357'
|
||||
)
|
||||
should contain_cinder_api_paste_ini('filter:authtoken/admin_tenant_name').with(
|
||||
:value => 'services'
|
||||
)
|
||||
should contain_cinder_api_paste_ini('filter:authtoken/admin_user').with(
|
||||
:value => 'cinder'
|
||||
)
|
||||
should contain_cinder_api_paste_ini('filter:authtoken/admin_password').with(
|
||||
:value => 'foo'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
44
spec/classes/cinder_base_spec.rb
Normal file
44
spec/classes/cinder_base_spec.rb
Normal file
@ -0,0 +1,44 @@
|
||||
require 'spec_helper'
|
||||
describe 'cinder::base' do
|
||||
let :req_params do
|
||||
{:rabbit_password => 'rpw', :sql_connection => 'mysql://user:password@host/database'}
|
||||
end
|
||||
|
||||
let :facts do
|
||||
{:osfamily => 'Debian'}
|
||||
end
|
||||
|
||||
describe 'with only required params' do
|
||||
let :params do
|
||||
req_params
|
||||
end
|
||||
|
||||
it 'should contain default config' do
|
||||
should contain_cinder_config('DEFAULT/rabbit_password').with(
|
||||
:value => 'rpw'
|
||||
)
|
||||
should contain_cinder_config('DEFAULT/rabbit_host').with(
|
||||
:value => '127.0.0.1'
|
||||
)
|
||||
should contain_cinder_config('DEFAULT/rabbit_port').with(
|
||||
:value => '5672'
|
||||
)
|
||||
should contain_cinder_config('DEFAULT/rabbit_virtual_host').with(
|
||||
:value => '/'
|
||||
)
|
||||
should contain_cinder_config('DEFAULT/rabbit_userid').with(
|
||||
:value => 'nova'
|
||||
)
|
||||
should contain_cinder_config('DEFAULT/sql_connection').with(
|
||||
:value => 'mysql://user:password@host/database'
|
||||
)
|
||||
should contain_cinder_config('DEFAULT/verbose').with(
|
||||
:value => 'False'
|
||||
)
|
||||
should contain_cinder_config('DEFAULT/api_paste_config').with(
|
||||
:value => '/etc/cinder/api-paste.ini'
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
28
spec/classes/cinder_db_mysql_spec.rb
Normal file
28
spec/classes/cinder_db_mysql_spec.rb
Normal file
@ -0,0 +1,28 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cinder::db::mysql' do
|
||||
|
||||
let :req_params do
|
||||
{:password => 'pw'}
|
||||
end
|
||||
|
||||
let :facts do
|
||||
{:osfamily => 'Debian'}
|
||||
end
|
||||
|
||||
let :pre_condition do
|
||||
'include mysql::server'
|
||||
end
|
||||
|
||||
describe 'with only required params' do
|
||||
let :params do
|
||||
req_params
|
||||
end
|
||||
it { should contain_mysql__db('cinder').with(
|
||||
:user => 'cinder',
|
||||
:password => 'pw',
|
||||
:host => '127.0.0.1',
|
||||
:charset => 'latin1'
|
||||
) }
|
||||
end
|
||||
end
|
16
spec/classes/cinder_db_sync_spec.rb
Normal file
16
spec/classes/cinder_db_sync_spec.rb
Normal file
@ -0,0 +1,16 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cinder::db::sync' do
|
||||
|
||||
let :facts do
|
||||
{:osfamily => 'Debian'}
|
||||
end
|
||||
it { should contain_exec('cinder-manage db_sync').with(
|
||||
:command => 'cinder-manage db sync',
|
||||
:path => '/usr/bin',
|
||||
:user => 'cinder',
|
||||
:refreshonly => true,
|
||||
:logoutput => 'on_failure'
|
||||
) }
|
||||
|
||||
end
|
50
spec/classes/cinder_keystone_auth_spec.rb
Normal file
50
spec/classes/cinder_keystone_auth_spec.rb
Normal file
@ -0,0 +1,50 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cinder::keystone::auth' do
|
||||
|
||||
let :req_params do
|
||||
{:password => 'pw'}
|
||||
end
|
||||
|
||||
describe 'with only required params' do
|
||||
|
||||
let :params do
|
||||
req_params
|
||||
end
|
||||
|
||||
it 'should contain auth info' do
|
||||
|
||||
should contain_keystone_user('cinder').with(
|
||||
:ensure => 'present',
|
||||
:password => 'pw',
|
||||
:email => 'cinder@localhost',
|
||||
:tenant => 'services'
|
||||
)
|
||||
should contain_keystone_user_role('cinder@services').with(
|
||||
:ensure => 'present',
|
||||
:roles => 'admin'
|
||||
)
|
||||
should contain_keystone_service('cinder').with(
|
||||
:ensure => 'present',
|
||||
:type => 'volume',
|
||||
:description => 'Cinder Service'
|
||||
)
|
||||
|
||||
end
|
||||
it { should contain_keystone_endpoint('RegionOne/cinder').with(
|
||||
:ensure => 'present',
|
||||
:public_url => 'http://127.0.0.1:8776/v1/%(tenant_id)s',
|
||||
:admin_url => 'http://127.0.0.1:8776/v1/%(tenant_id)s',
|
||||
:internal_url => 'http://127.0.0.1:8776/v1/%(tenant_id)s'
|
||||
) }
|
||||
|
||||
end
|
||||
|
||||
describe 'when endpoint should not be configured' do
|
||||
let :params do
|
||||
req_params.merge(:configure_endpoint => false)
|
||||
end
|
||||
it { should_not contain_keystone_endpoint('RegionOne/cinder') }
|
||||
end
|
||||
|
||||
end
|
12
spec/classes/cinder_params_spec.rb
Normal file
12
spec/classes/cinder_params_spec.rb
Normal file
@ -0,0 +1,12 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cinder::params' do
|
||||
|
||||
let :facts do
|
||||
{:osfamily => 'Debian'}
|
||||
end
|
||||
it 'should compile' do
|
||||
subject
|
||||
end
|
||||
|
||||
end
|
10
spec/classes/cinder_scheduler_spec.rb
Normal file
10
spec/classes/cinder_scheduler_spec.rb
Normal file
@ -0,0 +1,10 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cinder::scheduler' do
|
||||
|
||||
let :facts do
|
||||
{:osfamily => 'Debian'}
|
||||
end
|
||||
it { should contain_package('cinder-scheduler') }
|
||||
it { should contain_service('cinder-scheduler') }
|
||||
end
|
11
spec/classes/cinder_setup_test_volume_spec.rb
Normal file
11
spec/classes/cinder_setup_test_volume_spec.rb
Normal file
@ -0,0 +1,11 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cinder::setup_test_volume' do
|
||||
|
||||
it 'should contain volume creation execs' do
|
||||
should contain_exec('/bin/dd if=/dev/zero of=cinder-volumes bs=1 count=0 seek=4G')
|
||||
should contain_exec('/sbin/losetup /dev/loop2 cinder-volumes')
|
||||
should contain_exec('/sbin/pvcreate /dev/loop2')
|
||||
should contain_exec('/sbin/vgcreate cinder-volumes /dev/loop2')
|
||||
end
|
||||
end
|
31
spec/classes/cinder_volume_iscsi_spec.rb
Normal file
31
spec/classes/cinder_volume_iscsi_spec.rb
Normal file
@ -0,0 +1,31 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cinder::volume::iscsi' do
|
||||
|
||||
let :req_params do
|
||||
{:iscsi_ip_address => '127.0.0.2'}
|
||||
end
|
||||
|
||||
let :facts do
|
||||
{:osfamily => 'Debian'}
|
||||
end
|
||||
|
||||
describe 'with default params' do
|
||||
|
||||
let :params do
|
||||
req_params
|
||||
end
|
||||
|
||||
it { should contain_cinder_config('DEFAULT/iscsi_ip_address').with(
|
||||
:value => '127.0.0.2'
|
||||
) }
|
||||
it { should contain_cinder_config('DEFAULT/iscsi_helper').with(
|
||||
:value => 'tgtadm'
|
||||
) }
|
||||
it { should contain_cinder_config('DEFAULT/volume_group').with(
|
||||
:value => 'cinder-volumes'
|
||||
) }
|
||||
|
||||
end
|
||||
|
||||
end
|
15
spec/classes/cinder_volume_spec.rb
Normal file
15
spec/classes/cinder_volume_spec.rb
Normal file
@ -0,0 +1,15 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cinder::volume' do
|
||||
|
||||
let :pre_condition do
|
||||
'class { "cinder::base": rabbit_password => "fpp", sql_connection => "mysql://a:b@c/d" }'
|
||||
end
|
||||
|
||||
let :facts do
|
||||
{:osfamily => 'Debian'}
|
||||
end
|
||||
|
||||
it { should contain_package('cinder-volume') }
|
||||
it { should contain_service('cinder-volume') }
|
||||
end
|
1
spec/spec_helper.rb
Normal file
1
spec/spec_helper.rb
Normal file
@ -0,0 +1 @@
|
||||
require 'puppetlabs_spec_helper/module_spec_helper'
|
Loading…
Reference in New Issue
Block a user