Skip to content
This repository has been archived by the owner on Jun 11, 2019. It is now read-only.

Ensure NameVirtualhost is correctly created #66

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion manifests/vhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,15 @@
}
}
redhat,centos,scientific,fedora: {
include apache::redhat
if $port == '80' {
include apache::redhat
} else {
if ! defined(Apache::Listen[$port]) {
apache::listen { $port:
namevirtualhost => $ip_addr,
}
}
}
}
default: { }
}
Expand Down
29 changes: 29 additions & 0 deletions spec/defines/apache_vhost_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
require "#{File.join(File.dirname(__FILE__),'..','spec_helper.rb')}"

describe 'apache::vhost' do

let(:title) { 'apache::vhost' }
let(:node) { 'rspec.example42.com' }
let(:facts) { { :arch => 'i386' , :operatingsystem => 'redhat' } }

describe 'Test apache::virthost on redhat with default port' do
it 'should include apache::dotconf' do
should contain_apache__dotconf('00-NameVirtualHost').with_content(/NameVirtualHost \*:80/)
end
end

describe 'Test apache::virthost on redhat with other port' do
let(:params) { { 'port' => '42' } }
it 'should include apache::dotconf' do
should contain_apache__listen('42').with_namevirtualhost('*')
end
end

describe 'Test apache::virthost on redhat with other port and specific ip' do
let(:params) { { 'port' => '42', 'ip_addr' => '10.42.42.42' } }
it 'should include apache::dotconf' do
should contain_apache__listen('42').with_namevirtualhost('10.42.42.42')
end
end
end