diff --git a/manifests/params.pp b/manifests/params.pp index 66280622..a327f848 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -23,19 +23,18 @@ case $::osfamily { 'RedHat': { - # Redhat/Centos >= 6 - if($::operatingsystemmajrelease >= 6) { - # http://docs.puppetlabs.com/references/latest/function.html#versioncmp - if(versioncmp($::operatingsystemrelease, '6.4') < 0) { # Version < 6.4 - $easyrsa_source = '/usr/share/openvpn/easy-rsa/2.0' - } else { # Version >= 6.4 - $additional_packages = ['easy-rsa', 'openvpn-auth-ldap'] - $easyrsa_source = '/usr/share/easy-rsa/2.0' - $ldap_auth_plugin_location = '/usr/lib64/openvpn/plugin/lib/openvpn-auth-ldap.so' - } - } else { # Redhat/CentOS < 6 + # Redhat/Centos >= 6.4 + if(versioncmp($::operatingsystemrelease, '6.4') >= 0) { + $additional_packages = ['easy-rsa'] + $easyrsa_source = '/usr/share/easy-rsa/2.0' + + # Redhat/Centos < 6.4 + } else { $easyrsa_source = '/usr/share/doc/openvpn/examples/easy-rsa/2.0' } + + $ldap_auth_plugin_location = undef # no ldap plugin on redhat/centos + } 'Debian': { # Debian/Ubuntu case $::lsbdistid { diff --git a/spec/classes/openvpn_install_spec.rb b/spec/classes/openvpn_install_spec.rb index 6802ebf4..84c577b7 100644 --- a/spec/classes/openvpn_install_spec.rb +++ b/spec/classes/openvpn_install_spec.rb @@ -3,12 +3,14 @@ describe 'openvpn::install', :type => :class do let(:osfamily) { 'Debian' } let(:operatingsystemmajrelease) { nil } + let(:operatingsystemrelease) { nil } let(:lsbdistid) { 'Ubuntu' } let(:lsbdistrelease) { '13.10' } let(:facts) do { :osfamily => osfamily, :operatingsystemmajrelease => operatingsystemmajrelease, + :operatingsystemrelease => operatingsystemrelease, :lsbdistid => lsbdistid, :lsbdistrelease => lsbdistrelease, } @@ -43,5 +45,33 @@ it { should contain_package('easy-rsa') } end end + + context 'redhat/centos' do + let(:osfamily) { 'RedHat' } + + context '5' do + let(:operatingsystemrelease) { '5' } + it { should_not contain_package('openvpn-auth-ldap') } + it { should_not contain_package('easy-rsa') } + end + + context '6.3' do + let(:operatingsystemrelease) { '6.3' } + it { should_not contain_package('openvpn-auth-ldap') } + it { should_not contain_package('easy-rsa') } + end + + context '6.4' do + let(:operatingsystemrelease) { '6.4' } + it { should_not contain_package('openvpn-auth-ldap') } + it { should contain_package('easy-rsa') } + end + + context '7' do + let(:operatingsystemrelease) { '7' } + it { should_not contain_package('openvpn-auth-ldap') } + it { should contain_package('easy-rsa') } + end + end end end