Skip to content

Commit

Permalink
Merge branch 'autostart_all' of https://github.com/jsok/puppet-openvpn
Browse files Browse the repository at this point in the history
…into jsok-autostart_all
  • Loading branch information
luxflux committed May 12, 2015
2 parents 5119620 + 1164b4f commit 23dddbc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
20 changes: 19 additions & 1 deletion spec/classes/openvpn_config_spec.rb
Expand Up @@ -5,10 +5,28 @@
it { should create_class('openvpn::config') }

context "on Debian based machines" do
let (:facts) { { :osfamily => 'Debian', :concat_basedir => '/var/lib/puppet/concat' } }
let (:facts) { {
:osfamily => 'Debian',
:operatingsystem => 'Debian',
:concat_basedir => '/var/lib/puppet/concat'
} }

it { should contain_concat('/etc/default/openvpn') }
it { should contain_concat__fragment('openvpn.default.header') }

context "enabled autostart_all" do
let(:pre_condition) { 'class { "openvpn": autostart_all => true }' }
it { should contain_concat__fragment('openvpn.default.header').with(
'content' => /^AUTOSTART="all"/
)}
end

context "disabled autostart_all" do
let(:pre_condition) { 'class { "openvpn": autostart_all => false }' }
it { should contain_concat__fragment('openvpn.default.header').with(
'content' => /^AUTOSTART=""/
)}
end
end

end
4 changes: 4 additions & 0 deletions templates/etc-default-openvpn.erb
Expand Up @@ -17,4 +17,8 @@
#STATUSREFRESH=0
# Optional arguments to openvpn's command line
OPTARGS=""
<% if scope.lookupvar('::openvpn::autostart_all') -%>
AUTOSTART="all"
<% else -%>
AUTOSTART=""
<% end -%>

0 comments on commit 23dddbc

Please sign in to comment.