Skip to content

Commit

Permalink
fix params for old centos version
Browse files Browse the repository at this point in the history
  • Loading branch information
kam1kaze authored and Oleksii Kravchenko committed May 13, 2015
1 parent c06908c commit 033aa5b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 68 deletions.
23 changes: 5 additions & 18 deletions manifests/params.pp
Expand Up @@ -20,28 +20,15 @@
$group = 'nobody'
$link_openssl_cnf = true
$pam_module_path = '/usr/lib64/openvpn/plugin/lib/openvpn-auth-pam.so'
$additional_packages = ['easy-rsa']
$easyrsa_source = '/usr/share/easy-rsa/2.0'

# Redhat/Centos >= 7.0
if(versioncmp($::operatingsystemrelease, '7.0') >= 0) {
$additional_packages = ['easy-rsa']
$easyrsa_source = '/usr/share/easy-rsa/2.0'
$systemd = true

# Redhat/Centos >= 6.4
} elsif(versioncmp($::operatingsystemrelease, '6.4') >= 0) {
$additional_packages = ['easy-rsa']
$easyrsa_source = '/usr/share/easy-rsa/2.0'
$systemd = false

# Redhat/Centos < 6.4 >= 6
} elsif(versioncmp($::operatingsystemrelease, '6') >= 0) {
$easyrsa_source = '/usr/share/openvpn/easy-rsa/2.0'
$systemd = false

# Redhat/Centos < 6
$systemd = true
# Redhat/Centos < 7
} else {
$easyrsa_source = '/usr/share/doc/openvpn/examples/easy-rsa/2.0'
$systemd = false
$systemd = false
}

$ldap_auth_plugin_location = undef # no ldap plugin on redhat/centos
Expand Down
26 changes: 2 additions & 24 deletions spec/classes/openvpn_install_spec.rb
Expand Up @@ -49,30 +49,8 @@

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
it { should_not contain_package('openvpn-auth-ldap') }
it { should contain_package('easy-rsa') }
end

context 'Amazon' do
Expand Down
24 changes: 1 addition & 23 deletions spec/defines/openvpn_ca_spec.rb
Expand Up @@ -98,29 +98,7 @@
} }

let(:facts) { { :osfamily => 'RedHat',
:concat_basedir => '/var/lib/puppet/concat',
:operatingsystemmajrelease => 6,
:operatingsystemrelease => '6.4' } }

context "until version 6.0" do
before do
facts[:operatingsystemmajrelease] = 5
facts[:operatingsystemrelease] = '5.1'
end
it { should contain_exec('copy easy-rsa to openvpn config folder test_server').with(
'command' => '/bin/cp -r /usr/share/doc/openvpn/examples/easy-rsa/2.0 /etc/openvpn/test_server/easy-rsa'
)}
end

context "from 6.0 to 6.4" do
before do
facts[:operatingsystemmajrelease] = 6
facts[:operatingsystemrelease] = '6.3'
end
it { should contain_exec('copy easy-rsa to openvpn config folder test_server').with(
'command' => '/bin/cp -r /usr/share/openvpn/easy-rsa/2.0 /etc/openvpn/test_server/easy-rsa'
)}
end
:concat_basedir => '/var/lib/puppet/concat' } }

it { should contain_package('easy-rsa').with('ensure' => 'present') }
it { should contain_exec('copy easy-rsa to openvpn config folder test_server').with(
Expand Down
4 changes: 1 addition & 3 deletions spec/defines/openvpn_server_spec.rb
Expand Up @@ -327,9 +327,7 @@
} }

let(:facts) { { :osfamily => 'RedHat',
:concat_basedir => '/var/lib/puppet/concat',
:operatingsystemmajrelease => 6,
:operatingsystemrelease => '6.4' } }
:concat_basedir => '/var/lib/puppet/concat' } }

it { should contain_file('/etc/openvpn/test_server.conf').with_content(%r{^group\s+nobody$}) }
it { should contain_file('/etc/openvpn/test_server.conf').with_content(%r{^plugin /usr/lib64/openvpn/plugin/lib/openvpn-auth-pam.so login$}) }
Expand Down

0 comments on commit 033aa5b

Please sign in to comment.