freighthop 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Puppetfile +4 -3
- data/Puppetfile.lock +14 -2
- data/Vagrantfile +5 -1
- data/data/common.json +4 -3
- data/freighthop.gemspec +1 -1
- data/lib/freighthop/cli/checks.rb +12 -0
- data/lib/freighthop/cli/help.rb +7 -0
- data/lib/freighthop/cli/init.rb +35 -0
- data/lib/freighthop/cli/ssh.rb +1 -0
- data/lib/freighthop/cli/vagrant.rb +1 -0
- data/lib/freighthop/cli.rb +5 -17
- data/lib/freighthop/config.rb +5 -1
- data/lib/freighthop/version.rb +1 -1
- data/lib/freighthop.rb +6 -1
- data/local_modules/freighthop/manifests/database/mysql/grant.pp +11 -0
- data/local_modules/freighthop/manifests/database/mysql.pp +5 -15
- data/local_modules/freighthop/manifests/database/postgres.pp +2 -2
- data/local_modules/freighthop/manifests/database.pp +3 -3
- data/local_modules/freighthop/manifests/init.pp +6 -23
- data/local_modules/freighthop/manifests/language/ruby.pp +5 -25
- data/local_modules/freighthop/manifests/language.pp +1 -4
- data/local_modules/freighthop/manifests/packages.pp +2 -12
- data/local_modules/freighthop/manifests/params.pp +19 -11
- data/local_modules/freighthop/manifests/web/apache.pp +60 -0
- data/local_modules/freighthop/manifests/web/nginx.pp +22 -0
- data/local_modules/freighthop/manifests/web/ssl.pp +13 -0
- data/local_modules/freighthop/manifests/web.pp +25 -21
- data/local_modules/freighthop/templates/apache/passenger.conf.erb +18 -0
- data/local_modules/freighthop/templates/nginx/vagrant-rails.conf.erb +5 -3
- data/modules/apache/CHANGELOG.md +172 -0
- data/modules/apache/CONTRIBUTING.md +234 -0
- data/modules/apache/Gemfile +25 -0
- data/modules/apache/LICENSE +15 -0
- data/modules/apache/Modulefile +12 -0
- data/modules/apache/README.md +1515 -0
- data/modules/apache/README.passenger.md +93 -0
- data/modules/apache/Rakefile +1 -0
- data/modules/apache/files/httpd +24 -0
- data/modules/apache/lib/puppet/provider/a2mod/a2mod.rb +35 -0
- data/modules/apache/lib/puppet/provider/a2mod/gentoo.rb +116 -0
- data/modules/apache/lib/puppet/provider/a2mod/modfix.rb +12 -0
- data/modules/apache/lib/puppet/provider/a2mod/redhat.rb +60 -0
- data/modules/apache/lib/puppet/provider/a2mod.rb +34 -0
- data/modules/apache/lib/puppet/type/a2mod.rb +30 -0
- data/modules/apache/manifests/balancer.pp +80 -0
- data/modules/apache/manifests/balancermember.pp +52 -0
- data/modules/apache/manifests/confd/no_accf.pp +10 -0
- data/modules/apache/manifests/default_confd_files.pp +12 -0
- data/modules/apache/manifests/default_mods/load.pp +8 -0
- data/modules/apache/manifests/default_mods.pp +108 -0
- data/modules/apache/manifests/dev.pp +11 -0
- data/modules/apache/manifests/init.pp +329 -0
- data/modules/apache/manifests/listen.pp +9 -0
- data/modules/apache/manifests/mod/alias.pp +17 -0
- data/modules/apache/manifests/mod/auth_basic.pp +3 -0
- data/modules/apache/manifests/mod/auth_kerb.pp +5 -0
- data/modules/apache/manifests/mod/authnz_ldap.pp +19 -0
- data/modules/apache/manifests/mod/autoindex.pp +12 -0
- data/modules/apache/manifests/mod/cache.pp +3 -0
- data/modules/apache/manifests/mod/cgi.pp +4 -0
- data/modules/apache/manifests/mod/cgid.pp +23 -0
- data/modules/apache/manifests/mod/dav.pp +3 -0
- data/modules/apache/manifests/mod/dav_fs.pp +20 -0
- data/modules/apache/manifests/mod/dav_svn.pp +5 -0
- data/modules/apache/manifests/mod/deflate.pp +12 -0
- data/modules/apache/manifests/mod/dev.pp +5 -0
- data/modules/apache/manifests/mod/dir.pp +21 -0
- data/modules/apache/manifests/mod/disk_cache.pp +24 -0
- data/modules/apache/manifests/mod/event.pp +54 -0
- data/modules/apache/manifests/mod/expires.pp +3 -0
- data/modules/apache/manifests/mod/fastcgi.pp +24 -0
- data/modules/apache/manifests/mod/fcgid.pp +3 -0
- data/modules/apache/manifests/mod/headers.pp +3 -0
- data/modules/apache/manifests/mod/include.pp +3 -0
- data/modules/apache/manifests/mod/info.pp +14 -0
- data/modules/apache/manifests/mod/itk.pp +64 -0
- data/modules/apache/manifests/mod/ldap.pp +12 -0
- data/modules/apache/manifests/mod/mime.pp +21 -0
- data/modules/apache/manifests/mod/mime_magic.pp +14 -0
- data/modules/apache/manifests/mod/negotiation.pp +12 -0
- data/modules/apache/manifests/mod/nss.pp +25 -0
- data/modules/apache/manifests/mod/passenger.pp +38 -0
- data/modules/apache/manifests/mod/perl.pp +3 -0
- data/modules/apache/manifests/mod/peruser.pp +73 -0
- data/modules/apache/manifests/mod/php.pp +26 -0
- data/modules/apache/manifests/mod/prefork.pp +74 -0
- data/modules/apache/manifests/mod/proxy.pp +15 -0
- data/modules/apache/manifests/mod/proxy_ajp.pp +4 -0
- data/modules/apache/manifests/mod/proxy_balancer.pp +10 -0
- data/modules/apache/manifests/mod/proxy_html.pp +28 -0
- data/modules/apache/manifests/mod/proxy_http.pp +4 -0
- data/modules/apache/manifests/mod/python.pp +5 -0
- data/modules/apache/manifests/mod/reqtimeout.pp +12 -0
- data/modules/apache/manifests/mod/rewrite.pp +4 -0
- data/modules/apache/manifests/mod/rpaf.pp +20 -0
- data/modules/apache/manifests/mod/setenvif.pp +12 -0
- data/modules/apache/manifests/mod/ssl.pp +26 -0
- data/modules/apache/manifests/mod/status.pp +42 -0
- data/modules/apache/manifests/mod/suphp.pp +14 -0
- data/modules/apache/manifests/mod/userdir.pp +17 -0
- data/modules/apache/manifests/mod/vhost_alias.pp +3 -0
- data/modules/apache/manifests/mod/worker.pp +75 -0
- data/modules/apache/manifests/mod/wsgi.pp +21 -0
- data/modules/apache/manifests/mod/xsendfile.pp +4 -0
- data/modules/apache/manifests/mod.pp +120 -0
- data/modules/apache/manifests/namevirtualhost.pp +9 -0
- data/modules/apache/manifests/package.pp +48 -0
- data/modules/apache/manifests/params.pp +207 -0
- data/modules/apache/manifests/peruser/multiplexer.pp +17 -0
- data/modules/apache/manifests/peruser/processor.pp +17 -0
- data/modules/apache/manifests/php.pp +18 -0
- data/modules/apache/manifests/proxy.pp +15 -0
- data/modules/apache/manifests/python.pp +18 -0
- data/modules/apache/manifests/service.pp +35 -0
- data/modules/apache/manifests/ssl.pp +18 -0
- data/modules/apache/manifests/vhost.pp +516 -0
- data/modules/apache/spec/acceptance/basic_spec.rb +12 -0
- data/modules/apache/spec/acceptance/class_spec.rb +58 -0
- data/modules/apache/spec/acceptance/default_mods_spec.rb +97 -0
- data/modules/apache/spec/acceptance/itk_spec.rb +35 -0
- data/modules/apache/spec/acceptance/mod_php_spec.rb +52 -0
- data/modules/apache/spec/acceptance/mod_suphp_spec.rb +44 -0
- data/modules/apache/spec/acceptance/nodesets/centos-64-x64.yml +8 -0
- data/modules/apache/spec/acceptance/nodesets/default.yml +8 -0
- data/modules/apache/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml +8 -0
- data/modules/apache/spec/acceptance/nodesets/vagrant.key +27 -0
- data/modules/apache/spec/acceptance/prefork_worker_spec.rb +81 -0
- data/modules/apache/spec/acceptance/service_spec.rb +19 -0
- data/modules/apache/spec/acceptance/vhost_spec.rb +290 -0
- data/modules/apache/spec/classes/apache_spec.rb +464 -0
- data/modules/apache/spec/classes/dev_spec.rb +38 -0
- data/modules/apache/spec/classes/mod/auth_kerb_spec.rb +41 -0
- data/modules/apache/spec/classes/mod/authnz_ldap_spec.rb +65 -0
- data/modules/apache/spec/classes/mod/dav_svn_spec.rb +41 -0
- data/modules/apache/spec/classes/mod/dev_spec.rb +23 -0
- data/modules/apache/spec/classes/mod/dir_spec.rb +88 -0
- data/modules/apache/spec/classes/mod/event_spec.rb +17 -0
- data/modules/apache/spec/classes/mod/fastcgi_spec.rb +32 -0
- data/modules/apache/spec/classes/mod/fcgid_spec.rb +41 -0
- data/modules/apache/spec/classes/mod/info_spec.rb +99 -0
- data/modules/apache/spec/classes/mod/itk_spec.rb +31 -0
- data/modules/apache/spec/classes/mod/mime_magic_spec.rb +93 -0
- data/modules/apache/spec/classes/mod/passenger_spec.rb +112 -0
- data/modules/apache/spec/classes/mod/perl_spec.rb +41 -0
- data/modules/apache/spec/classes/mod/peruser_spec.rb +17 -0
- data/modules/apache/spec/classes/mod/php_spec.rb +99 -0
- data/modules/apache/spec/classes/mod/prefork_spec.rb +47 -0
- data/modules/apache/spec/classes/mod/proxy_html_spec.rb +45 -0
- data/modules/apache/spec/classes/mod/python_spec.rb +41 -0
- data/modules/apache/spec/classes/mod/rpaf_spec.rb +77 -0
- data/modules/apache/spec/classes/mod/ssl_spec.rb +53 -0
- data/modules/apache/spec/classes/mod/status_spec.rb +166 -0
- data/modules/apache/spec/classes/mod/suphp_spec.rb +27 -0
- data/modules/apache/spec/classes/mod/worker_spec.rb +44 -0
- data/modules/apache/spec/classes/mod/wsgi_spec.rb +54 -0
- data/modules/apache/spec/classes/params_spec.rb +21 -0
- data/modules/apache/spec/classes/service_spec.rb +109 -0
- data/modules/apache/spec/defines/mod_spec.rb +105 -0
- data/modules/apache/spec/defines/vhost_spec.rb +1152 -0
- data/modules/apache/spec/fixtures/modules/site_apache/templates/fake.conf.erb +1 -0
- data/modules/apache/spec/spec.opts +4 -0
- data/modules/apache/spec/spec_helper.rb +1 -0
- data/modules/apache/spec/spec_helper_acceptance.rb +27 -0
- data/modules/apache/spec/unit/provider/a2mod/gentoo_spec.rb +184 -0
- data/modules/apache/templates/confd/no-accf.conf.erb +4 -0
- data/modules/apache/templates/httpd.conf.erb +92 -0
- data/modules/apache/templates/listen.erb +6 -0
- data/modules/apache/templates/mod/alias.conf.erb +9 -0
- data/modules/apache/templates/mod/authnz_ldap.conf.erb +5 -0
- data/modules/apache/templates/mod/autoindex.conf.erb +56 -0
- data/modules/apache/templates/mod/cgid.conf.erb +1 -0
- data/modules/apache/templates/mod/dav_fs.conf.erb +1 -0
- data/modules/apache/templates/mod/deflate.conf.erb +4 -0
- data/modules/apache/templates/mod/dir.conf.erb +1 -0
- data/modules/apache/templates/mod/disk_cache.conf.erb +8 -0
- data/modules/apache/templates/mod/event.conf.erb +9 -0
- data/modules/apache/templates/mod/fastcgi.conf.erb +6 -0
- data/modules/apache/templates/mod/info.conf.erb +6 -0
- data/modules/apache/templates/mod/itk.conf.erb +8 -0
- data/modules/apache/templates/mod/ldap.conf.erb +7 -0
- data/modules/apache/templates/mod/mime.conf.erb +36 -0
- data/modules/apache/templates/mod/mime_magic.conf.erb +1 -0
- data/modules/apache/templates/mod/mpm_event.conf.erb +9 -0
- data/modules/apache/templates/mod/negotiation.conf.erb +2 -0
- data/modules/apache/templates/mod/nss.conf.erb +228 -0
- data/modules/apache/templates/mod/passenger.conf.erb +30 -0
- data/modules/apache/templates/mod/peruser.conf.erb +12 -0
- data/modules/apache/templates/mod/php5.conf.erb +30 -0
- data/modules/apache/templates/mod/prefork.conf.erb +8 -0
- data/modules/apache/templates/mod/proxy.conf.erb +23 -0
- data/modules/apache/templates/mod/proxy_html.conf.erb +24 -0
- data/modules/apache/templates/mod/reqtimeout.conf.erb +2 -0
- data/modules/apache/templates/mod/rpaf.conf.erb +15 -0
- data/modules/apache/templates/mod/setenvif.conf.erb +34 -0
- data/modules/apache/templates/mod/ssl.conf.erb +24 -0
- data/modules/apache/templates/mod/status.conf.erb +12 -0
- data/modules/apache/templates/mod/suphp.conf.erb +19 -0
- data/modules/apache/templates/mod/userdir.conf.erb +19 -0
- data/modules/apache/templates/mod/worker.conf.erb +9 -0
- data/modules/apache/templates/mod/wsgi.conf.erb +13 -0
- data/modules/apache/templates/namevirtualhost.erb +8 -0
- data/modules/apache/templates/ports_header.erb +5 -0
- data/modules/apache/templates/vhost/_aliases.erb +12 -0
- data/modules/apache/templates/vhost/_block.erb +10 -0
- data/modules/apache/templates/vhost/_custom_fragment.erb +5 -0
- data/modules/apache/templates/vhost/_directories.erb +143 -0
- data/modules/apache/templates/vhost/_error_document.erb +7 -0
- data/modules/apache/templates/vhost/_fastcgi.erb +18 -0
- data/modules/apache/templates/vhost/_itk.erb +28 -0
- data/modules/apache/templates/vhost/_php_admin.erb +12 -0
- data/modules/apache/templates/vhost/_proxy.erb +20 -0
- data/modules/apache/templates/vhost/_rack.erb +7 -0
- data/modules/apache/templates/vhost/_redirect.erb +12 -0
- data/modules/apache/templates/vhost/_requestheader.erb +10 -0
- data/modules/apache/templates/vhost/_rewrite.erb +40 -0
- data/modules/apache/templates/vhost/_scriptalias.erb +24 -0
- data/modules/apache/templates/vhost/_serveralias.erb +7 -0
- data/modules/apache/templates/vhost/_setenv.erb +12 -0
- data/modules/apache/templates/vhost/_ssl.erb +41 -0
- data/modules/apache/templates/vhost/_suphp.erb +11 -0
- data/modules/apache/templates/vhost/_wsgi.erb +15 -0
- data/modules/apache/templates/vhost.conf.erb +63 -0
- data/modules/apache/tests/apache.pp +6 -0
- data/modules/apache/tests/dev.pp +1 -0
- data/modules/apache/tests/init.pp +1 -0
- data/modules/apache/tests/mod_load_params.pp +11 -0
- data/modules/apache/tests/mods.pp +9 -0
- data/modules/apache/tests/mods_custom.pp +16 -0
- data/modules/apache/tests/php.pp +4 -0
- data/modules/apache/tests/vhost.pp +237 -0
- data/modules/apache/tests/vhost_directories.pp +30 -0
- data/modules/apache/tests/vhost_ip_based.pp +25 -0
- data/modules/apache/tests/vhost_ssl.pp +23 -0
- data/modules/apache/tests/vhosts_without_listen.pp +53 -0
- data/modules/freighthop/manifests/database/mysql/grant.pp +11 -0
- data/modules/freighthop/manifests/database/mysql.pp +5 -15
- data/modules/freighthop/manifests/database/postgres.pp +2 -2
- data/modules/freighthop/manifests/database.pp +3 -3
- data/modules/freighthop/manifests/init.pp +6 -23
- data/modules/freighthop/manifests/language/ruby.pp +5 -25
- data/modules/freighthop/manifests/language.pp +1 -4
- data/modules/freighthop/manifests/packages.pp +2 -12
- data/modules/freighthop/manifests/params.pp +19 -11
- data/modules/freighthop/manifests/web/apache.pp +60 -0
- data/modules/freighthop/manifests/web/nginx.pp +22 -0
- data/modules/freighthop/manifests/web/ssl.pp +13 -0
- data/modules/freighthop/manifests/web.pp +25 -21
- data/modules/freighthop/templates/apache/passenger.conf.erb +18 -0
- data/modules/freighthop/templates/nginx/vagrant-rails.conf.erb +5 -3
- data/modules/rbenv/AUTHORS +11 -0
- data/modules/rbenv/CHANGELOG.md +70 -0
- data/modules/rbenv/Gemfile +5 -10
- data/modules/rbenv/Gemfile.lock +16 -58
- data/modules/rbenv/Modulefile +7 -7
- data/modules/rbenv/README.md +156 -20
- data/modules/rbenv/Rakefile +18 -24
- data/modules/rbenv/TODO +10 -0
- data/modules/rbenv/bin/autospec +16 -0
- data/modules/rbenv/bin/facter +16 -0
- data/modules/rbenv/bin/filebucket +16 -0
- data/modules/rbenv/bin/hiera +16 -0
- data/modules/rbenv/bin/htmldiff +16 -0
- data/modules/rbenv/bin/ldiff +16 -0
- data/modules/rbenv/bin/pi +16 -0
- data/modules/rbenv/bin/puppet +16 -0
- data/modules/rbenv/bin/puppet-lint +16 -0
- data/modules/rbenv/bin/puppet-module +16 -0
- data/modules/rbenv/bin/puppetca +16 -0
- data/modules/rbenv/bin/puppetd +16 -0
- data/modules/rbenv/bin/puppetdoc +16 -0
- data/modules/rbenv/bin/puppetmasterd +16 -0
- data/modules/rbenv/bin/puppetqd +16 -0
- data/modules/rbenv/bin/puppetrun +16 -0
- data/modules/rbenv/bin/rake +16 -0
- data/modules/rbenv/bin/ralsh +16 -0
- data/modules/rbenv/bin/rspec +16 -0
- data/modules/rbenv/bin/rspec-puppet-init +16 -0
- data/modules/rbenv/lib/puppet/provider/rbenvgem/default.rb +50 -0
- data/modules/rbenv/lib/puppet/type/rbenvgem.rb +62 -0
- data/modules/rbenv/manifests/bundle.pp +36 -0
- data/modules/rbenv/manifests/client.pp +48 -0
- data/modules/rbenv/manifests/compile.pp +102 -0
- data/modules/rbenv/manifests/definition.pp +31 -0
- data/modules/rbenv/manifests/dependencies/centos.pp +25 -0
- data/modules/rbenv/manifests/dependencies/suse.pp +28 -0
- data/modules/rbenv/manifests/dependencies/ubuntu.pp +17 -0
- data/modules/rbenv/manifests/dependencies.pp +8 -0
- data/modules/rbenv/manifests/gem.pp +29 -0
- data/modules/rbenv/manifests/install.pp +55 -0
- data/modules/rbenv/manifests/plugin/rbenvvars.pp +16 -0
- data/modules/rbenv/manifests/plugin/rubybuild.pp +16 -0
- data/modules/rbenv/manifests/plugin.pp +40 -0
- data/modules/rbenv/metadata.json +99 -31
- data/modules/rbenv/spec/classes/dependencies_spec.rb +20 -0
- data/modules/rbenv/spec/defines/rbenv__compile_spec.rb +34 -0
- data/modules/rbenv/spec/defines/rbenv__definition_spec.rb +40 -0
- data/modules/rbenv/spec/defines/rbenv__install_spec.rb +24 -0
- data/modules/rbenv/spec/defines/rbenv__plugin__rbenvvars_spec.rb +14 -0
- data/modules/rbenv/spec/defines/rbenv__plugin__rubybuild_spec.rb +14 -0
- data/modules/rbenv/spec/defines/rbenv__plugin_spec.rb +31 -0
- data/modules/rbenv/spec/fixtures/manifests/site.pp +0 -0
- data/modules/rbenv/spec/spec_helper.rb +6 -1
- data/modules/rbenv/templates/Gemfile.erb +5 -0
- data/modules/rbenv/templates/dot.rbenvrc.erb +8 -0
- metadata +271 -23
- data/modules/rbenv/CHANGELOG +0 -33
- data/modules/rbenv/LICENSE +0 -20
- data/modules/rbenv/manifests/alias.pp +0 -32
- data/modules/rbenv/manifests/global.pp +0 -22
- data/modules/rbenv/manifests/init.pp +0 -30
- data/modules/rbenv/manifests/params.pp +0 -16
- data/modules/rbenv/manifests/rehash.pp +0 -28
- data/modules/rbenv/manifests/version.pp +0 -63
- data/modules/rbenv/spec/classes/rbenv__global_spec.rb +0 -31
- data/modules/rbenv/spec/classes/rbenv_spec.rb +0 -30
- data/modules/rbenv/spec/defines/rbenv__alias_spec.rb +0 -22
- data/modules/rbenv/spec/defines/rbenv__rehash_spec.rb +0 -22
- data/modules/rbenv/spec/defines/rbenv__version_spec.rb +0 -60
- data/modules/rbenv/spec/spec_helper_system.rb +0 -16
- data/modules/rbenv/spec/system/basic_spec.rb +0 -13
- data/modules/rbenv/templates/etc/profile.d/rbenv.sh.erb +0 -2
- data/modules/rbenv/tests/init.pp +0 -12
@@ -0,0 +1,1152 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'apache::vhost', :type => :define do
|
4
|
+
let :pre_condition do
|
5
|
+
'class { "apache": default_vhost => false, }'
|
6
|
+
end
|
7
|
+
let :title do
|
8
|
+
'rspec.example.com'
|
9
|
+
end
|
10
|
+
let :default_params do
|
11
|
+
{
|
12
|
+
:docroot => '/rspec/docroot',
|
13
|
+
:port => '84',
|
14
|
+
}
|
15
|
+
end
|
16
|
+
describe 'os-dependent items' do
|
17
|
+
context "on RedHat based systems" do
|
18
|
+
let :default_facts do
|
19
|
+
{
|
20
|
+
:osfamily => 'RedHat',
|
21
|
+
:operatingsystemrelease => '6',
|
22
|
+
:concat_basedir => '/dne',
|
23
|
+
}
|
24
|
+
end
|
25
|
+
let :params do default_params end
|
26
|
+
let :facts do default_facts end
|
27
|
+
it { should contain_class("apache") }
|
28
|
+
it { should contain_class("apache::params") }
|
29
|
+
end
|
30
|
+
context "on Debian based systems" do
|
31
|
+
let :default_facts do
|
32
|
+
{
|
33
|
+
:osfamily => 'Debian',
|
34
|
+
:operatingsystemrelease => '6',
|
35
|
+
:concat_basedir => '/dne',
|
36
|
+
}
|
37
|
+
end
|
38
|
+
let :params do default_params end
|
39
|
+
let :facts do default_facts end
|
40
|
+
it { should contain_class("apache") }
|
41
|
+
it { should contain_class("apache::params") }
|
42
|
+
it { should contain_file("25-rspec.example.com.conf").with(
|
43
|
+
:ensure => 'present',
|
44
|
+
:path => '/etc/apache2/sites-available/25-rspec.example.com.conf'
|
45
|
+
) }
|
46
|
+
it { should contain_file("25-rspec.example.com.conf symlink").with(
|
47
|
+
:ensure => 'link',
|
48
|
+
:path => '/etc/apache2/sites-enabled/25-rspec.example.com.conf',
|
49
|
+
:target => '/etc/apache2/sites-available/25-rspec.example.com.conf'
|
50
|
+
) }
|
51
|
+
end
|
52
|
+
context "on FreeBSD systems" do
|
53
|
+
let :default_facts do
|
54
|
+
{
|
55
|
+
:osfamily => 'FreeBSD',
|
56
|
+
:operatingsystemrelease => '9',
|
57
|
+
:concat_basedir => '/dne',
|
58
|
+
}
|
59
|
+
end
|
60
|
+
let :params do default_params end
|
61
|
+
let :facts do default_facts end
|
62
|
+
it { should contain_class("apache") }
|
63
|
+
it { should contain_class("apache::params") }
|
64
|
+
it { should contain_file("25-rspec.example.com.conf").with(
|
65
|
+
:ensure => 'present',
|
66
|
+
:path => '/usr/local/etc/apache22/Vhosts/25-rspec.example.com.conf'
|
67
|
+
) }
|
68
|
+
end
|
69
|
+
end
|
70
|
+
describe 'os-independent items' do
|
71
|
+
let :facts do
|
72
|
+
{
|
73
|
+
:osfamily => 'Debian',
|
74
|
+
:operatingsystemrelease => '6',
|
75
|
+
:concat_basedir => '/dne',
|
76
|
+
}
|
77
|
+
end
|
78
|
+
describe 'basic assumptions' do
|
79
|
+
let :params do default_params end
|
80
|
+
it { should contain_class("apache") }
|
81
|
+
it { should contain_class("apache::params") }
|
82
|
+
it { should contain_apache__listen(params[:port]) }
|
83
|
+
it { should contain_apache__namevirtualhost("*:#{params[:port]}") }
|
84
|
+
end
|
85
|
+
|
86
|
+
# All match and notmatch should be a list of regexs and exact match strings
|
87
|
+
context ".conf content" do
|
88
|
+
[
|
89
|
+
{
|
90
|
+
:title => 'should contain docroot',
|
91
|
+
:attr => 'docroot',
|
92
|
+
:value => '/not/default',
|
93
|
+
:match => [/^ DocumentRoot \/not\/default$/,/ <Directory \/not\/default>/],
|
94
|
+
},
|
95
|
+
{
|
96
|
+
:title => 'should set a port',
|
97
|
+
:attr => 'port',
|
98
|
+
:value => '8080',
|
99
|
+
:match => [/^<VirtualHost \*:8080>$/],
|
100
|
+
},
|
101
|
+
{
|
102
|
+
:title => 'should set an ip',
|
103
|
+
:attr => 'ip',
|
104
|
+
:value => '10.0.0.1',
|
105
|
+
:match => [/^<VirtualHost 10\.0\.0\.1:84>$/],
|
106
|
+
},
|
107
|
+
{
|
108
|
+
:title => 'should set a serveradmin',
|
109
|
+
:attr => 'serveradmin',
|
110
|
+
:value => 'test@test.com',
|
111
|
+
:match => [/^ ServerAdmin test@test.com$/],
|
112
|
+
},
|
113
|
+
{
|
114
|
+
:title => 'should enable ssl',
|
115
|
+
:attr => 'ssl',
|
116
|
+
:value => true,
|
117
|
+
:match => [/^ SSLEngine on$/],
|
118
|
+
},
|
119
|
+
{
|
120
|
+
:title => 'should set a servername',
|
121
|
+
:attr => 'servername',
|
122
|
+
:value => 'param.test',
|
123
|
+
:match => [/^ ServerName param.test$/],
|
124
|
+
},
|
125
|
+
{
|
126
|
+
:title => 'should accept server aliases',
|
127
|
+
:attr => 'serveraliases',
|
128
|
+
:value => ['one.com','two.com'],
|
129
|
+
:match => [
|
130
|
+
/^ ServerAlias one\.com$/,
|
131
|
+
/^ ServerAlias two\.com$/
|
132
|
+
],
|
133
|
+
},
|
134
|
+
{
|
135
|
+
:title => 'should accept setenv',
|
136
|
+
:attr => 'setenv',
|
137
|
+
:value => ['TEST1 one','TEST2 two'],
|
138
|
+
:match => [
|
139
|
+
/^ SetEnv TEST1 one$/,
|
140
|
+
/^ SetEnv TEST2 two$/
|
141
|
+
],
|
142
|
+
},
|
143
|
+
{
|
144
|
+
:title => 'should accept setenvif',
|
145
|
+
:attr => 'setenvif',
|
146
|
+
## These are bugged in rspec-puppet; the $1 is droped
|
147
|
+
#:value => ['Host "^([^\.]*)\.website\.com$" CLIENT_NAME=$1'],
|
148
|
+
#:match => [' SetEnvIf Host "^([^\.]*)\.website\.com$" CLIENT_NAME=$1'],
|
149
|
+
:value => ['Host "^test\.com$" VHOST_ACCESS=test'],
|
150
|
+
:match => [/^ SetEnvIf Host "\^test\\.com\$" VHOST_ACCESS=test$/],
|
151
|
+
},
|
152
|
+
{
|
153
|
+
:title => 'should accept options',
|
154
|
+
:attr => 'options',
|
155
|
+
:value => ['Fake','Options'],
|
156
|
+
:match => [/^ Options Fake Options$/],
|
157
|
+
},
|
158
|
+
{
|
159
|
+
:title => 'should accept overrides',
|
160
|
+
:attr => 'override',
|
161
|
+
:value => ['Fake', 'Override'],
|
162
|
+
:match => [/^ AllowOverride Fake Override$/],
|
163
|
+
},
|
164
|
+
{
|
165
|
+
:title => 'should accept logroot',
|
166
|
+
:attr => 'logroot',
|
167
|
+
:value => '/fake/log',
|
168
|
+
:match => [/CustomLog \/fake\/log\//,/ErrorLog \/fake\/log\//],
|
169
|
+
},
|
170
|
+
{
|
171
|
+
:title => 'should accept log_level',
|
172
|
+
:attr => 'log_level',
|
173
|
+
:value => 'info',
|
174
|
+
:match => [/LogLevel info/],
|
175
|
+
},
|
176
|
+
{
|
177
|
+
:title => 'should accept pipe destination for access log',
|
178
|
+
:attr => 'access_log_pipe',
|
179
|
+
:value => '| /bin/fake/logging',
|
180
|
+
:match => [/CustomLog "| \/bin\/fake\/logging" combined$/],
|
181
|
+
},
|
182
|
+
{
|
183
|
+
:title => 'should accept pipe destination for error log',
|
184
|
+
:attr => 'error_log_pipe',
|
185
|
+
:value => '| /bin/fake/logging',
|
186
|
+
:match => [/ErrorLog "| \/bin\/fake\/logging" combined$/],
|
187
|
+
},
|
188
|
+
{
|
189
|
+
:title => 'should accept syslog destination for access log',
|
190
|
+
:attr => 'access_log_syslog',
|
191
|
+
:value => 'syslog:local1',
|
192
|
+
:match => [/CustomLog syslog:local1 combined$/],
|
193
|
+
},
|
194
|
+
{
|
195
|
+
:title => 'should accept syslog destination for error log',
|
196
|
+
:attr => 'error_log_syslog',
|
197
|
+
:value => 'syslog',
|
198
|
+
:match => [/ErrorLog syslog$/],
|
199
|
+
},
|
200
|
+
{
|
201
|
+
:title => 'should accept custom format for access logs',
|
202
|
+
:attr => 'access_log_format',
|
203
|
+
:value => '%h %{X-Forwarded-For}i %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\" \"Host: %{Host}i\" %T %D',
|
204
|
+
:match => [/CustomLog \/var\/log\/.+_access\.log "%h %\{X-Forwarded-For\}i %l %u %t \\"%r\\" %s %b \\"%\{Referer\}i\\" \\"%\{User-agent\}i\\" \\"Host: %\{Host\}i\\" %T %D"$/],
|
205
|
+
},
|
206
|
+
{
|
207
|
+
:title => 'should contain access logs',
|
208
|
+
:attr => 'access_log',
|
209
|
+
:value => true,
|
210
|
+
:match => [/CustomLog \/var\/log\/.+_access\.log combined$/],
|
211
|
+
},
|
212
|
+
{
|
213
|
+
:title => 'should not contain access logs',
|
214
|
+
:attr => 'access_log',
|
215
|
+
:value => false,
|
216
|
+
:notmatch => [/CustomLog \/var\/log\/.+_access\.log combined$/],
|
217
|
+
},
|
218
|
+
{
|
219
|
+
:title => 'should contain error logs',
|
220
|
+
:attr => 'error_log',
|
221
|
+
:value => true,
|
222
|
+
:match => [/ErrorLog.+$/],
|
223
|
+
},
|
224
|
+
{
|
225
|
+
:title => 'should not contain error logs',
|
226
|
+
:attr => 'error_log',
|
227
|
+
:value => false,
|
228
|
+
:notmatch => [/ErrorLog.+$/],
|
229
|
+
},
|
230
|
+
{
|
231
|
+
:title => 'should set ErrorDocument 503',
|
232
|
+
:attr => 'error_documents',
|
233
|
+
:value => [ { 'error_code' => '503', 'document' => '"Go away, the backend is broken."'}],
|
234
|
+
:match => [/^ ErrorDocument 503 "Go away, the backend is broken."$/],
|
235
|
+
},
|
236
|
+
{
|
237
|
+
:title => 'should set ErrorDocuments 503 407',
|
238
|
+
:attr => 'error_documents',
|
239
|
+
:value => [
|
240
|
+
{ 'error_code' => '503', 'document' => '/service-unavail'},
|
241
|
+
{ 'error_code' => '407', 'document' => 'https://example.com/proxy/login'},
|
242
|
+
],
|
243
|
+
:match => [
|
244
|
+
/^ ErrorDocument 503 \/service-unavail$/,
|
245
|
+
/^ ErrorDocument 407 https:\/\/example\.com\/proxy\/login$/,
|
246
|
+
],
|
247
|
+
},
|
248
|
+
{
|
249
|
+
:title => 'should set ErrorDocument 503 in directory',
|
250
|
+
:attr => 'directories',
|
251
|
+
:value => { 'path' => '/srv/www', 'error_documents' => [{ 'error_code' => '503', 'document' => '"Go away, the backend is broken."'}] },
|
252
|
+
:match => [/^ ErrorDocument 503 "Go away, the backend is broken."$/],
|
253
|
+
},
|
254
|
+
{
|
255
|
+
:title => 'should set ErrorDocuments 503 407 in directory',
|
256
|
+
:attr => 'directories',
|
257
|
+
:value => { 'path' => '/srv/www', 'error_documents' =>
|
258
|
+
[
|
259
|
+
{ 'error_code' => '503', 'document' => '/service-unavail'},
|
260
|
+
{ 'error_code' => '407', 'document' => 'https://example.com/proxy/login'},
|
261
|
+
]},
|
262
|
+
:match => [
|
263
|
+
/^ ErrorDocument 503 \/service-unavail$/,
|
264
|
+
/^ ErrorDocument 407 https:\/\/example\.com\/proxy\/login$/,
|
265
|
+
],
|
266
|
+
},
|
267
|
+
{
|
268
|
+
:title => 'should accept a scriptalias',
|
269
|
+
:attr => 'scriptalias',
|
270
|
+
:value => '/usr/scripts',
|
271
|
+
:match => [
|
272
|
+
/^ ScriptAlias \/cgi-bin\/ \/usr\/scripts$/,
|
273
|
+
],
|
274
|
+
},
|
275
|
+
{
|
276
|
+
:title => 'should accept a single scriptaliases',
|
277
|
+
:attr => 'scriptaliases',
|
278
|
+
:value => { 'alias' => '/blah/', 'path' => '/usr/scripts' },
|
279
|
+
:match => [
|
280
|
+
/^ ScriptAlias \/blah\/ \/usr\/scripts$/,
|
281
|
+
],
|
282
|
+
:nomatch => [/ScriptAlias \/cgi\-bin\//],
|
283
|
+
},
|
284
|
+
{
|
285
|
+
:title => 'should accept multiple scriptaliases',
|
286
|
+
:attr => 'scriptaliases',
|
287
|
+
:value => [ { 'alias' => '/blah', 'path' => '/usr/scripts' }, { 'alias' => '/blah2', 'path' => '/usr/scripts' } ],
|
288
|
+
:match => [
|
289
|
+
/^ ScriptAlias \/blah \/usr\/scripts$/,
|
290
|
+
/^ ScriptAlias \/blah2 \/usr\/scripts$/,
|
291
|
+
],
|
292
|
+
:nomatch => [/ScriptAlias \/cgi\-bin\//],
|
293
|
+
},
|
294
|
+
{
|
295
|
+
:title => 'should accept multiple scriptaliases with and without trailing slashes',
|
296
|
+
:attr => 'scriptaliases',
|
297
|
+
:value => [ { 'alias' => '/blah', 'path' => '/usr/scripts' }, { 'alias' => '/blah2/', 'path' => '/usr/scripts2/' } ],
|
298
|
+
:match => [
|
299
|
+
/^ ScriptAlias \/blah \/usr\/scripts$/,
|
300
|
+
/^ ScriptAlias \/blah2\/ \/usr\/scripts2\/$/,
|
301
|
+
],
|
302
|
+
:nomatch => [/ScriptAlias \/cgi\-bin\//],
|
303
|
+
},
|
304
|
+
{
|
305
|
+
:title => 'should accept a ScriptAliasMatch directive',
|
306
|
+
:attr => 'scriptaliases',
|
307
|
+
## XXX As mentioned above, rspec-puppet drops constructs like $1.
|
308
|
+
## Thus, these tests don't work as they should. As a workaround we
|
309
|
+
## use FOO instead of $1 here.
|
310
|
+
:value => [ { 'aliasmatch' => '^/cgi-bin(.*)', 'path' => '/usr/local/apache/cgi-binFOO' } ],
|
311
|
+
:match => [
|
312
|
+
/^ ScriptAliasMatch \^\/cgi-bin\(\.\*\) \/usr\/local\/apache\/cgi-binFOO$/
|
313
|
+
],
|
314
|
+
},
|
315
|
+
{
|
316
|
+
:title => 'should accept multiple ScriptAliasMatch directives',
|
317
|
+
:attr => 'scriptaliases',
|
318
|
+
## XXX As mentioned above, rspec-puppet drops constructs like $1.
|
319
|
+
## Thus, these tests don't work as they should. As a workaround we
|
320
|
+
## use FOO instead of $1 here.
|
321
|
+
:value => [
|
322
|
+
{ 'aliasmatch' => '^/cgi-bin(.*)', 'path' => '/usr/local/apache/cgi-binFOO' },
|
323
|
+
{ 'aliasmatch' => '"(?x)^/git/(.*/(HEAD|info/refs|objects/(info/[^/]+|[0-9a-f]{2}/[0-9a-f]{38}|pack/pack-[0-9a-f]{40}\.(pack|idx))|git-(upload|receive)-pack))"', 'path' => '/var/www/bin/gitolite-suexec-wrapper/FOO' },
|
324
|
+
],
|
325
|
+
:match => [
|
326
|
+
/^ ScriptAliasMatch \^\/cgi-bin\(\.\*\) \/usr\/local\/apache\/cgi-binFOO$/,
|
327
|
+
/^ ScriptAliasMatch "\(\?x\)\^\/git\/\(\.\*\/\(HEAD\|info\/refs\|objects\/\(info\/\[\^\/\]\+\|\[0-9a-f\]\{2\}\/\[0-9a-f\]\{38\}\|pack\/pack-\[0-9a-f\]\{40\}\\\.\(pack\|idx\)\)\|git-\(upload\|receive\)-pack\)\)" \/var\/www\/bin\/gitolite-suexec-wrapper\/FOO$/,
|
328
|
+
],
|
329
|
+
},
|
330
|
+
{
|
331
|
+
:title => 'should accept mixed ScriptAlias and ScriptAliasMatch directives',
|
332
|
+
:attr => 'scriptaliases',
|
333
|
+
## XXX As mentioned above, rspec-puppet drops constructs like $1.
|
334
|
+
## Thus, these tests don't work as they should. As a workaround we
|
335
|
+
## use FOO instead of $1 here.
|
336
|
+
:value => [
|
337
|
+
{ 'aliasmatch' => '"(?x)^/git/(.*/(HEAD|info/refs|objects/(info/[^/]+|[0-9a-f]{2}/[0-9a-f]{38}|pack/pack-[0-9a-f]{40}\.(pack|idx))|git-(upload|receive)-pack))"', 'path' => '/var/www/bin/gitolite-suexec-wrapper/FOO' },
|
338
|
+
{ 'alias' => '/git', 'path' => '/var/www/gitweb/index.cgi' },
|
339
|
+
{ 'aliasmatch' => '^/cgi-bin(.*)', 'path' => '/usr/local/apache/cgi-binFOO' },
|
340
|
+
{ 'alias' => '/trac', 'path' => '/etc/apache2/trac.fcgi' },
|
341
|
+
],
|
342
|
+
:match => [
|
343
|
+
/^ ScriptAliasMatch "\(\?x\)\^\/git\/\(\.\*\/\(HEAD\|info\/refs\|objects\/\(info\/\[\^\/\]\+\|\[0-9a-f\]\{2\}\/\[0-9a-f\]\{38\}\|pack\/pack-\[0-9a-f\]\{40\}\\\.\(pack\|idx\)\)\|git-\(upload\|receive\)-pack\)\)" \/var\/www\/bin\/gitolite-suexec-wrapper\/FOO$/,
|
344
|
+
/^ ScriptAlias \/git \/var\/www\/gitweb\/index\.cgi$/,
|
345
|
+
/^ ScriptAliasMatch \^\/cgi-bin\(\.\*\) \/usr\/local\/apache\/cgi-binFOO$/,
|
346
|
+
/^ ScriptAlias \/trac \/etc\/apache2\/trac.fcgi$/,
|
347
|
+
],
|
348
|
+
},
|
349
|
+
{
|
350
|
+
:title => 'should accept proxy destinations',
|
351
|
+
:attr => 'proxy_dest',
|
352
|
+
:value => 'http://fake.com',
|
353
|
+
:match => [
|
354
|
+
/^ ProxyPass \/ http:\/\/fake.com\/$/,
|
355
|
+
/^ <Location \/>$/,
|
356
|
+
/^ ProxyPassReverse \/$/,
|
357
|
+
/^ <\/Location>$/,
|
358
|
+
],
|
359
|
+
:notmatch => [/ProxyPass .+!$/],
|
360
|
+
},
|
361
|
+
{
|
362
|
+
:title => 'should accept proxy_pass hash',
|
363
|
+
:attr => 'proxy_pass',
|
364
|
+
:value => { 'path' => '/path-a', 'url' => 'http://fake.com/a' },
|
365
|
+
:match => [
|
366
|
+
/^ ProxyPass \/path-a http:\/\/fake.com\/a$/,
|
367
|
+
/^ <Location \/path-a>$/,
|
368
|
+
/^ ProxyPassReverse \/$/,
|
369
|
+
/^ <\/Location>$/,
|
370
|
+
|
371
|
+
],
|
372
|
+
:notmatch => [/ProxyPass .+!$/],
|
373
|
+
},
|
374
|
+
{
|
375
|
+
:title => 'should accept proxy_pass array of hash',
|
376
|
+
:attr => 'proxy_pass',
|
377
|
+
:value => [
|
378
|
+
{ 'path' => '/path-a/', 'url' => 'http://fake.com/a/' },
|
379
|
+
{ 'path' => '/path-b', 'url' => 'http://fake.com/b' },
|
380
|
+
],
|
381
|
+
:match => [
|
382
|
+
/^ ProxyPass \/path-a\/ http:\/\/fake.com\/a\/$/,
|
383
|
+
/^ <Location \/path-a\/>$/,
|
384
|
+
/^ ProxyPassReverse \/$/,
|
385
|
+
/^ <\/Location>$/,
|
386
|
+
/^ ProxyPass \/path-b http:\/\/fake.com\/b$/,
|
387
|
+
/^ <Location \/path-b>$/,
|
388
|
+
/^ ProxyPassReverse \/$/,
|
389
|
+
/^ <\/Location>$/,
|
390
|
+
],
|
391
|
+
:notmatch => [/ProxyPass .+!$/],
|
392
|
+
},
|
393
|
+
{
|
394
|
+
:title => 'should enable rack',
|
395
|
+
:attr => 'rack_base_uris',
|
396
|
+
:value => ['/rack1','/rack2'],
|
397
|
+
:match => [
|
398
|
+
/^ RackBaseURI \/rack1$/,
|
399
|
+
/^ RackBaseURI \/rack2$/,
|
400
|
+
],
|
401
|
+
},
|
402
|
+
{
|
403
|
+
:title => 'should accept request headers',
|
404
|
+
:attr => 'request_headers',
|
405
|
+
:value => ['append something', 'unset something_else'],
|
406
|
+
:match => [
|
407
|
+
/^ RequestHeader append something$/,
|
408
|
+
/^ RequestHeader unset something_else$/,
|
409
|
+
],
|
410
|
+
},
|
411
|
+
{
|
412
|
+
:title => 'should accept rewrite rules',
|
413
|
+
:attr => 'rewrite_rule',
|
414
|
+
:value => 'not a real rule',
|
415
|
+
:match => [/^ RewriteRule not a real rule$/],
|
416
|
+
},
|
417
|
+
{
|
418
|
+
:title => 'should accept rewrite rules',
|
419
|
+
:attr => 'rewrites',
|
420
|
+
:value => [{'rewrite_rule' => ['not a real rule']}],
|
421
|
+
:match => [/^ RewriteRule not a real rule$/],
|
422
|
+
},
|
423
|
+
{
|
424
|
+
:title => 'should accept rewrite comment',
|
425
|
+
:attr => 'rewrites',
|
426
|
+
:value => [{'comment' => 'rewrite comment', 'rewrite_rule' => ['not a real rule']}],
|
427
|
+
:match => [/^ #rewrite comment/],
|
428
|
+
},
|
429
|
+
{
|
430
|
+
:title => 'should accept rewrite conditions',
|
431
|
+
:attr => 'rewrites',
|
432
|
+
:value => [{'comment' => 'redirect IE', 'rewrite_cond' => ['%{HTTP_USER_AGENT} ^MSIE'], 'rewrite_rule' => ['^index\.html$ welcome.html'],}],
|
433
|
+
:match => [
|
434
|
+
/^ #redirect IE$/,
|
435
|
+
/^ RewriteCond %{HTTP_USER_AGENT} \^MSIE$/,
|
436
|
+
/^ RewriteRule \^index\\\.html\$ welcome.html$/,
|
437
|
+
],
|
438
|
+
},
|
439
|
+
{
|
440
|
+
:title => 'should accept multiple rewrites',
|
441
|
+
:attr => 'rewrites',
|
442
|
+
:value => [
|
443
|
+
{'rewrite_rule' => ['not a real rule']},
|
444
|
+
{'rewrite_rule' => ['not a real rule two']},
|
445
|
+
],
|
446
|
+
:match => [
|
447
|
+
/^ RewriteRule not a real rule$/,
|
448
|
+
/^ RewriteRule not a real rule two$/,
|
449
|
+
],
|
450
|
+
},
|
451
|
+
{
|
452
|
+
:title => 'should block scm',
|
453
|
+
:attr => 'block',
|
454
|
+
:value => 'scm',
|
455
|
+
:match => [/^ <DirectoryMatch \.\*\\\.\(svn\|git\|bzr\)\/\.\*>$/],
|
456
|
+
},
|
457
|
+
{
|
458
|
+
:title => 'should accept a custom fragment',
|
459
|
+
:attr => 'custom_fragment',
|
460
|
+
:value => " Some custom fragment line\n That spans multiple lines",
|
461
|
+
:match => [
|
462
|
+
/^ Some custom fragment line$/,
|
463
|
+
/^ That spans multiple lines$/,
|
464
|
+
/^<\/VirtualHost>$/,
|
465
|
+
],
|
466
|
+
},
|
467
|
+
{
|
468
|
+
:title => 'should accept an array of alias hashes',
|
469
|
+
:attr => 'aliases',
|
470
|
+
:value => [ { 'alias' => '/', 'path' => '/var/www'} ],
|
471
|
+
:match => [/^ Alias \/ \/var\/www$/],
|
472
|
+
},
|
473
|
+
{
|
474
|
+
:title => 'should accept an alias hash',
|
475
|
+
:attr => 'aliases',
|
476
|
+
:value => { 'alias' => '/', 'path' => '/var/www'},
|
477
|
+
:match => [/^ Alias \/ \/var\/www$/],
|
478
|
+
},
|
479
|
+
{
|
480
|
+
:title => 'should accept multiple aliases',
|
481
|
+
:attr => 'aliases',
|
482
|
+
:value => [
|
483
|
+
{ 'alias' => '/', 'path' => '/var/www'},
|
484
|
+
{ 'alias' => '/cgi-bin', 'path' => '/var/www/cgi-bin'},
|
485
|
+
{ 'alias' => '/css', 'path' => '/opt/someapp/css'},
|
486
|
+
],
|
487
|
+
:match => [
|
488
|
+
/^ Alias \/ \/var\/www$/,
|
489
|
+
/^ Alias \/cgi-bin \/var\/www\/cgi-bin$/,
|
490
|
+
/^ Alias \/css \/opt\/someapp\/css$/,
|
491
|
+
],
|
492
|
+
},
|
493
|
+
{
|
494
|
+
:title => 'should accept an aliasmatch hash',
|
495
|
+
:attr => 'aliases',
|
496
|
+
## XXX As mentioned above, rspec-puppet drops the $1. Thus, these
|
497
|
+
# tests don't work.
|
498
|
+
#:value => { 'aliasmatch' => '^/image/(.*).gif', 'path' => '/files/gifs/$1.gif' },
|
499
|
+
#:match => [/^ AliasMatch \^\/image\/\(\.\*\)\.gif \/files\/gifs\/\$1\.gif$/],
|
500
|
+
},
|
501
|
+
{
|
502
|
+
:title => 'should accept a array of alias and aliasmatch hashes mixed',
|
503
|
+
:attr => 'aliases',
|
504
|
+
## XXX As mentioned above, rspec-puppet drops the $1. Thus, these
|
505
|
+
# tests don't work.
|
506
|
+
#:value => [
|
507
|
+
# { 'alias' => '/css', 'path' => '/files/css' },
|
508
|
+
# { 'aliasmatch' => '^/image/(.*).gif', 'path' => '/files/gifs/$1.gif' },
|
509
|
+
# { 'aliasmatch' => '^/image/(.*).jpg', 'path' => '/files/jpgs/$1.jpg' },
|
510
|
+
# { 'alias' => '/image', 'path' => '/files/images' },
|
511
|
+
#],
|
512
|
+
#:match => [
|
513
|
+
# /^ Alias \/css \/files\/css$/,
|
514
|
+
# /^ AliasMatch \^\/image\/\(.\*\)\.gif \/files\/gifs\/\$1\.gif$/,
|
515
|
+
# /^ AliasMatch \^\/image\/\(.\*\)\.jpg \/files\/jpgs\/\$1\.jpg$/,
|
516
|
+
# /^ Alias \/image \/files\/images$/
|
517
|
+
#],
|
518
|
+
},
|
519
|
+
{
|
520
|
+
:title => 'should accept multiple additional includes',
|
521
|
+
:attr => 'additional_includes',
|
522
|
+
:value => [
|
523
|
+
'/tmp/proxy_group_a',
|
524
|
+
'/tmp/proxy_group_b',
|
525
|
+
'/tmp/proxy_group_c',
|
526
|
+
],
|
527
|
+
:match => [
|
528
|
+
/^ Include \/tmp\/proxy_group_a$/,
|
529
|
+
/^ Include \/tmp\/proxy_group_b$/,
|
530
|
+
/^ Include \/tmp\/proxy_group_c$/,
|
531
|
+
],
|
532
|
+
},
|
533
|
+
{
|
534
|
+
:title => 'should accept a suPHP_Engine',
|
535
|
+
:attr => 'suphp_engine',
|
536
|
+
:value => 'on',
|
537
|
+
:match => [/^ suPHP_Engine on$/],
|
538
|
+
},
|
539
|
+
{
|
540
|
+
:title => 'should accept a php_admin_flags',
|
541
|
+
:attr => 'php_admin_flags',
|
542
|
+
:value => { 'php_engine' => 'on' },
|
543
|
+
:match => [/^ php_admin_flag php_engine on$/],
|
544
|
+
},
|
545
|
+
{
|
546
|
+
:title => 'should accept php_admin_values',
|
547
|
+
:attr => 'php_admin_values',
|
548
|
+
:value => { 'open_basedir' => '/srv/web/www.com/:/usr/share/pear/' },
|
549
|
+
:match => [/^ php_admin_value open_basedir \/srv\/web\/www.com\/:\/usr\/share\/pear\/$/],
|
550
|
+
},
|
551
|
+
{
|
552
|
+
:title => 'should accept php_admin_flags in directories',
|
553
|
+
:attr => 'directories',
|
554
|
+
:value => {
|
555
|
+
'path' => '/srv/www',
|
556
|
+
'php_admin_flags' => { 'php_engine' => 'on' }
|
557
|
+
},
|
558
|
+
:match => [/^ php_admin_flag php_engine on$/],
|
559
|
+
},
|
560
|
+
{
|
561
|
+
:title => 'should accept php_admin_values',
|
562
|
+
:attr => 'php_admin_values',
|
563
|
+
:value => { 'open_basedir' => '/srv/web/www.com/:/usr/share/pear/' },
|
564
|
+
:match => [/^ php_admin_value open_basedir \/srv\/web\/www.com\/:\/usr\/share\/pear\/$/],
|
565
|
+
},
|
566
|
+
{
|
567
|
+
:title => 'should accept php_admin_values in directories',
|
568
|
+
:attr => 'directories',
|
569
|
+
:value => {
|
570
|
+
'path' => '/srv/www',
|
571
|
+
'php_admin_values' => { 'open_basedir' => '/srv/web/www.com/:/usr/share/pear/' }
|
572
|
+
},
|
573
|
+
:match => [/^ php_admin_value open_basedir \/srv\/web\/www.com\/:\/usr\/share\/pear\/$/],
|
574
|
+
},
|
575
|
+
{
|
576
|
+
:title => 'should accept a wsgi script alias',
|
577
|
+
:attr => 'wsgi_script_aliases',
|
578
|
+
:value => { '/' => '/var/www/myapp.wsgi'},
|
579
|
+
:match => [/^ WSGIScriptAlias \/ \/var\/www\/myapp.wsgi$/],
|
580
|
+
},
|
581
|
+
{
|
582
|
+
:title => 'should accept multiple wsgi aliases',
|
583
|
+
:attr => 'wsgi_script_aliases',
|
584
|
+
:value => {
|
585
|
+
'/wiki' => '/usr/local/wsgi/scripts/mywiki.wsgi',
|
586
|
+
'/blog' => '/usr/local/wsgi/scripts/myblog.wsgi',
|
587
|
+
'/' => '/usr/local/wsgi/scripts/myapp.wsgi',
|
588
|
+
},
|
589
|
+
:match => [
|
590
|
+
/^ WSGIScriptAlias \/wiki \/usr\/local\/wsgi\/scripts\/mywiki.wsgi$/,
|
591
|
+
/^ WSGIScriptAlias \/blog \/usr\/local\/wsgi\/scripts\/myblog.wsgi$/,
|
592
|
+
/^ WSGIScriptAlias \/ \/usr\/local\/wsgi\/scripts\/myapp.wsgi$/,
|
593
|
+
],
|
594
|
+
},
|
595
|
+
{
|
596
|
+
:title => 'should accept a directory',
|
597
|
+
:attr => 'directories',
|
598
|
+
:value => { 'path' => '/opt/app' },
|
599
|
+
:notmatch => [' <Directory /rspec/docroot>'],
|
600
|
+
:match => [
|
601
|
+
/^ <Directory \/opt\/app>$/,
|
602
|
+
/^ AllowOverride None$/,
|
603
|
+
/^ Order allow,deny$/,
|
604
|
+
/^ Allow from all$/,
|
605
|
+
/^ <\/Directory>$/,
|
606
|
+
],
|
607
|
+
},
|
608
|
+
{
|
609
|
+
:title => 'should accept directory directives hash',
|
610
|
+
:attr => 'directories',
|
611
|
+
:value => {
|
612
|
+
'path' => '/opt/app',
|
613
|
+
'headers' => 'Set X-Robots-Tag "noindex, noarchive, nosnippet"',
|
614
|
+
'allow' => 'from rspec.org',
|
615
|
+
'allow_override' => 'Lol',
|
616
|
+
'deny' => 'from google.com',
|
617
|
+
'options' => '-MultiViews',
|
618
|
+
'order' => 'deny,yned',
|
619
|
+
'passenger_enabled' => 'onf',
|
620
|
+
},
|
621
|
+
:match => [
|
622
|
+
/^ <Directory \/opt\/app>$/,
|
623
|
+
/^ Header Set X-Robots-Tag "noindex, noarchive, nosnippet"$/,
|
624
|
+
/^ Allow from rspec.org$/,
|
625
|
+
/^ AllowOverride Lol$/,
|
626
|
+
/^ Deny from google.com$/,
|
627
|
+
/^ Options -MultiViews$/,
|
628
|
+
/^ Order deny,yned$/,
|
629
|
+
/^ PassengerEnabled onf$/,
|
630
|
+
/^ <\/Directory>$/,
|
631
|
+
],
|
632
|
+
},
|
633
|
+
{
|
634
|
+
:title => 'should accept directory directives with arrays and hashes',
|
635
|
+
:attr => 'directories',
|
636
|
+
:value => [
|
637
|
+
{
|
638
|
+
'path' => '/opt/app1',
|
639
|
+
'allow' => 'from rspec.org',
|
640
|
+
'allow_override' => ['AuthConfig','Indexes'],
|
641
|
+
'deny' => 'from google.com',
|
642
|
+
'options' => ['-MultiViews','+MultiViews'],
|
643
|
+
'order' => ['deny','yned'],
|
644
|
+
'passenger_enabled' => 'onf',
|
645
|
+
},
|
646
|
+
{
|
647
|
+
'path' => '/opt/app2',
|
648
|
+
'addhandlers' => {
|
649
|
+
'handler' => 'cgi-script',
|
650
|
+
'extensions' => '.cgi',
|
651
|
+
},
|
652
|
+
},
|
653
|
+
],
|
654
|
+
:match => [
|
655
|
+
/^ <Directory \/opt\/app1>$/,
|
656
|
+
/^ Allow from rspec.org$/,
|
657
|
+
/^ AllowOverride AuthConfig Indexes$/,
|
658
|
+
/^ Deny from google.com$/,
|
659
|
+
/^ Options -MultiViews \+MultiViews$/,
|
660
|
+
/^ Order deny,yned$/,
|
661
|
+
/^ PassengerEnabled onf$/,
|
662
|
+
/^ <\/Directory>$/,
|
663
|
+
/^ <Directory \/opt\/app2>$/,
|
664
|
+
/^ AllowOverride None$/,
|
665
|
+
/^ Order allow,deny$/,
|
666
|
+
/^ Allow from all$/,
|
667
|
+
/^ AddHandler cgi-script .cgi$/,
|
668
|
+
/^ <\/Directory>$/,
|
669
|
+
],
|
670
|
+
},
|
671
|
+
{
|
672
|
+
:title => 'should accept multiple directories',
|
673
|
+
:attr => 'directories',
|
674
|
+
:value => [
|
675
|
+
{ 'path' => '/opt/app' },
|
676
|
+
{ 'path' => '/var/www' },
|
677
|
+
{ 'path' => '/rspec/docroot'}
|
678
|
+
],
|
679
|
+
:match => [
|
680
|
+
/^ <Directory \/opt\/app>$/,
|
681
|
+
/^ <Directory \/var\/www>$/,
|
682
|
+
/^ <Directory \/rspec\/docroot>$/,
|
683
|
+
],
|
684
|
+
},
|
685
|
+
{
|
686
|
+
:title => 'should accept location for provider',
|
687
|
+
:attr => 'directories',
|
688
|
+
:value => {
|
689
|
+
'path' => '/',
|
690
|
+
'provider' => 'location',
|
691
|
+
},
|
692
|
+
:notmatch => [' AllowOverride None'],
|
693
|
+
:match => [
|
694
|
+
/^ <Location \/>$/,
|
695
|
+
/^ Order allow,deny$/,
|
696
|
+
/^ Allow from all$/,
|
697
|
+
/^ <\/Location>$/,
|
698
|
+
],
|
699
|
+
},
|
700
|
+
{
|
701
|
+
:title => 'should accept files for provider',
|
702
|
+
:attr => 'directories',
|
703
|
+
:value => {
|
704
|
+
'path' => 'index.html',
|
705
|
+
'provider' => 'files',
|
706
|
+
},
|
707
|
+
:notmatch => [' AllowOverride None'],
|
708
|
+
:match => [
|
709
|
+
/^ <Files index.html>$/,
|
710
|
+
/^ Order allow,deny$/,
|
711
|
+
/^ Allow from all$/,
|
712
|
+
/^ <\/Files>$/,
|
713
|
+
],
|
714
|
+
},
|
715
|
+
{
|
716
|
+
:title => 'should contain virtual_docroot',
|
717
|
+
:attr => 'virtual_docroot',
|
718
|
+
:value => '/not/default',
|
719
|
+
:match => [
|
720
|
+
/^ VirtualDocumentRoot \/not\/default$/,
|
721
|
+
],
|
722
|
+
},
|
723
|
+
{
|
724
|
+
:title => 'should contain environment variables',
|
725
|
+
:attr => 'access_log_env_var',
|
726
|
+
:value => 'admin',
|
727
|
+
:match => [/CustomLog \/var\/log\/.+_access\.log combined env=admin$/]
|
728
|
+
},
|
729
|
+
|
730
|
+
].each do |param|
|
731
|
+
describe "when #{param[:attr]} is #{param[:value]}" do
|
732
|
+
let :params do default_params.merge({ param[:attr].to_sym => param[:value] }) end
|
733
|
+
|
734
|
+
it { should contain_file("25-#{title}.conf").with_mode('0644') }
|
735
|
+
if param[:match]
|
736
|
+
it "#{param[:title]}: matches" do
|
737
|
+
param[:match].each do |match|
|
738
|
+
should contain_file("25-#{title}.conf").with_content( match )
|
739
|
+
end
|
740
|
+
end
|
741
|
+
end
|
742
|
+
if param[:notmatch]
|
743
|
+
it "#{param[:title]}: notmatches" do
|
744
|
+
param[:notmatch].each do |notmatch|
|
745
|
+
should_not contain_file("25-#{title}.conf").with_content( notmatch )
|
746
|
+
end
|
747
|
+
end
|
748
|
+
end
|
749
|
+
end
|
750
|
+
end
|
751
|
+
end
|
752
|
+
|
753
|
+
context ".conf content with SSL" do
|
754
|
+
[
|
755
|
+
{
|
756
|
+
:title => 'should accept setting SSLCertificateFile',
|
757
|
+
:attr => 'ssl_cert',
|
758
|
+
:value => '/path/to/cert.pem',
|
759
|
+
:match => [/^ SSLCertificateFile \/path\/to\/cert\.pem$/],
|
760
|
+
},
|
761
|
+
{
|
762
|
+
:title => 'should accept setting SSLCertificateKeyFile',
|
763
|
+
:attr => 'ssl_key',
|
764
|
+
:value => '/path/to/cert.pem',
|
765
|
+
:match => [/^ SSLCertificateKeyFile \/path\/to\/cert\.pem$/],
|
766
|
+
},
|
767
|
+
{
|
768
|
+
:title => 'should accept setting SSLCertificateChainFile',
|
769
|
+
:attr => 'ssl_chain',
|
770
|
+
:value => '/path/to/cert.pem',
|
771
|
+
:match => [/^ SSLCertificateChainFile \/path\/to\/cert\.pem$/],
|
772
|
+
},
|
773
|
+
{
|
774
|
+
:title => 'should accept setting SSLCertificatePath',
|
775
|
+
:attr => 'ssl_certs_dir',
|
776
|
+
:value => '/path/to/certs',
|
777
|
+
:match => [/^ SSLCACertificatePath \/path\/to\/certs$/],
|
778
|
+
},
|
779
|
+
{
|
780
|
+
:title => 'should accept setting SSLCertificateFile',
|
781
|
+
:attr => 'ssl_ca',
|
782
|
+
:value => '/path/to/ca.pem',
|
783
|
+
:match => [/^ SSLCACertificateFile \/path\/to\/ca\.pem$/],
|
784
|
+
},
|
785
|
+
{
|
786
|
+
:title => 'should accept setting SSLRevocationPath',
|
787
|
+
:attr => 'ssl_crl_path',
|
788
|
+
:value => '/path/to/crl',
|
789
|
+
:match => [/^ SSLCARevocationPath \/path\/to\/crl$/],
|
790
|
+
},
|
791
|
+
{
|
792
|
+
:title => 'should accept setting SSLRevocationFile',
|
793
|
+
:attr => 'ssl_crl',
|
794
|
+
:value => '/path/to/crl.pem',
|
795
|
+
:match => [/^ SSLCARevocationFile \/path\/to\/crl\.pem$/],
|
796
|
+
},
|
797
|
+
{
|
798
|
+
:title => 'should accept setting SSLProxyEngine',
|
799
|
+
:attr => 'ssl_proxyengine',
|
800
|
+
:value => true,
|
801
|
+
:match => [/^ SSLProxyEngine On$/],
|
802
|
+
},
|
803
|
+
{
|
804
|
+
:title => 'should accept setting SSLProtocol',
|
805
|
+
:attr => 'ssl_protocol',
|
806
|
+
:value => 'all -SSLv2',
|
807
|
+
:match => [/^ SSLProtocol all -SSLv2$/],
|
808
|
+
},
|
809
|
+
{
|
810
|
+
:title => 'should accept setting SSLCipherSuite',
|
811
|
+
:attr => 'ssl_cipher',
|
812
|
+
:value => 'RC4-SHA:HIGH:!ADH:!SSLv2',
|
813
|
+
:match => [/^ SSLCipherSuite RC4-SHA:HIGH:!ADH:!SSLv2$/],
|
814
|
+
},
|
815
|
+
{
|
816
|
+
:title => 'should accept setting SSLHonorCipherOrder',
|
817
|
+
:attr => 'ssl_honorcipherorder',
|
818
|
+
:value => 'On',
|
819
|
+
:match => [/^ SSLHonorCipherOrder On$/],
|
820
|
+
},
|
821
|
+
{
|
822
|
+
:title => 'should accept setting SSLVerifyClient',
|
823
|
+
:attr => 'ssl_verify_client',
|
824
|
+
:value => 'optional',
|
825
|
+
:match => [/^ SSLVerifyClient optional$/],
|
826
|
+
},
|
827
|
+
{
|
828
|
+
:title => 'should accept setting SSLVerifyDepth',
|
829
|
+
:attr => 'ssl_verify_depth',
|
830
|
+
:value => '1',
|
831
|
+
:match => [/^ SSLVerifyDepth 1$/],
|
832
|
+
},
|
833
|
+
{
|
834
|
+
:title => 'should accept setting SSLOptions with a string',
|
835
|
+
:attr => 'ssl_options',
|
836
|
+
:value => '+ExportCertData',
|
837
|
+
:match => [/^ SSLOptions \+ExportCertData$/],
|
838
|
+
},
|
839
|
+
{
|
840
|
+
:title => 'should accept setting SSLOptions with an array',
|
841
|
+
:attr => 'ssl_options',
|
842
|
+
:value => ['+StrictRequire','+ExportCertData'],
|
843
|
+
:match => [/^ SSLOptions \+StrictRequire \+ExportCertData/],
|
844
|
+
},
|
845
|
+
{
|
846
|
+
:title => 'should accept setting SSLOptions with a string in directories',
|
847
|
+
:attr => 'directories',
|
848
|
+
:value => { 'path' => '/srv/www', 'ssl_options' => '+ExportCertData'},
|
849
|
+
:match => [/^ SSLOptions \+ExportCertData$/],
|
850
|
+
},
|
851
|
+
{
|
852
|
+
:title => 'should accept setting SSLOptions with an array in directories',
|
853
|
+
:attr => 'directories',
|
854
|
+
:value => { 'path' => '/srv/www', 'ssl_options' => ['-StdEnvVars','+ExportCertData']},
|
855
|
+
:match => [/^ SSLOptions -StdEnvVars \+ExportCertData/],
|
856
|
+
},
|
857
|
+
].each do |param|
|
858
|
+
describe "when #{param[:attr]} is #{param[:value]} with SSL" do
|
859
|
+
let :params do
|
860
|
+
default_params.merge( {
|
861
|
+
param[:attr].to_sym => param[:value],
|
862
|
+
:ssl => true,
|
863
|
+
} )
|
864
|
+
end
|
865
|
+
it { should contain_file("25-#{title}.conf").with_mode('0644') }
|
866
|
+
if param[:match]
|
867
|
+
it "#{param[:title]}: matches" do
|
868
|
+
param[:match].each do |match|
|
869
|
+
should contain_file("25-#{title}.conf").with_content( match )
|
870
|
+
end
|
871
|
+
end
|
872
|
+
end
|
873
|
+
if param[:notmatch]
|
874
|
+
it "#{param[:title]}: notmatches" do
|
875
|
+
param[:notmatch].each do |notmatch|
|
876
|
+
should_not contain_file("25-#{title}.conf").with_content( notmatch )
|
877
|
+
end
|
878
|
+
end
|
879
|
+
end
|
880
|
+
end
|
881
|
+
end
|
882
|
+
end
|
883
|
+
|
884
|
+
context 'attribute resources' do
|
885
|
+
describe 'when access_log_file and access_log_pipe are specified' do
|
886
|
+
let :params do default_params.merge({
|
887
|
+
:access_log_file => 'fake.log',
|
888
|
+
:access_log_pipe => '| /bin/fake',
|
889
|
+
}) end
|
890
|
+
it 'should cause a failure' do
|
891
|
+
expect { subject }.to raise_error(Puppet::Error, /'access_log_file' and 'access_log_pipe' cannot be defined at the same time/)
|
892
|
+
end
|
893
|
+
end
|
894
|
+
describe 'when error_log_file and error_log_pipe are specified' do
|
895
|
+
let :params do default_params.merge({
|
896
|
+
:error_log_file => 'fake.log',
|
897
|
+
:error_log_pipe => '| /bin/fake',
|
898
|
+
}) end
|
899
|
+
it 'should cause a failure' do
|
900
|
+
expect { subject }.to raise_error(Puppet::Error, /'error_log_file' and 'error_log_pipe' cannot be defined at the same time/)
|
901
|
+
end
|
902
|
+
end
|
903
|
+
describe 'when docroot owner is specified' do
|
904
|
+
let :params do default_params.merge({
|
905
|
+
:docroot_owner => 'testuser',
|
906
|
+
:docroot_group => 'testgroup',
|
907
|
+
}) end
|
908
|
+
it 'should set vhost ownership' do
|
909
|
+
should contain_file(params[:docroot]).with({
|
910
|
+
:ensure => :directory,
|
911
|
+
:owner => 'testuser',
|
912
|
+
:group => 'testgroup',
|
913
|
+
})
|
914
|
+
end
|
915
|
+
end
|
916
|
+
|
917
|
+
describe 'when wsgi_daemon_process and wsgi_daemon_process_options are specified' do
|
918
|
+
let :params do default_params.merge({
|
919
|
+
:wsgi_daemon_process => 'example.org',
|
920
|
+
:wsgi_daemon_process_options => { 'processes' => '2', 'threads' => '15' },
|
921
|
+
}) end
|
922
|
+
it 'should set wsgi_daemon_process_options' do
|
923
|
+
should contain_file("25-#{title}.conf").with_content(
|
924
|
+
/^ WSGIDaemonProcess example.org processes=2 threads=15$/
|
925
|
+
)
|
926
|
+
end
|
927
|
+
end
|
928
|
+
|
929
|
+
describe 'when rewrites are specified' do
|
930
|
+
let :params do default_params.merge({
|
931
|
+
:rewrites => [
|
932
|
+
{
|
933
|
+
'comment' => 'test rewrites',
|
934
|
+
'rewrite_cond' => ['%{HTTP_USER_AGENT} ^Lynx/ [OR]', '%{HTTP_USER_AGENT} ^Mozilla/[12]'],
|
935
|
+
'rewrite_rule' => ['^index\.html$ welcome.html', '^index\.cgi$ index.php'],
|
936
|
+
}
|
937
|
+
]
|
938
|
+
}) end
|
939
|
+
it 'should set RewriteConds and RewriteRules' do
|
940
|
+
should contain_file("25-#{title}.conf").with_content(
|
941
|
+
/^ #test rewrites$/
|
942
|
+
)
|
943
|
+
should contain_file("25-#{title}.conf").with_content(
|
944
|
+
/^ RewriteCond %\{HTTP_USER_AGENT\} \^Lynx\/ \[OR\]$/
|
945
|
+
)
|
946
|
+
should contain_file("25-#{title}.conf").with_content(
|
947
|
+
/^ RewriteCond %\{HTTP_USER_AGENT\} \^Mozilla\/\[12\]$/
|
948
|
+
)
|
949
|
+
should contain_file("25-#{title}.conf").with_content(
|
950
|
+
/^ RewriteRule \^index\\.html\$ welcome.html$/
|
951
|
+
)
|
952
|
+
should contain_file("25-#{title}.conf").with_content(
|
953
|
+
/^ RewriteRule \^index\\.cgi\$ index.php$/
|
954
|
+
)
|
955
|
+
end
|
956
|
+
end
|
957
|
+
|
958
|
+
describe 'when rewrite_rule and rewrite_cond are specified' do
|
959
|
+
let :params do default_params.merge({
|
960
|
+
:rewrite_cond => '%{HTTPS} off',
|
961
|
+
:rewrite_rule => '(.*) https://%{HTTPS_HOST}%{REQUEST_URI}',
|
962
|
+
}) end
|
963
|
+
it 'should set RewriteCond' do
|
964
|
+
should contain_file("25-#{title}.conf").with_content(
|
965
|
+
/^ RewriteCond %\{HTTPS\} off$/
|
966
|
+
)
|
967
|
+
end
|
968
|
+
end
|
969
|
+
|
970
|
+
describe 'when suphp_engine is on and suphp_configpath is specified' do
|
971
|
+
let :params do default_params.merge({
|
972
|
+
:suphp_engine => 'on',
|
973
|
+
:suphp_configpath => '/etc/php5/apache2',
|
974
|
+
}) end
|
975
|
+
it 'should set suphp_configpath' do
|
976
|
+
should contain_file("25-#{title}.conf").with_content(
|
977
|
+
/^ suPHP_ConfigPath \/etc\/php5\/apache2$/
|
978
|
+
)
|
979
|
+
end
|
980
|
+
end
|
981
|
+
|
982
|
+
describe 'when suphp_engine is on and suphp_addhandler is specified' do
|
983
|
+
let :params do default_params.merge({
|
984
|
+
:suphp_engine => 'on',
|
985
|
+
:suphp_addhandler => 'x-httpd-php',
|
986
|
+
}) end
|
987
|
+
it 'should set suphp_addhandler' do
|
988
|
+
should contain_file("25-#{title}.conf").with_content(
|
989
|
+
/^ suPHP_AddHandler x-httpd-php/
|
990
|
+
)
|
991
|
+
end
|
992
|
+
end
|
993
|
+
|
994
|
+
describe 'when suphp_engine is on and suphp { user & group } is specified' do
|
995
|
+
let :params do default_params.merge({
|
996
|
+
:suphp_engine => 'on',
|
997
|
+
:directories => { 'path' => '/srv/www',
|
998
|
+
'suphp' => { 'user' => 'myappuser', 'group' => 'myappgroup' },
|
999
|
+
}
|
1000
|
+
}) end
|
1001
|
+
it 'should set suphp_UserGroup' do
|
1002
|
+
should contain_file("25-#{title}.conf").with_content(
|
1003
|
+
/^ suPHP_UserGroup myappuser myappgroup/
|
1004
|
+
)
|
1005
|
+
end
|
1006
|
+
end
|
1007
|
+
|
1008
|
+
describe 'priority/default settings' do
|
1009
|
+
describe 'when neither priority/default is specified' do
|
1010
|
+
let :params do default_params end
|
1011
|
+
it { should contain_file("25-#{title}.conf").with_path(
|
1012
|
+
/25-#{title}.conf/
|
1013
|
+
) }
|
1014
|
+
end
|
1015
|
+
describe 'when both priority/default_vhost is specified' do
|
1016
|
+
let :params do
|
1017
|
+
default_params.merge({
|
1018
|
+
:priority => 15,
|
1019
|
+
:default_vhost => true,
|
1020
|
+
})
|
1021
|
+
end
|
1022
|
+
it { should contain_file("15-#{title}.conf").with_path(
|
1023
|
+
/15-#{title}.conf/
|
1024
|
+
) }
|
1025
|
+
end
|
1026
|
+
describe 'when only priority is specified' do
|
1027
|
+
let :params do
|
1028
|
+
default_params.merge({ :priority => 14, })
|
1029
|
+
end
|
1030
|
+
it { should contain_file("14-#{title}.conf").with_path(
|
1031
|
+
/14-#{title}.conf/
|
1032
|
+
) }
|
1033
|
+
end
|
1034
|
+
describe 'when only default is specified' do
|
1035
|
+
let :params do
|
1036
|
+
default_params.merge({ :default_vhost => true, })
|
1037
|
+
end
|
1038
|
+
it { should contain_file("10-#{title}.conf").with_path(
|
1039
|
+
/10-#{title}.conf/
|
1040
|
+
) }
|
1041
|
+
end
|
1042
|
+
end
|
1043
|
+
|
1044
|
+
describe 'various ip/port combos' do
|
1045
|
+
describe 'when ip_based is true' do
|
1046
|
+
let :params do default_params.merge({ :ip_based => true }) end
|
1047
|
+
it 'should not specify a NameVirtualHost' do
|
1048
|
+
should contain_apache__listen(params[:port])
|
1049
|
+
should_not contain_apache__namevirtualhost("*:#{params[:port]}")
|
1050
|
+
end
|
1051
|
+
end
|
1052
|
+
|
1053
|
+
describe 'when ip_based is default' do
|
1054
|
+
let :params do default_params end
|
1055
|
+
it 'should specify a NameVirtualHost' do
|
1056
|
+
should contain_apache__listen(params[:port])
|
1057
|
+
should contain_apache__namevirtualhost("*:#{params[:port]}")
|
1058
|
+
end
|
1059
|
+
end
|
1060
|
+
|
1061
|
+
describe 'when an ip is set' do
|
1062
|
+
let :params do default_params.merge({ :ip => '10.0.0.1' }) end
|
1063
|
+
it 'should specify a NameVirtualHost for the ip' do
|
1064
|
+
should_not contain_apache__listen(params[:port])
|
1065
|
+
should contain_apache__listen("10.0.0.1:#{params[:port]}")
|
1066
|
+
should contain_apache__namevirtualhost("10.0.0.1:#{params[:port]}")
|
1067
|
+
end
|
1068
|
+
end
|
1069
|
+
|
1070
|
+
describe 'an ip_based vhost without a port' do
|
1071
|
+
let :params do
|
1072
|
+
{
|
1073
|
+
:docroot => '/fake',
|
1074
|
+
:ip => '10.0.0.1',
|
1075
|
+
:ip_based => true,
|
1076
|
+
}
|
1077
|
+
end
|
1078
|
+
it 'should specify a NameVirtualHost for the ip' do
|
1079
|
+
should_not contain_apache__listen(params[:ip])
|
1080
|
+
should_not contain_apache__namevirtualhost(params[:ip])
|
1081
|
+
should contain_file("25-#{title}.conf").with_content %r{<VirtualHost 10\.0\.0\.1>}
|
1082
|
+
end
|
1083
|
+
end
|
1084
|
+
end
|
1085
|
+
|
1086
|
+
describe 'redirect rules' do
|
1087
|
+
describe 'without lockstep arrays' do
|
1088
|
+
let :params do
|
1089
|
+
default_params.merge({
|
1090
|
+
:redirect_source => [
|
1091
|
+
'/login',
|
1092
|
+
'/logout',
|
1093
|
+
],
|
1094
|
+
:redirect_dest => [
|
1095
|
+
'http://10.0.0.10/login',
|
1096
|
+
'http://10.0.0.10/logout',
|
1097
|
+
],
|
1098
|
+
:redirect_status => [
|
1099
|
+
'permanent',
|
1100
|
+
'',
|
1101
|
+
],
|
1102
|
+
})
|
1103
|
+
end
|
1104
|
+
|
1105
|
+
it { should contain_file("25-#{title}.conf").with_content %r{ Redirect permanent /login http://10\.0\.0\.10/login} }
|
1106
|
+
it { should contain_file("25-#{title}.conf").with_content %r{ Redirect /logout http://10\.0\.0\.10/logout} }
|
1107
|
+
end
|
1108
|
+
describe 'without a status' do
|
1109
|
+
let :params do
|
1110
|
+
default_params.merge({
|
1111
|
+
:redirect_source => [
|
1112
|
+
'/login',
|
1113
|
+
'/logout',
|
1114
|
+
],
|
1115
|
+
:redirect_dest => [
|
1116
|
+
'http://10.0.0.10/login',
|
1117
|
+
'http://10.0.0.10/logout',
|
1118
|
+
],
|
1119
|
+
})
|
1120
|
+
end
|
1121
|
+
|
1122
|
+
it { should contain_file("25-#{title}.conf").with_content %r{ Redirect /login http://10\.0\.0\.10/login} }
|
1123
|
+
it { should contain_file("25-#{title}.conf").with_content %r{ Redirect /logout http://10\.0\.0\.10/logout} }
|
1124
|
+
end
|
1125
|
+
describe 'with a single status and dest' do
|
1126
|
+
let :params do
|
1127
|
+
default_params.merge({
|
1128
|
+
:redirect_source => [
|
1129
|
+
'/login',
|
1130
|
+
'/logout',
|
1131
|
+
],
|
1132
|
+
:redirect_dest => 'http://10.0.0.10/test',
|
1133
|
+
:redirect_status => 'permanent',
|
1134
|
+
})
|
1135
|
+
end
|
1136
|
+
|
1137
|
+
it { should contain_file("25-#{title}.conf").with_content %r{ Redirect permanent /login http://10\.0\.0\.10/test} }
|
1138
|
+
it { should contain_file("25-#{title}.conf").with_content %r{ Redirect permanent /logout http://10\.0\.0\.10/test} }
|
1139
|
+
end
|
1140
|
+
|
1141
|
+
describe 'with a directoryindex specified' do
|
1142
|
+
let :params do
|
1143
|
+
default_params.merge({
|
1144
|
+
:directoryindex => 'index.php'
|
1145
|
+
})
|
1146
|
+
end
|
1147
|
+
it { should contain_file("25-#{title}.conf").with_content %r{DirectoryIndex index.php} }
|
1148
|
+
end
|
1149
|
+
end
|
1150
|
+
end
|
1151
|
+
end
|
1152
|
+
end
|