Skip to content

Commit

Permalink
Merge pull request #1000 from aperto/master
Browse files Browse the repository at this point in the history
Symlinks on all distros
  • Loading branch information
Morgan Haskel committed Feb 12, 2015
2 parents 22466e5 + c00cdd4 commit 15e80c6
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion manifests/vhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@
require => Package['httpd'],
notify => Class['apache::service'],
}
if $::osfamily == 'Debian' {
if $::apache::vhost_enable_dir {
$vhost_enable_dir = $::apache::vhost_enable_dir
$vhost_symlink_ensure = $ensure ? {
present => link,
Expand Down
33 changes: 33 additions & 0 deletions spec/acceptance/vhost_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,39 @@ class { 'apache': }
end
end

context 'new vhost with enable symlink' do
it 'should configure an apache vhost and symlink it from $vhost_enable_dir' do
pp = <<-EOS
class { 'apache':
vhost_enable_dir => "#{$httpd_dir}/sites-enabled",
}
file { '#{$run_dir}':
ensure => 'directory',
recurse => true,
}
apache::vhost { 'first.example.com':
port => '80',
docroot => '/var/www/first',
require => File['#{$run_dir}'],
}
EOS
apply_manifest(pp, :catch_failures => true)
end

describe file("#{$vhost_dir}/25-first.example.com.conf") do
it { is_expected.to contain '<VirtualHost \*:80>' }
it { is_expected.to contain "ServerName first.example.com" }
end
describe file("#{$httpd_dir}/sites-enabled") do
it { is_expected.to contain_file("25-first.example.com.conf").with(
:ensure => 'link',
:path => "#{$httpd_dir}/sites-enabled/25-first.example.com.conf",
:target => "#{$vhost_dir}/25-first.example.com.conf"
) }
end
end

context 'new proxy vhost on port 80' do
it 'should configure an apache proxy vhost' do
pp = <<-EOS
Expand Down

0 comments on commit 15e80c6

Please sign in to comment.