volume/iscsi: Fix typo and use real default iscsi_helper in tests

The default value for iscsi_helper isn't correctly configured in
volume::iscsi. This commit fix also a typo in the params class.

Closes-Bug: 1341091
Change-Id: Idcad78c78405c17518b8f4fe75e9954107b386f9
This commit is contained in:
Sebastien Badia 2014-07-12 11:39:53 +02:00
parent 18d1d2964c
commit 0e076dec11
3 changed files with 19 additions and 15 deletions

View File

@ -49,7 +49,7 @@ class cinder::params {
}
}
default: {
$Iscsi_helper = 'tgtadm'
$iscsi_helper = 'tgtadm'
}
}

View File

@ -2,9 +2,11 @@
class cinder::volume::iscsi (
$iscsi_ip_address,
$volume_group = 'cinder-volumes',
$iscsi_helper = $cinder::params::iscsi_helper,
$iscsi_helper = $::cinder::params::iscsi_helper,
) {
include cinder::params
cinder::backend::iscsi { 'DEFAULT':
iscsi_ip_address => $iscsi_ip_address,
volume_group => $volume_group,

View File

@ -2,10 +2,8 @@ require 'spec_helper'
describe 'cinder::volume::iscsi' do
let :req_params do {
:iscsi_ip_address => '127.0.0.2',
:iscsi_helper => 'tgtadm'
}
let :req_params do
{:iscsi_ip_address => '127.0.0.2'}
end
let :facts do
@ -18,18 +16,22 @@ describe 'cinder::volume::iscsi' 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'
) }
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
describe 'with a unsupported iscsi helper' do
let(:params) { req_params.merge(:iscsi_helper => 'fooboozoo')}
it 'should raise an error' do
expect {
should compile
}.to raise_error Puppet::Error, /Unsupported iscsi helper: fooboozoo/
end
end
describe 'with RedHat' do
let :params do