Skip to content

Commit b5b45a2

Browse files
sbadiarichm
authored andcommitted
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 (cherry picked from commit 0e076de)
1 parent 0b6ffe6 commit b5b45a2

File tree

3 files changed

+19
-15
lines changed

3 files changed

+19
-15
lines changed

manifests/params.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
}
5050
}
5151
default: {
52-
$Iscsi_helper = 'tgtadm'
52+
$iscsi_helper = 'tgtadm'
5353
}
5454
}
5555

manifests/volume/iscsi.pp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
class cinder::volume::iscsi (
33
$iscsi_ip_address,
44
$volume_group = 'cinder-volumes',
5-
$iscsi_helper = $cinder::params::iscsi_helper,
5+
$iscsi_helper = $::cinder::params::iscsi_helper,
66
) {
77

8+
include cinder::params
9+
810
cinder::backend::iscsi { 'DEFAULT':
911
iscsi_ip_address => $iscsi_ip_address,
1012
volume_group => $volume_group,

spec/classes/cinder_volume_iscsi_spec.rb

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22

33
describe 'cinder::volume::iscsi' do
44

5-
let :req_params do {
6-
:iscsi_ip_address => '127.0.0.2',
7-
:iscsi_helper => 'tgtadm'
8-
}
5+
let :req_params do
6+
{:iscsi_ip_address => '127.0.0.2'}
97
end
108

119
let :facts do
@@ -18,18 +16,22 @@
1816
req_params
1917
end
2018

21-
it { should contain_cinder_config('DEFAULT/iscsi_ip_address').with(
22-
:value => '127.0.0.2'
23-
) }
24-
it { should contain_cinder_config('DEFAULT/iscsi_helper').with(
25-
:value => 'tgtadm'
26-
) }
27-
it { should contain_cinder_config('DEFAULT/volume_group').with(
28-
:value => 'cinder-volumes'
29-
) }
19+
it { should contain_cinder_config('DEFAULT/iscsi_ip_address').with(:value => '127.0.0.2')}
20+
it { should contain_cinder_config('DEFAULT/iscsi_helper').with(:value => 'tgtadm')}
21+
it { should contain_cinder_config('DEFAULT/volume_group').with(:value => 'cinder-volumes')}
3022

3123
end
3224

25+
describe 'with a unsupported iscsi helper' do
26+
let(:params) { req_params.merge(:iscsi_helper => 'fooboozoo')}
27+
28+
it 'should raise an error' do
29+
expect {
30+
should compile
31+
}.to raise_error Puppet::Error, /Unsupported iscsi helper: fooboozoo/
32+
end
33+
end
34+
3335
describe 'with RedHat' do
3436

3537
let :params do

0 commit comments

Comments
 (0)