From 0e076dec1111c4573db59f524ddb36f5f36566e6 Mon Sep 17 00:00:00 2001 From: Sebastien Badia Date: Sat, 12 Jul 2014 11:39:53 +0200 Subject: [PATCH] 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 --- manifests/params.pp | 2 +- manifests/volume/iscsi.pp | 4 +++- spec/classes/cinder_volume_iscsi_spec.rb | 28 +++++++++++++----------- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/manifests/params.pp b/manifests/params.pp index 77f01528..23101dc2 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -49,7 +49,7 @@ class cinder::params { } } default: { - $Iscsi_helper = 'tgtadm' + $iscsi_helper = 'tgtadm' } } diff --git a/manifests/volume/iscsi.pp b/manifests/volume/iscsi.pp index 4815a4dc..cb518622 100644 --- a/manifests/volume/iscsi.pp +++ b/manifests/volume/iscsi.pp @@ -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, diff --git a/spec/classes/cinder_volume_iscsi_spec.rb b/spec/classes/cinder_volume_iscsi_spec.rb index 13dc72a7..27a3c534 100644 --- a/spec/classes/cinder_volume_iscsi_spec.rb +++ b/spec/classes/cinder_volume_iscsi_spec.rb @@ -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