From e09d926ba06a12e56424d3ccd321d6c2fb4e54bd Mon Sep 17 00:00:00 2001 From: Adam Malone Date: Thu, 8 Jan 2015 13:36:57 +1100 Subject: [PATCH] Don't put the cipher key in if no cipher is specified. --- spec/defines/openvpn_client_spec.rb | 6 ++++++ templates/client.erb | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/spec/defines/openvpn_client_spec.rb b/spec/defines/openvpn_client_spec.rb index 0aeffb3d..902fffb5 100644 --- a/spec/defines/openvpn_client_spec.rb +++ b/spec/defines/openvpn_client_spec.rb @@ -111,4 +111,10 @@ it { should contain_file('/etc/openvpn/test_server/download-configs/test_client/test_client.conf').with_content(/^sndbuf\s+393216$/)} it { should contain_file('/etc/openvpn/test_server/download-configs/test_client/test_client.conf').with_content(/^rcvbuf\s+393215$/)} end + + context "omitting the cipher key" do + let(:params) { { 'server' => 'test_server' } } + it { should_not contain_file('/etc/openvpn/test_server/download-configs/test_client/test_client.conf').with_content(/^cipher/) } + end + end diff --git a/templates/client.erb b/templates/client.erb index caf7ccf4..185d1bca 100644 --- a/templates/client.erb +++ b/templates/client.erb @@ -19,9 +19,9 @@ persist-key <% if @persist_tun -%> persist-tun <% end -%> -<% if @cipher -%> +<% if @cipher != '' -%> cipher <%= @cipher %> -<% end %> +<% end -%> <% if @mute_replay_warnings -%> mute-replay-warnings <% end -%>