diff --git a/.fixtures.yml b/.fixtures.yml index b5f76c03a..6eddf260f 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -2,5 +2,6 @@ fixtures: repositories: stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib.git" concat: "git://github.com/puppetlabs/puppetlabs-concat.git" + portage: "git://github.com/gentoo/puppet-portage.git" symlinks: apache: "#{source_dir}" diff --git a/README.md b/README.md index b7a84ff94..099230c2d 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,8 @@ Apache is a widely-used web server, and this module provides a simplified way of * Apache modules * virtual hosts * listened-to ports -* `/etc/make.conf` on FreeBSD +* `/etc/make.conf` on FreeBSD and Gentoo +* depends on module 'gentoo/puppet-portage' for Gentoo ###Beginning with Apache @@ -79,7 +80,7 @@ To install Apache with the default parameters class { 'apache': } ``` -The defaults are determined by your operating system (e.g. Debian systems have one set of defaults, and RedHat systems have another, as do FreeBSD systems). These defaults work well in a testing environment, but are not suggested for production. To establish customized parameters +The defaults are determined by your operating system (e.g. Debian systems have one set of defaults, and RedHat systems have another, as do FreeBSD and Gentoo systems). These defaults work well in a testing environment, but are not suggested for production. To establish customized parameters ```puppet class { 'apache': @@ -238,11 +239,11 @@ Configures the behavior of the module templates, package names, and default mods #####`conf_dir` -Changes the location of the configuration directory the main configuration file is placed in. Defaults to '/etc/httpd/conf' on RedHat, '/etc/apache2' on Debian, and '/usr/local/etc/apache22' on FreeBSD. +Changes the location of the configuration directory the main configuration file is placed in. Defaults to '/etc/httpd/conf' on RedHat, '/etc/apache2' on Debian, '/usr/local/etc/apache22' on FreeBSD, and '/etc/apache2' on Gentoo. #####`confd_dir` -Changes the location of the configuration directory your custom configuration files are placed in. Defaults to '/etc/httpd/conf' on RedHat, '/etc/apache2/conf.d' on Debian, and '/usr/local/etc/apache22' on FreeBSD. +Changes the location of the configuration directory your custom configuration files are placed in. Defaults to '/etc/httpd/conf' on RedHat, '/etc/apache2/conf.d' on Debian, '/usr/local/etc/apache22' on FreeBSD, and '/etc/apache2/conf.d' on Gentoo. #####`conf_template` @@ -270,7 +271,7 @@ The default certificate authority, which is automatically set to 'undef'. This d #####`default_ssl_cert` -The default SSL certification, which is automatically set based on your operating system ('/etc/pki/tls/certs/localhost.crt' for RedHat, '/etc/ssl/certs/ssl-cert-snakeoil.pem' for Debian, and '/usr/local/etc/apache22/server.crt' for FreeBSD). This default works out of the box but must be updated with your specific certificate information before being used in production. +The default SSL certification, which is automatically set based on your operating system ('/etc/pki/tls/certs/localhost.crt' for RedHat, '/etc/ssl/certs/ssl-cert-snakeoil.pem' for Debian, '/usr/local/etc/apache22/server.crt' for FreeBSD, and '/etc/ssl/apache2/server.crt' for Gentoo). This default works out of the box but must be updated with your specific certificate information before being used in production. #####`default_ssl_chain` @@ -290,7 +291,7 @@ Sets the default certificate revocation check level via the [SSLCARevocationChec #####`default_ssl_key` -The default SSL key, which is automatically set based on your operating system ('/etc/pki/tls/private/localhost.key' for RedHat, '/etc/ssl/private/ssl-cert-snakeoil.key' for Debian, and '/usr/local/etc/apache22/server.key' for FreeBSD). This default works out of the box but must be updated with your specific certificate information before being used in production. +The default SSL key, which is automatically set based on your operating system ('/etc/pki/tls/private/localhost.key' for RedHat, '/etc/ssl/private/ssl-cert-snakeoil.key' for Debian, '/usr/local/etc/apache22/server.key' for FreeBSD, and '/etc/ssl/apache2/server.key' for Gentoo). This default works out of the box but must be updated with your specific certificate information before being used in production. #####`default_ssl_vhost` @@ -315,7 +316,7 @@ Sets up a default virtual host. Defaults to 'true', set to 'false' to set up [cu #####`docroot` -Changes the location of the default [Documentroot](https://httpd.apache.org/docs/current/mod/core.html#documentroot). Defaults to '/var/www/html' on RedHat, '/var/www' on Debian, and '/usr/local/www/apache22/data' on FreeBSD. +Changes the location of the default [Documentroot](https://httpd.apache.org/docs/current/mod/core.html#documentroot). Defaults to '/var/www/html' on RedHat, '/var/www' on Debian, '/usr/local/www/apache22/data' on FreeBSD, and '/var/www/localhost/htdocs' on Gentoo. #####`error_documents` @@ -323,7 +324,7 @@ Enables custom error documents. Defaults to 'false'. #####`httpd_dir` -Changes the base location of the configuration directories used for the apache service. This is useful for specially repackaged HTTPD builds, but might have unintended consequences when used in combination with the default distribution packages. Defaults to '/etc/httpd' on RedHat, '/etc/apache2' on Debian, and '/usr/local/etc/apache22' on FreeBSD. +Changes the base location of the configuration directories used for the apache service. This is useful for specially repackaged HTTPD builds, but might have unintended consequences when used in combination with the default distribution packages. Defaults to '/etc/httpd' on RedHat, '/etc/apache2' on Debian, '/usr/local/etc/apache22' on FreeBSD, and '/etc/apache2' on Gentoo. #####`keepalive` @@ -355,7 +356,7 @@ Define additional [LogFormats](https://httpd.apache.org/docs/current/mod/mod_log #####`logroot` -Changes the directory where Apache log files for the virtual host are placed. Defaults to '/var/log/httpd' on RedHat, '/var/log/apache2' on Debian, and '/var/log/apache22' on FreeBSD. +Changes the directory where Apache log files for the virtual host are placed. Defaults to '/var/log/httpd' on RedHat, '/var/log/apache2' on Debian, '/var/log/apache22' on FreeBSD, and '/var/log/apache2' on Gentoo. #####`logroot_mode` @@ -372,11 +373,11 @@ Setting this to 'false' stops the user resource from being created. This is for #####`mod_dir` -Changes the location of the configuration directory your Apache modules configuration files are placed in. Defaults to '/etc/httpd/conf.d' for RedHat, '/etc/apache2/mods-available' for Debian, and '/usr/local/etc/apache22/Modules' for FreeBSD. +Changes the location of the configuration directory your Apache modules configuration files are placed in. Defaults to '/etc/httpd/conf.d' for RedHat, '/etc/apache2/mods-available' for Debian, '/usr/local/etc/apache22/Modules' for FreeBSD, and '/etc/apache2/modules.d' on Gentoo. #####`mpm_module` -Determines which MPM is loaded and configured for the HTTPD process. Valid values are 'event', 'itk', 'peruser', 'prefork', 'worker', or 'false'. Defaults to 'prefork' on RedHat and FreeBSD, and 'worker' on Debian. Must be set to 'false' to explicitly declare the following classes with custom parameters: +Determines which MPM is loaded and configured for the HTTPD process. Valid values are 'event', 'itk', 'peruser', 'prefork', 'worker', or 'false'. Defaults to 'prefork' on RedHat, FreeBSD and Gentoo, and 'worker' on Debian. Must be set to 'false' to explicitly declare the following classes with custom parameters: * `apache::mod::event` * `apache::mod::itk` @@ -416,7 +417,7 @@ Sets the server name. Defaults to `fqdn` provided by Facter. #####`server_root` -Sets the root directory in which the server resides. Defaults to '/etc/httpd' on RedHat, '/etc/apache2' on Debian, and '/usr/local' on FreeBSD. +Sets the root directory in which the server resides. Defaults to '/etc/httpd' on RedHat, '/etc/apache2' on Debian, '/usr/local' on FreeBSD, and '/var/www' on Gentoo. #####`server_signature` @@ -436,7 +437,7 @@ Determines whether the service should be running. Valid values are 'true', 'fals #####`service_name` -Name of the Apache service to run. Defaults to: 'httpd' on RedHat, 'apache2' on Debian, and 'apache22' on FreeBSD. +Name of the Apache service to run. Defaults to: 'httpd' on RedHat, 'apache2' on Debian and Gentoo, and 'apache22' on FreeBSD. #####`service_manage` @@ -448,7 +449,7 @@ Controls how TRACE requests per RFC 2616 are handled. More information about [Tr #####`vhost_dir` -Changes the location of the configuration directory your virtual host configuration files are placed in. Defaults to 'etc/httpd/conf.d' on RedHat, '/etc/apache2/sites-available' on Debian, and '/usr/local/etc/apache22/Vhosts' on FreeBSD. +Changes the location of the configuration directory your virtual host configuration files are placed in. Defaults to 'etc/httpd/conf.d' on RedHat, '/etc/apache2/sites-available' on Debian, '/usr/local/etc/apache22/Vhosts' on FreeBSD, and '/etc/apache2/vhosts.d' on Gentoo. #####`apache_name` @@ -1515,9 +1516,9 @@ Used by HTTPD to conditionally set environment variables for vhosts. Defaults to Set up a virtual host with [suPHP](http://suphp.org/DocumentationView.html?file=apache/CONFIG). -`suphp_addhandler` defaults to 'php5-script' on RedHat and FreeBSD, and 'x-httpd-php' on Debian. +`suphp_addhandler` defaults to 'php5-script' on RedHat and FreeBSD, and 'x-httpd-php' on Debian and Gentoo. -`suphp_configpath` defaults to 'undef' on RedHat and FreeBSD, and '/etc/php5/apache2' on Debian. +`suphp_configpath` defaults to 'undef' on RedHat and FreeBSD, and '/etc/php5/apache2' on Debian and Gentoo. `suphp_engine` allows values 'on' or 'off'. Defaults to 'off' @@ -2013,7 +2014,7 @@ Specifies the SSL certificate authority. Defaults to 'undef'. #####`ssl_cert` -Specifies the SSL certification. Defaults are based on your OS: '/etc/pki/tls/certs/localhost.crt' for RedHat, '/etc/ssl/certs/ssl-cert-snakeoil.pem' for Debian, and '/usr/local/etc/apache22/server.crt' for FreeBSD. +Specifies the SSL certification. Defaults are based on your OS: '/etc/pki/tls/certs/localhost.crt' for RedHat, '/etc/ssl/certs/ssl-cert-snakeoil.pem' for Debian, '/usr/local/etc/apache22/server.crt' for FreeBSD, and '/etc/ssl/apache2/server.crt' on Gentoo. #####`ssl_protocol` @@ -2033,7 +2034,7 @@ Sets [SSLHonorCipherOrder](http://httpd.apache.org/docs/current/mod/mod_ssl.html #####`ssl_certs_dir` -Specifies the location of the SSL certification directory. Defaults to '/etc/ssl/certs' on Debian, '/etc/pki/tls/certs' on RedHat, and '/usr/local/etc/apache22' on FreeBSD. +Specifies the location of the SSL certification directory. Defaults to '/etc/ssl/certs' on Debian, '/etc/pki/tls/certs' on RedHat, '/usr/local/etc/apache22' on FreeBSD, and '/etc/ssl/apache2' on Gentoo. #####`ssl_chain` @@ -2053,7 +2054,7 @@ Sets the certificate revocation check level via the [SSLCARevocationCheck direct #####`ssl_key` -Specifies the SSL key. Defaults are based on your operating system: '/etc/pki/tls/private/localhost.key' for RedHat, '/etc/ssl/private/ssl-cert-snakeoil.key' for Debian, and '/usr/local/etc/apache22/server.key' for FreeBSD. (This default works out of the box but must be updated in the base `apache` class with your specific certificate information before being used in production.) +Specifies the SSL key. Defaults are based on your operating system: '/etc/pki/tls/private/localhost.key' for RedHat, '/etc/ssl/private/ssl-cert-snakeoil.key' for Debian, '/usr/local/etc/apache22/server.key' for FreeBSD, and '/etc/ssl/apache2/server.key' on Gentoo. (This default works out of the box but must be updated in the base `apache` class with your specific certificate information before being used in production.) #####`ssl_verify_client` @@ -2471,7 +2472,7 @@ The `apache::mod::passenger` class is untested as the repository does not have p This module is CI tested on Centos 5 & 6, Ubuntu 12.04 & 14.04, Debian 7, and RHEL 5, 6 & 7 platforms against both the OSS and Enterprise version of Puppet. -The module contains support for other distributions and operating systems, such as FreeBSD and Amazon Linux, but is not formally tested on those and regressions can occur. +The module contains support for other distributions and operating systems, such as FreeBSD, Gentoo and Amazon Linux, but is not formally tested on those and regressions can occur. ###SELinux and Custom Paths diff --git a/manifests/default_mods.pp b/manifests/default_mods.pp index 241546450..b600b1be7 100644 --- a/manifests/default_mods.pp +++ b/manifests/default_mods.pp @@ -24,8 +24,12 @@ } default: {} } - ::apache::mod { 'authz_host': } - + case $::osfamily { + 'gentoo': {} + default: { + ::apache::mod { 'authz_host': } + } + } # The rest of the modules only get loaded if we want all modules enabled if $all { case $::osfamily { diff --git a/manifests/init.pp b/manifests/init.pp index f7b89076d..b3da9ff0a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -261,6 +261,23 @@ $error_log = 'httpd-error.log' $scriptalias = '/usr/local/www/apache24/cgi-bin' $access_log_file = 'httpd-access.log' + } 'gentoo': { + $pidfile = '/run/apache2.pid' + $error_log = 'error.log' + $error_documents_path = '/usr/share/apache2/error' + $scriptalias = '/var/www/localhost/cgi-bin' + $access_log_file = 'access.log' + + ::portage::makeconf { 'apache2_modules': + content => $default_mods, + } + file { [ + '/etc/apache2/modules.d/.keep_www-servers_apache-2', + '/etc/apache2/vhosts.d/.keep_www-servers_apache-2' + ]: + ensure => absent, + require => Package['httpd'], + } } default: { fail("Unsupported osfamily ${::osfamily}") diff --git a/manifests/mod/alias.pp b/manifests/mod/alias.pp index c9f8e4dab..ca3f226b3 100644 --- a/manifests/mod/alias.pp +++ b/manifests/mod/alias.pp @@ -10,6 +10,7 @@ default => '/var/www/icons', }, 'freebsd' => '/usr/local/www/apache24/icons', + 'gentoo' => '/usr/share/apache2/icons', } apache::mod { 'alias': } # Template uses $icons_path diff --git a/manifests/mod/disk_cache.pp b/manifests/mod/disk_cache.pp index 2730809cf..2b9d8a910 100644 --- a/manifests/mod/disk_cache.pp +++ b/manifests/mod/disk_cache.pp @@ -3,6 +3,7 @@ 'debian' => '/var/cache/apache2/mod_disk_cache', 'redhat' => '/var/cache/mod_proxy', 'freebsd' => '/var/cache/mod_disk_cache', + 'gentoo' => '/var/cache/apache2/mod_disk_cache', } $mod_name = $::osfamily ? { diff --git a/manifests/mod/event.pp b/manifests/mod/event.pp index 18a226ee5..8dc26e5e6 100644 --- a/manifests/mod/event.pp +++ b/manifests/mod/event.pp @@ -59,6 +59,11 @@ apache_version => $apache_version, } } + 'gentoo': { + ::portage::makeconf { 'apache2_mpms': + content => 'event', + } + } default: { fail("Unsupported osfamily ${::osfamily}") } diff --git a/manifests/mod/itk.pp b/manifests/mod/itk.pp index 49794945d..2be7d832d 100644 --- a/manifests/mod/itk.pp +++ b/manifests/mod/itk.pp @@ -48,6 +48,11 @@ apache_version => $apache_version, } } + 'gentoo': { + ::portage::makeconf { 'apache2_mpms': + content => 'itk', + } + } default: { fail("Unsupported osfamily ${::osfamily}") } diff --git a/manifests/mod/peruser.pp b/manifests/mod/peruser.pp index 6b9dfad95..b6a8015f9 100644 --- a/manifests/mod/peruser.pp +++ b/manifests/mod/peruser.pp @@ -14,6 +14,12 @@ fail("Unsupported osfamily ${::osfamily}") } default: { + if $::osfamily == 'gentoo' { + ::portage::makeconf { 'apache2_mpms': + content => 'peruser', + } + } + if defined(Class['apache::mod::event']) { fail('May not include both apache::mod::peruser and apache::mod::event on the same node') } diff --git a/manifests/mod/prefork.pp b/manifests/mod/prefork.pp index 90fa39a89..035e8818a 100644 --- a/manifests/mod/prefork.pp +++ b/manifests/mod/prefork.pp @@ -65,6 +65,11 @@ apache_version => $apache_version, } } + 'gentoo': { + ::portage::makeconf { 'apache2_mpms': + content => 'prefork', + } + } default: { fail("Unsupported osfamily ${::osfamily}") } diff --git a/manifests/mod/proxy_html.pp b/manifests/mod/proxy_html.pp index 279cb64ad..8b910c251 100644 --- a/manifests/mod/proxy_html.pp +++ b/manifests/mod/proxy_html.pp @@ -4,7 +4,7 @@ # Add libxml2 case $::osfamily { - /RedHat|FreeBSD/: { + /RedHat|FreeBSD|Gentoo/: { ::apache::mod { 'xml2enc': } $loadfiles = undef } diff --git a/manifests/mod/ssl.pp b/manifests/mod/ssl.pp index 9e352cbf1..c1f118f4a 100644 --- a/manifests/mod/ssl.pp +++ b/manifests/mod/ssl.pp @@ -17,6 +17,7 @@ 'debian' => "\${APACHE_RUN_DIR}/ssl_scache(512000)", 'redhat' => '/var/cache/mod_ssl/scache(512000)', 'freebsd' => '/var/run/ssl_scache(512000)', + 'gentoo' => '/var/run/ssl_scache(512000)', } case $::osfamily { @@ -35,6 +36,9 @@ 'freebsd': { $ssl_mutex = 'default' } + 'gentoo': { + $ssl_mutex = 'default' + } default: { fail("Unsupported osfamily ${::osfamily}") } diff --git a/manifests/mod/worker.pp b/manifests/mod/worker.pp index 48d1c9f22..02a1beae3 100644 --- a/manifests/mod/worker.pp +++ b/manifests/mod/worker.pp @@ -67,6 +67,11 @@ apache_version => $apache_version, } } + 'gentoo': { + ::portage::makeconf { 'apache2_mpms': + content => 'worker', + } + } default: { fail("Unsupported osfamily ${::osfamily}") } diff --git a/manifests/params.pp b/manifests/params.pp index add2d94ae..386fec3c1 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -347,6 +347,67 @@ $wsgi_socket_prefix = undef $docroot = '/usr/local/www/apache24/data' $error_documents_path = '/usr/local/www/apache24/error' + } elsif $::osfamily == 'Gentoo' { + $user = 'apache' + $group = 'apache' + $root_group = 'wheel' + $apache_name = 'www-servers/apache' + $service_name = 'apache2' + $httpd_dir = '/etc/apache2' + $server_root = '/var/www' + $conf_dir = $httpd_dir + $confd_dir = "${httpd_dir}/conf.d" + $mod_dir = "${httpd_dir}/modules.d" + $mod_enable_dir = undef + $vhost_dir = "${httpd_dir}/vhosts.d" + $vhost_enable_dir = undef + $conf_file = 'httpd.conf' + $ports_file = "${conf_dir}/ports.conf" + $logroot = '/var/log/apache2' + $logroot_mode = undef + $lib_path = '/usr/lib/apache2/modules' + $mpm_module = 'prefork' + $dev_packages = undef + $default_ssl_cert = '/etc/ssl/apache2/server.crt' + $default_ssl_key = '/etc/ssl/apache2/server.key' + $ssl_certs_dir = '/etc/ssl/apache2' + $passenger_root = '/usr' + $passenger_ruby = '/usr/bin/ruby' + $passenger_conf_file = 'passenger.conf' + $passenger_conf_package_file = undef + $passenger_default_ruby = undef + $suphp_addhandler = 'x-httpd-php' + $suphp_engine = 'off' + $suphp_configpath = '/etc/php5/apache2' + $mod_packages = { + # NOTE: I list here only modules that are not included in www-servers/apache + 'auth_kerb' => 'www-apache/mod_auth_kerb', + 'fcgid' => 'www-apache/mod_fcgid', + 'passenger' => 'www-apache/passenger', + 'perl' => 'www-apache/mod_perl', + 'php5' => 'dev-lang/php', + 'proxy_html' => 'www-apache/mod_proxy_html', + 'proxy_fcgi' => 'www-apache/mod_proxy_fcgi', + 'python' => 'www-apache/mod_python', + 'wsgi' => 'www-apache/mod_wsgi', + 'dav_svn' => 'dev-vcs/subversion', + 'xsendfile' => 'www-apache/mod_xsendfile', + 'rpaf' => 'www-apache/mod_rpaf', + 'xml2enc' => 'www-apache/mod_xml2enc', + } + $mod_libs = { + 'php5' => 'libphp5.so', + } + $conf_template = 'apache/httpd.conf.erb' + $keepalive = 'Off' + $keepalive_timeout = 15 + $max_keepalive_requests = 100 + $fastcgi_lib_path = undef # TODO: revisit + $mime_support_package = 'app-misc/mime-types' + $mime_types_config = '/etc/mime.types' + $wsgi_socket_prefix = undef + $docroot = '/var/www/localhost/htdocs' + $error_documents_path = '/usr/share/apache2/error' } else { fail("Class['apache::params']: Unsupported osfamily: ${::osfamily}") } diff --git a/manifests/version.pp b/manifests/version.pp index 7f1da0f07..ce3b90769 100644 --- a/manifests/version.pp +++ b/manifests/version.pp @@ -30,6 +30,9 @@ 'FreeBSD': { $default = '2.4' } + 'Gentoo': { + $default = '2.4' + } default: { fail("Class['apache::version']: Unsupported osfamily: ${::osfamily}") } diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index 76e5cd612..0a7d67bbb 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -11,6 +11,9 @@ when 'FreeBSD' package_name = 'apache24' service_name = 'apache24' + when 'Gentoo' + package_name = 'www-servers/apache' + service_name = 'apache2' end context 'default parameters' do diff --git a/spec/acceptance/default_mods_spec.rb b/spec/acceptance/default_mods_spec.rb index f06a966af..0199f180b 100644 --- a/spec/acceptance/default_mods_spec.rb +++ b/spec/acceptance/default_mods_spec.rb @@ -10,6 +10,9 @@ when 'FreeBSD' mod_dir = '/usr/local/etc/apache24/Modules' servicename = 'apache24' +when 'Gentoo' + mod_dir = '/etc/apache2/modules.d' + servicename = 'apache2' end describe 'apache::default_mods class', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do @@ -100,7 +103,7 @@ class { 'apache': it 'should apply with no errors' do pp = <<-EOS class { 'apache': default_mods => false } - ::apache::mod { 'auth_basic': + ::apache::mod { 'auth_basic': loadfile_name => 'zz_auth_basic.load', } EOS diff --git a/spec/acceptance/mod_deflate_spec.rb b/spec/acceptance/mod_deflate_spec.rb index 668897c04..3b505bdbf 100644 --- a/spec/acceptance/mod_deflate_spec.rb +++ b/spec/acceptance/mod_deflate_spec.rb @@ -11,6 +11,9 @@ when 'FreeBSD' mod_dir = '/usr/local/etc/apache24/Modules' service_name = 'apache24' + when 'Gentoo' + mod_dir = '/etc/apache2/modules.d' + service_name = 'apache2' end context "default deflate config" do diff --git a/spec/acceptance/mod_mime_spec.rb b/spec/acceptance/mod_mime_spec.rb index 6bd959ce3..d1886c4bd 100644 --- a/spec/acceptance/mod_mime_spec.rb +++ b/spec/acceptance/mod_mime_spec.rb @@ -11,6 +11,9 @@ when 'FreeBSD' mod_dir = '/usr/local/etc/apache24/Modules' service_name = 'apache24' + when 'Gentoo' + mod_dir = '/etc/apache2/modules.d' + service_name = 'apache2' end context "default mime config" do diff --git a/spec/acceptance/mod_negotiation_spec.rb b/spec/acceptance/mod_negotiation_spec.rb index 371ab0f1d..a44edbf26 100644 --- a/spec/acceptance/mod_negotiation_spec.rb +++ b/spec/acceptance/mod_negotiation_spec.rb @@ -14,6 +14,10 @@ vhost_dir = '/usr/local/etc/apache24/Vhosts' mod_dir = '/usr/local/etc/apache24/Modules' service_name = 'apache24' + when 'Gentoo' + vhost_dir = '/etc/apache2/vhosts.d' + mod_dir = '/etc/apache2/modules.d' + service_name = 'apache2' end context "default negotiation config" do diff --git a/spec/acceptance/mod_pagespeed_spec.rb b/spec/acceptance/mod_pagespeed_spec.rb index 24b680794..5fa342e9a 100644 --- a/spec/acceptance/mod_pagespeed_spec.rb +++ b/spec/acceptance/mod_pagespeed_spec.rb @@ -14,6 +14,10 @@ vhost_dir = '/usr/local/etc/apache24/Vhosts' mod_dir = '/usr/local/etc/apache24/Modules' service_name = 'apache24' + when 'Gentoo' + vhost_dir = '/etc/apache2/vhosts.d' + mod_dir = '/etc/apache2/modules.d' + service_name = 'apache2' end context "default pagespeed config" do @@ -30,7 +34,7 @@ class { 'apt': } repos => 'main', include_src => false, before => Class['apache'], - } + } } elsif $::osfamily == 'RedHat' { yumrepo { 'mod-pagespeed': baseurl => "http://dl.google.com/linux/mod-pagespeed/rpm/stable/$::architecture", diff --git a/spec/acceptance/mod_php_spec.rb b/spec/acceptance/mod_php_spec.rb index 28da68d3a..502ec1ddc 100644 --- a/spec/acceptance/mod_php_spec.rb +++ b/spec/acceptance/mod_php_spec.rb @@ -14,6 +14,10 @@ vhost_dir = '/usr/local/etc/apache24/Vhosts' mod_dir = '/usr/local/etc/apache24/Modules' service_name = 'apache24' + when 'Gentoo' + vhost_dir = '/etc/apache2/vhosts.d' + mod_dir = '/etc/apache2/modules.d' + service_name = 'apache2' end context "default php config" do diff --git a/spec/acceptance/mod_proxy_html_spec.rb b/spec/acceptance/mod_proxy_html_spec.rb index 91bb0a097..e45600089 100644 --- a/spec/acceptance/mod_proxy_html_spec.rb +++ b/spec/acceptance/mod_proxy_html_spec.rb @@ -8,6 +8,8 @@ service_name = 'httpd' when 'FreeBSD' service_name = 'apache24' + when 'Gentoo' + service_name = 'apache2' end context "default proxy_html config" do diff --git a/spec/acceptance/prefork_worker_spec.rb b/spec/acceptance/prefork_worker_spec.rb index 5ed8726d6..0ac27232d 100644 --- a/spec/acceptance/prefork_worker_spec.rb +++ b/spec/acceptance/prefork_worker_spec.rb @@ -7,6 +7,8 @@ servicename = 'apache2' when 'FreeBSD' servicename = 'apache24' +when 'Gentoo' + servicename = 'apache2' end case fact('osfamily') diff --git a/spec/acceptance/version.rb b/spec/acceptance/version.rb index 098b0f41c..117e23d9f 100644 --- a/spec/acceptance/version.rb +++ b/spec/acceptance/version.rb @@ -56,6 +56,19 @@ $error_log = 'http-error.log' $apache_version = '2.2' +when 'Gentoo' + $confd_dir = '/etc/apache2/conf.d' + $mod_dir = '/etc/apache2/modules.d' + $conf_file = '/etc/apache2/httpd.conf' + $ports_file = '/etc/apache2/ports.conf' + $vhost = '/etc/apache2/vhosts.d/15-default.conf' + $vhost_dir = '/etc/apache2/vhosts.d' + $run_dir = '/var/run/apache2' + $service_name = 'apache2' + $package_name = 'www-servers/apache' + $error_log = 'http-error.log' + + $apache_version = '2.4' else $apache_version = '0' end diff --git a/spec/classes/apache_spec.rb b/spec/classes/apache_spec.rb index ebe267d7a..a9fe707cf 100644 --- a/spec/classes/apache_spec.rb +++ b/spec/classes/apache_spec.rb @@ -613,6 +613,48 @@ ) } end end + context "on a Gentoo OS" do + let :facts do + { + :id => 'root', + :kernel => 'Linux', + :osfamily => 'Gentoo', + :operatingsystem => 'Gentoo', + :operatingsystemrelease => '3.16.1-gentoo', + :concat_basedir => '/dne', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin', + :is_pe => false, + } + end + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_user("apache") } + it { is_expected.to contain_group("apache") } + it { is_expected.to contain_class("apache::service") } + it { is_expected.to contain_file("/var/www/localhost/htdocs").with( + 'ensure' => 'directory' + ) + } + it { is_expected.to contain_file("/etc/apache2/vhosts.d").with( + 'ensure' => 'directory', + 'recurse' => 'true', + 'purge' => 'true', + 'notify' => 'Class[Apache::Service]', + 'require' => 'Package[httpd]' + ) } + it { is_expected.to contain_file("/etc/apache2/modules.d").with( + 'ensure' => 'directory', + 'recurse' => 'true', + 'purge' => 'true', + 'notify' => 'Class[Apache::Service]', + 'require' => 'Package[httpd]' + ) } + it { is_expected.to contain_concat("/etc/apache2/ports.conf").with( + 'owner' => 'root', + 'group' => 'wheel', + 'mode' => '0644', + 'notify' => 'Class[Apache::Service]' + ) } + end context 'on all OSes' do let :facts do { diff --git a/spec/classes/dev_spec.rb b/spec/classes/dev_spec.rb index 83292b1b1..09a031a39 100644 --- a/spec/classes/dev_spec.rb +++ b/spec/classes/dev_spec.rb @@ -42,4 +42,19 @@ end it { is_expected.to contain_class("apache::params") } end + context "on a Gentoo OS" do + let :pre_condition do + 'include apache::package' + end + let :facts do + { + :osfamily => 'Gentoo', + :operatingsystem => 'Gentoo', + :operatingsystemrelease => '3.16.1-gentoo', + :concat_basedir => '/dne', + :is_pe => false, + } + end + it { is_expected.to contain_class("apache::params") } + end end diff --git a/spec/classes/mod/auth_kerb_spec.rb b/spec/classes/mod/auth_kerb_spec.rb index 8f82ff4dd..beba378a9 100644 --- a/spec/classes/mod/auth_kerb_spec.rb +++ b/spec/classes/mod/auth_kerb_spec.rb @@ -56,4 +56,21 @@ it { is_expected.to contain_apache__mod("auth_kerb") } it { is_expected.to contain_package("www/mod_auth_kerb2") } end + context "on a Gentoo OS", :compile do + let :facts do + { + :id => 'root', + :kernel => 'Linux', + :osfamily => 'Gentoo', + :operatingsystem => 'Gentoo', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin', + :operatingsystemrelease => '3.16.1-gentoo', + :concat_basedir => '/dne', + :is_pe => false, + } + end + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod("auth_kerb") } + it { is_expected.to contain_package("www-apache/mod_auth_kerb") } + end end diff --git a/spec/classes/mod/dav_svn_spec.rb b/spec/classes/mod/dav_svn_spec.rb index 791baae03..06c6b870f 100644 --- a/spec/classes/mod/dav_svn_spec.rb +++ b/spec/classes/mod/dav_svn_spec.rb @@ -59,4 +59,21 @@ it { is_expected.to contain_apache__mod('dav_svn') } it { is_expected.to contain_package("devel/subversion") } end + context "on a Gentoo OS", :compile do + let :facts do + { + :id => 'root', + :operatingsystemrelease => '3.16.1-gentoo', + :concat_basedir => '/dne', + :kernel => 'Linux', + :osfamily => 'Gentoo', + :operatingsystem => 'Gentoo', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin', + :is_pe => false, + } + end + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('dav_svn') } + it { is_expected.to contain_package("dev-vcs/subversion") } + end end diff --git a/spec/classes/mod/deflate_spec.rb b/spec/classes/mod/deflate_spec.rb index 2eb6f5e8a..d0d8fedc2 100644 --- a/spec/classes/mod/deflate_spec.rb +++ b/spec/classes/mod/deflate_spec.rb @@ -100,4 +100,27 @@ class { "apache::mod::deflate": :path => '/usr/local/etc/apache24/Modules/deflate.conf', } ) } end + + context "On a Gentoo OS with default params" do + let :facts do + { + :id => 'root', + :kernel => 'Linux', + :osfamily => 'Gentoo', + :operatingsystem => 'Gentoo', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin', + :operatingsystemrelease => '3.16.1-gentoo', + :concat_basedir => '/dne', + :is_pe => false, + } + end + + # Load the more generic tests for this context + general_deflate_specs() + + it { is_expected.to contain_file("deflate.conf").with({ + :ensure => 'file', + :path => '/etc/apache2/modules.d/deflate.conf', + } ) } + end end diff --git a/spec/classes/mod/dir_spec.rb b/spec/classes/mod/dir_spec.rb index 8aec59fed..11622a41c 100644 --- a/spec/classes/mod/dir_spec.rb +++ b/spec/classes/mod/dir_spec.rb @@ -103,4 +103,36 @@ it { is_expected.to contain_file('dir.conf').with_content(/ fearsome\.aspx$/) } end end + context "on a Gentoo OS" do + let :facts do + { + :osfamily => 'Gentoo', + :operatingsystem => 'Gentoo', + :operatingsystemrelease => '3.16.1-gentoo', + :concat_basedir => '/dne', + :id => 'root', + :kernel => 'Linux', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin', + :is_pe => false, + } + end + context "passing no parameters" do + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('dir') } + it { is_expected.to contain_file('dir.conf').with_content(/^DirectoryIndex /) } + it { is_expected.to contain_file('dir.conf').with_content(/ index\.html /) } + it { is_expected.to contain_file('dir.conf').with_content(/ index\.html\.var /) } + it { is_expected.to contain_file('dir.conf').with_content(/ index\.cgi /) } + it { is_expected.to contain_file('dir.conf').with_content(/ index\.pl /) } + it { is_expected.to contain_file('dir.conf').with_content(/ index\.php /) } + it { is_expected.to contain_file('dir.conf').with_content(/ index\.xhtml$/) } + end + context "passing indexes => ['example.txt','fearsome.aspx']" do + let :params do + {:indexes => ['example.txt','fearsome.aspx']} + end + it { is_expected.to contain_file('dir.conf').with_content(/ example\.txt /) } + it { is_expected.to contain_file('dir.conf').with_content(/ fearsome\.aspx$/) } + end + end end diff --git a/spec/classes/mod/event_spec.rb b/spec/classes/mod/event_spec.rb index 796b6c393..dd0a427ea 100644 --- a/spec/classes/mod/event_spec.rb +++ b/spec/classes/mod/event_spec.rb @@ -21,6 +21,23 @@ it { is_expected.not_to contain_apache__mod('event') } it { is_expected.to contain_file("/usr/local/etc/apache24/Modules/event.conf").with_ensure('file') } end + context "on a Gentoo OS" do + let :facts do + { + :osfamily => 'Gentoo', + :operatingsystem => 'Gentoo', + :operatingsystemrelease => '3.16.1-gentoo', + :concat_basedir => '/dne', + :id => 'root', + :kernel => 'Linux', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin', + :is_pe => false, + } + end + it { is_expected.to contain_class("apache::params") } + it { is_expected.not_to contain_apache__mod('event') } + it { is_expected.to contain_file("/etc/apache2/modules.d/event.conf").with_ensure('file') } + end context "on a Debian OS" do let :facts do { @@ -58,7 +75,7 @@ :maxconnectionsperchild => '10', } end - + it { is_expected.to contain_file("/etc/apache2/mods-available/event.conf").with_ensure('file').with_content(/^\s*ServerLimit\s*0/) } it { is_expected.to contain_file("/etc/apache2/mods-available/event.conf").with_ensure('file').with_content(/^\s*StartServers\s*1/) } it { is_expected.to contain_file("/etc/apache2/mods-available/event.conf").with_ensure('file').with_content(/^\s*MaxClients\s*2/) } diff --git a/spec/classes/mod/fcgid_spec.rb b/spec/classes/mod/fcgid_spec.rb index 214ec75be..f772ff7a2 100644 --- a/spec/classes/mod/fcgid_spec.rb +++ b/spec/classes/mod/fcgid_spec.rb @@ -114,4 +114,23 @@ it { is_expected.to contain_apache__mod('fcgid') } it { is_expected.to contain_package("www/mod_fcgid") } end + + context "on a Gentoo OS" do + let :facts do + { + :osfamily => 'Gentoo', + :operatingsystem => 'Gentoo', + :operatingsystemrelease => '3.16.1-gentoo', + :concat_basedir => '/dne', + :id => 'root', + :kernel => 'Linux', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin', + :is_pe => false, + } + end + + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('fcgid') } + it { is_expected.to contain_package("www-apache/mod_fcgid") } + end end diff --git a/spec/classes/mod/info_spec.rb b/spec/classes/mod/info_spec.rb index 32c6339dd..b444bc003 100644 --- a/spec/classes/mod/info_spec.rb +++ b/spec/classes/mod/info_spec.rb @@ -197,4 +197,26 @@ def general_info_specs_24 } ) } end + context 'on a Gentoo OS' do + let :facts do + { + :osfamily => 'Gentoo', + :operatingsystem => 'Gentoo', + :operatingsystemrelease => '3.16.1-gentoo', + :concat_basedir => '/dne', + :id => 'root', + :kernel => 'Linux', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin', + :is_pe => false, + } + end + + # Load the more generic tests for this context + general_info_specs_24() + + it { is_expected.to contain_file('info.conf').with({ + :ensure => 'file', + :path => '/etc/apache2/modules.d/info.conf', + } ) } + end end diff --git a/spec/classes/mod/passenger_spec.rb b/spec/classes/mod/passenger_spec.rb index 9c9935939..619c8f4f1 100644 --- a/spec/classes/mod/passenger_spec.rb +++ b/spec/classes/mod/passenger_spec.rb @@ -257,4 +257,21 @@ it { is_expected.to contain_apache__mod('passenger') } it { is_expected.to contain_package("www/rubygem-passenger") } end + context "on a Gentoo OS" do + let :facts do + { + :osfamily => 'Gentoo', + :operatingsystem => 'Gentoo', + :operatingsystemrelease => '3.16.1-gentoo', + :concat_basedir => '/dne', + :id => 'root', + :kernel => 'Linux', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin', + :is_pe => false, + } + end + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('passenger') } + it { is_expected.to contain_package("www-apache/passenger") } + end end diff --git a/spec/classes/mod/perl_spec.rb b/spec/classes/mod/perl_spec.rb index 5bfe8ff2d..17ee1b366 100644 --- a/spec/classes/mod/perl_spec.rb +++ b/spec/classes/mod/perl_spec.rb @@ -56,4 +56,21 @@ it { is_expected.to contain_apache__mod('perl') } it { is_expected.to contain_package("www/mod_perl2") } end + context "on a Gentoo OS" do + let :facts do + { + :osfamily => 'Gentoo', + :operatingsystemrelease => '3.16.1-gentoo', + :concat_basedir => '/dne', + :operatingsystem => 'Gentoo', + :id => 'root', + :kernel => 'Linux', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin', + :is_pe => false, + } + end + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('perl') } + it { is_expected.to contain_package("www-apache/mod_perl") } + end end diff --git a/spec/classes/mod/peruser_spec.rb b/spec/classes/mod/peruser_spec.rb index d38f8bba6..f39cbcf6c 100644 --- a/spec/classes/mod/peruser_spec.rb +++ b/spec/classes/mod/peruser_spec.rb @@ -23,4 +23,21 @@ }.to raise_error(Puppet::Error, /Unsupported osfamily FreeBSD/) end end + context "on a Gentoo OS" do + let :facts do + { + :osfamily => 'Gentoo', + :operatingsystem => 'Gentoo', + :operatingsystemrelease => '3.16.1-gentoo', + :concat_basedir => '/dne', + :id => 'root', + :kernel => 'Linux', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin', + :is_pe => false, + } + end + it { is_expected.to contain_class("apache::params") } + it { is_expected.not_to contain_apache__mod('peruser') } + it { is_expected.to contain_file("/etc/apache2/modules.d/peruser.conf").with_ensure('file') } + end end diff --git a/spec/classes/mod/php_spec.rb b/spec/classes/mod/php_spec.rb index f2dbfb1a9..246b3bbd4 100644 --- a/spec/classes/mod/php_spec.rb +++ b/spec/classes/mod/php_spec.rb @@ -155,6 +155,39 @@ it { is_expected.to contain_file('php5.load') } end end + describe "on a Gentoo OS" do + let :facts do + { + :osfamily => 'Gentoo', + :operatingsystem => 'Gentoo', + :operatingsystemrelease => '3.16.1-gentoo', + :concat_basedir => '/dne', + :id => 'root', + :kernel => 'Linux', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin', + :is_pe => false, + } + end + context "with mpm_module => prefork" do + let :pre_condition do + 'class { "apache": mpm_module => prefork, }' + end + it { is_expected.to contain_class('apache::params') } + it { is_expected.to contain_apache__mod('php5') } + it { is_expected.to contain_package("dev-lang/php") } + it { is_expected.to contain_file('php5.load') } + end + context "with mpm_module => itk" do + let :pre_condition do + 'class { "apache": mpm_module => itk, }' + end + it { is_expected.to contain_class('apache::params') } + it { is_expected.to contain_class('apache::mod::itk') } + it { is_expected.to contain_apache__mod('php5') } + it { is_expected.to contain_package("dev-lang/php") } + it { is_expected.to contain_file('php5.load') } + end + end describe "OS independent tests" do let :facts do { diff --git a/spec/classes/mod/prefork_spec.rb b/spec/classes/mod/prefork_spec.rb index 58c06e0bd..3e2954fc7 100644 --- a/spec/classes/mod/prefork_spec.rb +++ b/spec/classes/mod/prefork_spec.rb @@ -114,4 +114,21 @@ it { is_expected.not_to contain_apache__mod('prefork') } it { is_expected.to contain_file("/usr/local/etc/apache24/Modules/prefork.conf").with_ensure('file') } end + context "on a Gentoo OS" do + let :facts do + { + :osfamily => 'Gentoo', + :operatingsystem => 'Gentoo', + :operatingsystemrelease => '3.16.1-gentoo', + :concat_basedir => '/dne', + :id => 'root', + :kernel => 'Linux', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin', + :is_pe => false, + } + end + it { is_expected.to contain_class("apache::params") } + it { is_expected.not_to contain_apache__mod('prefork') } + it { is_expected.to contain_file("/etc/apache2/modules.d/prefork.conf").with_ensure('file') } + end end diff --git a/spec/classes/mod/proxy_html_spec.rb b/spec/classes/mod/proxy_html_spec.rb index ce3e70c3a..80106931e 100644 --- a/spec/classes/mod/proxy_html_spec.rb +++ b/spec/classes/mod/proxy_html_spec.rb @@ -85,4 +85,21 @@ it { is_expected.to contain_apache__mod('proxy_html').with(:loadfiles => nil) } it { is_expected.to contain_package("www/mod_proxy_html") } end + context "on a Gentoo OS", :compile do + let :facts do + { + :osfamily => 'Gentoo', + :operatingsystem => 'Gentoo', + :operatingsystemrelease => '3.16.1-gentoo', + :concat_basedir => '/dne', + :id => 'root', + :kernel => 'Linux', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin', + :is_pe => false, + } + end + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('proxy_html').with(:loadfiles => nil) } + it { is_expected.to contain_package("www-apache/mod_proxy_html") } + end end diff --git a/spec/classes/mod/python_spec.rb b/spec/classes/mod/python_spec.rb index 9b6d846de..46c4cde3a 100644 --- a/spec/classes/mod/python_spec.rb +++ b/spec/classes/mod/python_spec.rb @@ -56,4 +56,21 @@ it { is_expected.to contain_apache__mod("python") } it { is_expected.to contain_package("www/mod_python3") } end + context "on a Gentoo OS" do + let :facts do + { + :osfamily => 'Gentoo', + :operatingsystem => 'Gentoo', + :operatingsystemrelease => '3.16.1-gentoo', + :concat_basedir => '/dne', + :id => 'root', + :kernel => 'Linux', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin', + :is_pe => false, + } + end + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod("python") } + it { is_expected.to contain_package("www-apache/mod_python") } + end end diff --git a/spec/classes/mod/reqtimeout_spec.rb b/spec/classes/mod/reqtimeout_spec.rb index 97aa7db45..1869eb68d 100644 --- a/spec/classes/mod/reqtimeout_spec.rb +++ b/spec/classes/mod/reqtimeout_spec.rb @@ -112,4 +112,39 @@ it { is_expected.to contain_file('reqtimeout.conf').with_content(/^RequestReadTimeout header=20-60,minrate=600$/) } end end + context "on a Gentoo OS" do + let :facts do + { + :osfamily => 'Gentoo', + :operatingsystem => 'Gentoo', + :operatingsystemrelease => '3.16.1-gentoo', + :concat_basedir => '/dne', + :id => 'root', + :kernel => 'Linux', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin', + :is_pe => false, + } + end + context "passing no parameters" do + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('reqtimeout') } + it { is_expected.to contain_file('reqtimeout.conf').with_content(/^RequestReadTimeout header=20-40,minrate=500\nRequestReadTimeout body=10,minrate=500$/) } + end + context "passing timeouts => ['header=20-60,minrate=600', 'body=60,minrate=600']" do + let :params do + {:timeouts => ['header=20-60,minrate=600', 'body=60,minrate=600']} + end + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('reqtimeout') } + it { is_expected.to contain_file('reqtimeout.conf').with_content(/^RequestReadTimeout header=20-60,minrate=600\nRequestReadTimeout body=60,minrate=600$/) } + end + context "passing timeouts => 'header=20-60,minrate=600'" do + let :params do + {:timeouts => 'header=20-60,minrate=600'} + end + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('reqtimeout') } + it { is_expected.to contain_file('reqtimeout.conf').with_content(/^RequestReadTimeout header=20-60,minrate=600$/) } + end + end end diff --git a/spec/classes/mod/rpaf_spec.rb b/spec/classes/mod/rpaf_spec.rb index d2d5c342d..83591bc28 100644 --- a/spec/classes/mod/rpaf_spec.rb +++ b/spec/classes/mod/rpaf_spec.rb @@ -68,6 +68,46 @@ }) } it { is_expected.to contain_file('rpaf.conf').with_content(/^RPAFenable On$/) } + describe "with sethostname => true" do + let :params do + { :sethostname => 'true' } + end + it { is_expected.to contain_file('rpaf.conf').with_content(/^RPAFsethostname On$/) } + end + describe "with proxy_ips => [ 10.42.17.8, 10.42.18.99 ]" do + let :params do + { :proxy_ips => [ '10.42.17.8', '10.42.18.99' ] } + end + it { is_expected.to contain_file('rpaf.conf').with_content(/^RPAFproxy_ips 10.42.17.8 10.42.18.99$/) } + end + describe "with header => X-Real-IP" do + let :params do + { :header => 'X-Real-IP' } + end + it { is_expected.to contain_file('rpaf.conf').with_content(/^RPAFheader X-Real-IP$/) } + end + end + context "on a Gentoo OS" do + let :facts do + { + :osfamily => 'Gentoo', + :operatingsystem => 'Gentoo', + :operatingsystemrelease => '3.16.1-gentoo', + :concat_basedir => '/dne', + :id => 'root', + :kernel => 'Linux', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin', + :is_pe => false, + } + end + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('rpaf') } + it { is_expected.to contain_package("www-apache/mod_rpaf") } + it { is_expected.to contain_file('rpaf.conf').with({ + 'path' => '/etc/apache2/modules.d/rpaf.conf', + }) } + it { is_expected.to contain_file('rpaf.conf').with_content(/^RPAFenable On$/) } + describe "with sethostname => true" do let :params do { :sethostname => 'true' } diff --git a/spec/classes/mod/ssl_spec.rb b/spec/classes/mod/ssl_spec.rb index a657567ab..217c9ee8b 100644 --- a/spec/classes/mod/ssl_spec.rb +++ b/spec/classes/mod/ssl_spec.rb @@ -83,6 +83,23 @@ it { is_expected.to contain_apache__mod('ssl') } end + context 'on a Gentoo OS' do + let :facts do + { + :osfamily => 'Gentoo', + :operatingsystem => 'Gentoo', + :operatingsystemrelease => '3.16.1-gentoo', + :concat_basedir => '/dne', + :id => 'root', + :kernel => 'Linux', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin', + :is_pe => false, + } + end + it { is_expected.to contain_class('apache::params') } + it { is_expected.to contain_apache__mod('ssl') } + end + # Template config doesn't vary by distro context "on all distros" do let :facts do @@ -123,6 +140,5 @@ it { is_expected.to contain_file('ssl.conf').with_content(/^ SSLRandomSeed startup file:\/dev\/random 256$/)} it { is_expected.to contain_file('ssl.conf').with_content(/^ SSLRandomSeed connect file:\/dev\/urandom 1024$/)} end - end end diff --git a/spec/classes/mod/worker_spec.rb b/spec/classes/mod/worker_spec.rb index bb99a0fe6..38a79aeb2 100644 --- a/spec/classes/mod/worker_spec.rb +++ b/spec/classes/mod/worker_spec.rb @@ -114,6 +114,23 @@ it { is_expected.not_to contain_apache__mod('worker') } it { is_expected.to contain_file("/usr/local/etc/apache24/Modules/worker.conf").with_ensure('file') } end + context "on a Gentoo OS" do + let :facts do + { + :osfamily => 'Gentoo', + :operatingsystem => 'Gentoo', + :operatingsystemrelease => '3.16.1-gentoo', + :concat_basedir => '/dne', + :id => 'root', + :kernel => 'Linux', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin', + :is_pe => false, + } + end + it { is_expected.to contain_class("apache::params") } + it { is_expected.not_to contain_apache__mod('worker') } + it { is_expected.to contain_file("/etc/apache2/modules.d/worker.conf").with_ensure('file') } + end # Template config doesn't vary by distro context "on all distros" do diff --git a/spec/classes/mod/wsgi_spec.rb b/spec/classes/mod/wsgi_spec.rb index e8dd00db0..3f03ec907 100644 --- a/spec/classes/mod/wsgi_spec.rb +++ b/spec/classes/mod/wsgi_spec.rb @@ -124,4 +124,24 @@ } it { is_expected.to contain_package("www/mod_wsgi") } end + context "on a Gentoo OS" do + let :facts do + { + :osfamily => 'Gentoo', + :operatingsystem => 'Gentoo', + :operatingsystemrelease => '3.16.1-gentoo', + :concat_basedir => '/dne', + :id => 'root', + :kernel => 'Linux', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin', + :is_pe => false, + } + end + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_class('apache::mod::wsgi').with( + 'wsgi_socket_prefix' => nil + ) + } + it { is_expected.to contain_package("www-apache/mod_wsgi") } + end end diff --git a/spec/classes/service_spec.rb b/spec/classes/service_spec.rb index ef3504d19..09906b0d3 100644 --- a/spec/classes/service_spec.rb +++ b/spec/classes/service_spec.rb @@ -94,7 +94,7 @@ end - context "on a RedHat 5 OS" do + context "on a RedHat 5 OS, do not manage service" do let :facts do { :osfamily => 'RedHat', @@ -107,12 +107,16 @@ :is_pe => false, } end - it { is_expected.to contain_service("httpd").with( - 'name' => 'httpd', - 'ensure' => 'running', - 'enable' => 'true' - ) - } + let(:params) do + { + 'service_ensure' => 'running', + 'service_name' => 'httpd', + 'service_manage' => false + } + end + it 'should not manage the httpd service' do + subject.should_not contain_service('httpd') + end end context "on a FreeBSD 5 OS" do @@ -136,29 +140,24 @@ } end - context "on a RedHat 5 OS, do not manage service" do + context "on a Gentoo OS" do let :facts do { - :osfamily => 'RedHat', - :operatingsystemrelease => '5', + :osfamily => 'Gentoo', + :operatingsystem => 'Gentoo', + :operatingsystemrelease => '3.16.1-gentoo', :concat_basedir => '/dne', - :operatingsystem => 'RedHat', :id => 'root', :kernel => 'Linux', - :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin', :is_pe => false, } end - let(:params) do - { - 'service_ensure' => 'running', - 'service_name' => 'httpd', - 'service_manage' => false - } - end - it 'should not manage the httpd service' do - subject.should_not contain_service('httpd') - end + it { is_expected.to contain_service("httpd").with( + 'name' => 'apache2', + 'ensure' => 'running', + 'enable' => 'true' + ) + } end - end diff --git a/spec/defines/fastcgi_server_spec.rb b/spec/defines/fastcgi_server_spec.rb index efb913e6b..1a6d3199c 100644 --- a/spec/defines/fastcgi_server_spec.rb +++ b/spec/defines/fastcgi_server_spec.rb @@ -72,6 +72,27 @@ :path => "/usr/local/etc/apache24/Includes/fastcgi-pool-#{title}.conf" ) } end + context "on Gentoo systems" do + let :default_facts do + { + :osfamily => 'Gentoo', + :operatingsystem => 'Gentoo', + :operatingsystemrelease => '3.16.1-gentoo', + :concat_basedir => '/dne', + :kernel => 'Linux', + :id => 'root', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin', + :is_pe => false, + } + end + let :facts do default_facts end + it { should contain_class("apache") } + it { should contain_class("apache::mod::fastcgi") } + it { should contain_file("fastcgi-pool-#{title}.conf").with( + :ensure => 'present', + :path => "/etc/apache2/conf.d/fastcgi-pool-#{title}.conf" + ) } + end end describe 'os-independent items' do let :facts do diff --git a/spec/defines/mod_spec.rb b/spec/defines/mod_spec.rb index 3700b0edb..e4e984529 100644 --- a/spec/defines/mod_spec.rb +++ b/spec/defines/mod_spec.rb @@ -118,4 +118,35 @@ end end end + + context "on a Gentoo osfamily" do + let :facts do + { + :osfamily => 'Gentoo', + :operatingsystem => 'Gentoo', + :operatingsystemrelease => '3.16.1-gentoo', + :concat_basedir => '/dne', + :id => 'root', + :kernel => 'Linux', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin', + :is_pe => false, + } + end + + describe "for non-special modules" do + let :title do + 'spec_m' + end + it { is_expected.to contain_class("apache::params") } + it "should manage the module load file" do + is_expected.to contain_file('spec_m.load').with({ + :path => '/etc/apache2/modules.d/spec_m.load', + :content => "LoadModule spec_m_module /usr/lib/apache2/modules/mod_spec_m.so\n", + :owner => 'root', + :group => 'wheel', + :mode => '0644', + } ) + end + end + end end diff --git a/spec/defines/vhost_spec.rb b/spec/defines/vhost_spec.rb index 2e77391a1..d2153a605 100644 --- a/spec/defines/vhost_spec.rb +++ b/spec/defines/vhost_spec.rb @@ -82,6 +82,28 @@ :path => '/usr/local/etc/apache24/Vhosts/25-rspec.example.com.conf' ) } end + context "on Gentoo systems" do + let :default_facts do + { + :osfamily => 'Gentoo', + :operatingsystem => 'Gentoo', + :operatingsystemrelease => '3.16.1-gentoo', + :concat_basedir => '/dne', + :id => 'root', + :kernel => 'Linux', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin', + :is_pe => false, + } + end + let :params do default_params end + let :facts do default_facts end + it { is_expected.to contain_class("apache") } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_file("25-rspec.example.com.conf").with( + :ensure => 'present', + :path => '/etc/apache2/vhosts.d/25-rspec.example.com.conf' + ) } + end end describe 'os-independent items' do let :facts do