From 18bd200cc71ecd1de22d160e2666bb5c4fba8e62 Mon Sep 17 00:00:00 2001 From: Martin Dluhos Date: Wed, 22 Aug 2012 16:41:44 -0700 Subject: [PATCH 01/10] Fixed formatting in vhost template. --- templates/vhost-default.conf.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/vhost-default.conf.erb b/templates/vhost-default.conf.erb index 1551a12a6c..6b9421004b 100644 --- a/templates/vhost-default.conf.erb +++ b/templates/vhost-default.conf.erb @@ -12,7 +12,7 @@ NameVirtualHost <%= vhost_name %>:<%= port %> <% if serveraliases.is_a? Array -%> <% serveraliases.each do |name| -%><%= " ServerAlias #{name}\n" %><% end -%> <% elsif serveraliases != '' -%> -<%= " ServerAlias #{serveraliases}" -%> +<%= " ServerAlias #{serveraliases}\n" -%> <% end -%> DocumentRoot <%= docroot %> > From 9cd964dacf527d494ab21fe1e691d196f8fb0f37 Mon Sep 17 00:00:00 2001 From: Martin Dluhos Date: Thu, 23 Aug 2012 14:15:16 -0700 Subject: [PATCH 02/10] Fixed syntax of validate_re function. --- manifests/vhost.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/vhost.pp b/manifests/vhost.pp index f3bba525f6..5d053899e9 100644 --- a/manifests/vhost.pp +++ b/manifests/vhost.pp @@ -57,7 +57,7 @@ $ensure = 'present' ) { - validate_re($ensure, [ '^present$', '^absent$' ], + validate_re($ensure, '^(present|absent)$', "${ensure} is not supported for ensure. Allowed values are 'present' and 'absent'.") From 8c95c76b66448bfefe8060e3ab1fba01cb823464 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Thu, 23 Aug 2012 14:18:51 -0700 Subject: [PATCH 03/10] Change line ending for erb expressions --- templates/vhost-default.conf.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/vhost-default.conf.erb b/templates/vhost-default.conf.erb index 6b9421004b..511ac38596 100644 --- a/templates/vhost-default.conf.erb +++ b/templates/vhost-default.conf.erb @@ -12,7 +12,7 @@ NameVirtualHost <%= vhost_name %>:<%= port %> <% if serveraliases.is_a? Array -%> <% serveraliases.each do |name| -%><%= " ServerAlias #{name}\n" %><% end -%> <% elsif serveraliases != '' -%> -<%= " ServerAlias #{serveraliases}\n" -%> +<%= " ServerAlias #{serveraliases}" %> <% end -%> DocumentRoot <%= docroot %> > From 78208d8676266f0decd2a981b29d621dad2d1bc7 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Sun, 19 Aug 2012 20:52:49 -0700 Subject: [PATCH 04/10] Updating spec coverage for new defines - Functionality of the apache module depends on the existence of either `$osfamily` or `$operatingsystem`. The tests now reflect this. - The class `apache` is no longer tested for inclusion in `apache::mod` because of a bug in puppet-rspec which creates duplicate resources. - Most of the test coverage is for existing code on the `Debian` `$osfamily` as per the the pre-existing design. `RedHat` coverage has been added on a few specific counts. --- spec/classes/apache_spec.rb | 62 +++++++++----- spec/classes/dev_spec.rb | 24 +++++- spec/classes/mod/auth_kerb_spec.rb | 27 +++--- spec/classes/mod/python_spec.rb | 35 ++++---- spec/classes/mod/wsgi_spec.rb | 26 +++--- spec/classes/params_spec.rb | 18 ++-- spec/classes/php_spec.rb | 21 ++++- spec/classes/python_spec.rb | 24 ++++-- spec/defines/vhost/redirect_spec.rb | 94 ++++++++++----------- spec/defines/vhost_spec.rb | 124 ++++++++++++++-------------- 10 files changed, 264 insertions(+), 191 deletions(-) diff --git a/spec/classes/apache_spec.rb b/spec/classes/apache_spec.rb index b3a6d00b9e..2a8777f2a2 100644 --- a/spec/classes/apache_spec.rb +++ b/spec/classes/apache_spec.rb @@ -1,24 +1,46 @@ require 'spec_helper' describe 'apache', :type => :class do - - it { should include_class("apache::params") } - - it { should contain_package("httpd") } - - it { should contain_service("httpd").with( - 'ensure' => 'running', - 'enable' => 'true', - 'subscribe' => 'Package[httpd]' - ) - } - - it { should contain_file("httpd_vdir").with( - 'ensure' => 'directory', - 'recurse' => 'true', - 'purge' => 'true', - 'notify' => 'Service[httpd]', - 'require' => 'Package[httpd]' - ) - } + context "On a Debian OS" do + let :facts do + { :osfamily => 'Debian' } + end + it { should include_class("apache::params") } + it { should contain_package("httpd") } + it { should contain_service("httpd").with( + 'ensure' => 'running', + 'enable' => 'true', + 'subscribe' => 'Package[httpd]' + ) + } + it { should contain_file("httpd_vdir").with( + 'ensure' => 'directory', + 'recurse' => 'true', + 'purge' => 'true', + 'notify' => 'Service[httpd]', + 'require' => 'Package[httpd]' + ) + } + end + context "On a RedHat OS" do + let :facts do + { :osfamily => 'RedHat' } + end + it { should include_class("apache::params") } + it { should contain_package("httpd") } + it { should contain_service("httpd").with( + 'ensure' => 'running', + 'enable' => 'true', + 'subscribe' => 'Package[httpd]' + ) + } + it { should contain_file("httpd_vdir").with( + 'ensure' => 'directory', + 'recurse' => 'true', + 'purge' => 'true', + 'notify' => 'Service[httpd]', + 'require' => 'Package[httpd]' + ) + } + end end diff --git a/spec/classes/dev_spec.rb b/spec/classes/dev_spec.rb index 57d913dbf9..703374c533 100644 --- a/spec/classes/dev_spec.rb +++ b/spec/classes/dev_spec.rb @@ -1,8 +1,24 @@ require 'spec_helper' describe 'apache::dev', :type => :class do - - it { should include_class("apache::params") } - it { should contain_package("apache_dev_package") } - + context "On a Debian OS" do + let :facts do + { :osfamily => 'Debian' } + end + it { + should include_class("apache::params") + should contain_package("libaprutil1-dev") + should contain_package("libapr1-dev") + should contain_package("apache2-prefork-dev") + } + end + context "On a RedHat OS" do + let :facts do + { :osfamily => 'RedHat' } + end + it { + should include_class("apache::params") + should contain_package("httpd-devel") + } + end end diff --git a/spec/classes/mod/auth_kerb_spec.rb b/spec/classes/mod/auth_kerb_spec.rb index b42f6721b2..3590ca4268 100644 --- a/spec/classes/mod/auth_kerb_spec.rb +++ b/spec/classes/mod/auth_kerb_spec.rb @@ -1,17 +1,18 @@ require 'spec_helper' describe 'apache::mod::auth_kerb', :type => :class do - - it { should include_class("apache") } - - it { should contain_package("mod_auth_kerb_package").with( - 'require' => 'Package[httpd]' - ) - } - - it { should contain_a2mod("auth_kerb").with( - 'ensure' => 'present' - ) - } - + context "On a Debian OS" do + let :facts do + { :osfamily => 'Debian' } + end + it { should include_class("apache") } + it { should contain_package("mod_auth_kerb_package").with( + 'require' => 'Package[httpd]' + ) + } + it { should contain_a2mod("auth_kerb").with( + 'ensure' => 'present' + ) + } + end end diff --git a/spec/classes/mod/python_spec.rb b/spec/classes/mod/python_spec.rb index 166e2909e2..3981ddca72 100644 --- a/spec/classes/mod/python_spec.rb +++ b/spec/classes/mod/python_spec.rb @@ -1,18 +1,25 @@ require 'spec_helper' describe 'apache::mod::python', :type => :class do - - it { should include_class("apache") } - - it { should contain_package("mod_python_package").with( - 'ensure' => 'installed', - 'require' => 'Package[httpd]' - ) - } - - it { should contain_a2mod("python").with( - 'ensure' => 'present' - ) - } - + context "On a Debian OS" do + let :facts do + { :osfamily => 'Debian' } + end + it { should include_class("apache::params") } + it { should contain_package("libapache2-mod-python").with( + 'ensure' => 'present', + 'require' => 'Package[httpd]' + ) } + it { should contain_a2mod("python") } + end + context "On a RedHat OS" do + let :facts do + { :osfamily => 'RedHat' } + end + it { should include_class("apache::params") } + it { should contain_package("mod_python") } + it { should contain_a2mod("python").with( + 'ensure' => 'present' + ) } + end end diff --git a/spec/classes/mod/wsgi_spec.rb b/spec/classes/mod/wsgi_spec.rb index c1c8dc97fc..f16bab90fd 100644 --- a/spec/classes/mod/wsgi_spec.rb +++ b/spec/classes/mod/wsgi_spec.rb @@ -1,17 +1,17 @@ require 'spec_helper' describe 'apache::mod::wsgi', :type => :class do - - it { should include_class("apache") } - - it { should contain_package("mod_wsgi_package").with( - 'require' => 'Package[httpd]' - ) - } - - it { should contain_a2mod("wsgi").with( - 'ensure' => 'present' - ) - } - + context "On a Debian OS" do + let :facts do + { :osfamily => 'Debian' } + end + it { should include_class("apache") } + it { should contain_package("mod_wsgi_package").with( + 'require' => 'Package[httpd]' + ) } + it { should contain_a2mod("wsgi").with( + 'ensure' => 'present' + ) + } + end end diff --git a/spec/classes/params_spec.rb b/spec/classes/params_spec.rb index 7236c2dd0b..a403b70e37 100644 --- a/spec/classes/params_spec.rb +++ b/spec/classes/params_spec.rb @@ -1,13 +1,17 @@ require 'spec_helper' describe 'apache::params', :type => :class do + context "On a Debian OS" do + let :facts do + { :osfamily => 'Debian' } + end + it { should contain_apache__params } - it { should contain_apache__params } - - # There are 4 resources in this class currently - # there should not be any more resources because it is a params class - # The resources are class[apache::params], class[main], class[settings], stage[main] - it "Should not contain any resources" do - subject.resources.size.should == 4 + # There are 4 resources in this class currently + # there should not be any more resources because it is a params class + # The resources are class[apache::params], class[main], class[settings], stage[main] + it "Should not contain any resources" do + subject.resources.size.should == 4 + end end end diff --git a/spec/classes/php_spec.rb b/spec/classes/php_spec.rb index 33413f0de8..1ee4da800d 100644 --- a/spec/classes/php_spec.rb +++ b/spec/classes/php_spec.rb @@ -1,8 +1,25 @@ require 'spec_helper' describe 'apache::php', :type => :class do + context "On a Debian OS" do + let :facts do + { :osfamily => 'Debian' } + end + it { should include_class("apache::params") } + it { should contain_apache__mod("php5") } + it { should contain_package("libapache2-mod-php5") } + end - it { should include_class("apache::params") } - it { should contain_package("apache_php_package") } + context "On a RedHat OS" do + let :facts do + { :osfamily => 'RedHat' } + end + it { should include_class("apache::params") } + it { should contain_apache__mod("php5") } + it { should contain_package("php") } + end + context "On undefined OS" do + it { expect { should raise_error(Puppet::Error) } } + end end diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index aae899d9c5..fb934d6412 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -1,13 +1,19 @@ require 'spec_helper' describe 'apache::python', :type => :class do - - it { should include_class("apache") } - it { should include_class("apache::params") } - it { should contain_package("apache_python_package") } - it { should contain_a2mod("python").with( - 'ensure' => 'present' - ) - } - + context "On a Debian OS" do + let :facts do + { :osfamily => 'Debian' } + end + it { should include_class("apache::params") } + it { should contain_package("libapache2-mod-python") } + end + context "On a RedHat OS" do + let :facts do + { :osfamily => 'RedHat' } + end + it { should include_class("apache::params") } + it { should contain_package("mod_python") } + it { should contain_a2mod("python").with('ensure'=>'present') } + end end diff --git a/spec/defines/vhost/redirect_spec.rb b/spec/defines/vhost/redirect_spec.rb index 6eddfd084e..c529bb200e 100644 --- a/spec/defines/vhost/redirect_spec.rb +++ b/spec/defines/vhost/redirect_spec.rb @@ -1,56 +1,52 @@ require 'spec_helper' describe 'apache::vhost::redirect', :type => :define do - let :title do - 'my_vhost_redirect' - end - - - let :default_params do - { - :port => '80', - :dest => 'example.com', - :priority => '10', - :template => "apache/vhost-redirect.conf.erb", - :vhost_name => '*' - } - end - - [{ - :dest => 'example2.com', - :port => '80', - }, - ].each do |param_set| - - describe "when #{param_set == {} ? "using default" : "specifying"} class parameters" do - - let :param_hash do - default_params.merge(param_set) - end - - let :params do - param_set - end - - it { should include_class("apache") } - it { should contain_apache__params } - - it { should contain_file("#{param_hash[:priority]}-#{title}").with({ - 'owner' => 'root', - 'group' => 'root', - 'mode' => '0755', - 'require' => 'Package[httpd]', - 'notify' => 'Service[httpd]' - }) + context "On a Debian OS" do + let :facts do + { :osfamily => 'Debian' } + end + let :title do + 'my_vhost_redirect' + end + let :default_params do + { + :port => '80', + :dest => 'example.com', + :priority => '10', + :template => "apache/vhost-redirect.conf.erb", + :vhost_name => '*' } - - # FIXME: Firewall is not actually realized anywhere - #it { should contain_firewall("0100-INPUT ACCEPT #{param_hash[:port]}").with( { - # 'jump' => 'Accept', - # 'dport' => "#{param_hash[:port]}", - # 'proto' => 'tcp' - # }) - #} + end + [{ + :dest => 'example2.com', + :port => '80', + }, + ].each do |param_set| + describe "when #{param_set == {} ? "using default" : "specifying"} class parameters" do + let :param_hash do + default_params.merge(param_set) + end + let :params do + param_set + end + it { should include_class("apache") } + it { should contain_apache__params } + it { should contain_file("#{param_hash[:priority]}-#{title}").with({ + 'owner' => 'root', + 'group' => 'root', + 'mode' => '0755', + 'require' => 'Package[httpd]', + 'notify' => 'Service[httpd]' + }) + } + # FIXME: Firewall is not actually realized anywhere + #it { should contain_firewall("0100-INPUT ACCEPT #{param_hash[:port]}").with( { + # 'jump' => 'Accept', + # 'dport' => "#{param_hash[:port]}", + # 'proto' => 'tcp' + # }) + #} + end end end end diff --git a/spec/defines/vhost_spec.rb b/spec/defines/vhost_spec.rb index 55da9cb524..a184fbe7ff 100644 --- a/spec/defines/vhost_spec.rb +++ b/spec/defines/vhost_spec.rb @@ -1,80 +1,84 @@ require 'spec_helper' describe 'apache::vhost', :type => :define do + context "On a Debian OS" do + let :facts do + { :osfamily => 'RedHat' } + end + let :title do + 'my_vhost' + end - let :title do - 'my_vhost' - end - - let :default_params do - { - :apache_name => 'apache2', - :auth => false, - :docroot => 'path/to/docroot', - :options => 'Indexes FollowSymLinks MultiViews', - :override => 'None', - :port => '80', - :priority => '25', - :redirect_ssl => false, - :serveraliases => '', - :servername => '', - :ssl => true, - :template => 'apache/vhost-default.conf.erb', - :vhost_name => '*', - :ensure => 'present' - } - end - - [{ - :apache_name => 'httpd', + let :default_params do + { + :apache_name => 'apache2', + :auth => false, :docroot => 'path/to/docroot', - :override => ['Options', 'FileInfo'], + :options => 'Indexes FollowSymLinks MultiViews', + :override => 'None', :port => '80', :priority => '25', - :serveradmin => 'serveradmin@puppet', - :ssl => false, + :redirect_ssl => false, + :serveraliases => '', + :servername => '', + :ssl => true, :template => 'apache/vhost-default.conf.erb', - }, - ].each do |param_set| + :vhost_name => '*', + :ensure => 'present' + } + end - describe "when #{param_set == {} ? "using default" : "specifying"} class parameters" do + [{ + :apache_name => 'httpd', + :docroot => 'path/to/docroot', + :override => ['Options', 'FileInfo'], + :port => '80', + :priority => '25', + :serveradmin => 'serveradmin@puppet', + :ssl => false, + :template => 'apache/vhost-default.conf.erb', + }, + ].each do |param_set| - let :param_hash do - default_params.merge(param_set) - end + describe "when #{param_set == {} ? "using default" : "specifying"} class parameters" do - let :params do - param_set - end - - it { should include_class("apache") } - it { should contain_apache__params } + let :param_hash do + default_params.merge(param_set) + end - it { - if param_hash[:ssl] - should contain_apache__ssl - else - should_not contain_apache__ssl + let :params do + param_set end - } - it { should contain_file("#{param_hash[:priority]}-#{title}.conf").with({ - 'owner' => 'root', - 'group' => 'root', - 'mode' => '0755', - 'notify' => 'Service[httpd]' - }) - } + it { should include_class("apache") } + it { should contain_apache__params } + + it { + if param_hash[:ssl] + should contain_apache__ssl + else + should_not contain_apache__ssl + end + } - # FIXME: Firewall is not actually realized anywhere - #it { should contain_firewall("0100-INPUT ACCEPT #{param_hash[:port]}").with( { - # 'action' => 'accept', - # 'dport' => "#{param_hash[:port]}", - # 'proto' => 'tcp' - # }) - #} + it { should contain_file("#{param_hash[:priority]}-#{title}.conf").with({ + 'owner' => 'root', + 'group' => 'root', + 'mode' => '0755', + 'notify' => 'Service[httpd]' + }) + } + # FIXME: Firewall is not actually realized anywhere + #it { should contain_firewall("0100-INPUT ACCEPT #{param_hash[:port]}").with( { + # 'action' => 'accept', + # 'dport' => "#{param_hash[:port]}", + # 'proto' => 'tcp' + # }) + #} + + end end end end From b1566b6bd816408815ba288fba60167d6fe8566c Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Sun, 19 Aug 2012 21:08:04 -0700 Subject: [PATCH 05/10] Change `$module` to `$mod` to cope with puppet-rspec bugs --- manifests/mod.pp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/manifests/mod.pp b/manifests/mod.pp index e154275f25..915b48cf38 100644 --- a/manifests/mod.pp +++ b/manifests/mod.pp @@ -1,28 +1,29 @@ define apache::mod ( $package = undef ) { - $module = $name - include apache + $mod = $name + include apache::params + #include apache #This creates duplicate resources in rspec-puppet $mod_packages = $apache::params::mod_packages if $package { $package_REAL = $package - } elsif $mod_packages[$module] { - $package_REAL = $mod_packages[$module] + } elsif $mod_packages[$mod] { + $package_REAL = $mod_packages[$mod] } $mod_libs = $apache::params::mod_libs if $mod_libs { - $lib = $mod_libs[$module] + $lib = $mod_libs[$mod] } if $package_REAL { package { $package_REAL: ensure => present, require => Package['httpd'], - before => A2mod[$module], + before => A2mod[$mod], } } - a2mod { $module: + a2mod { $mod: ensure => present, lib => $lib, require => Package['httpd'], From 118a5aa6d8f85f791792d7cfca9e4b984494adc1 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Sun, 19 Aug 2012 21:10:34 -0700 Subject: [PATCH 06/10] Update `apache::params` to fail on unsupported operatingsystems instead of playing dumb --- manifests/params.pp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/manifests/params.pp b/manifests/params.pp index 1b99cb346d..085606ded8 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -78,16 +78,6 @@ 'wsgi' => 'libapache2-mod-wsgi', } } else { - $user = 'www-data' - $group = 'www-data' - $apache_name = 'apache2' - $php_package = 'libapache2-mod-php5' - $mod_python_package = 'libapache2-mod-python' - $mod_wsgi_package = 'libapache2-mod-wsgi' - $mod_auth_kerb_package = 'libapache2-mod-auth-kerb' - $ssl_package = 'apache-ssl' - $apache_dev = 'apache-dev' - $vdir = '/etc/apache2/sites-enabled/' - $proxy_modules = ['proxy', 'proxy_http'] + fail("Class['apache::params']: Unsupported operatingsystem: $operatingsystem") } } From 7082a2a0e430d750aca2bff1ed1c263a184fff9d Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Sun, 19 Aug 2012 21:11:13 -0700 Subject: [PATCH 07/10] Get `apache::python` and `apache::mod::python` to pass unit tests --- manifests/mod/python.pp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/manifests/mod/python.pp b/manifests/mod/python.pp index fb536e6c58..e3fbf739f7 100644 --- a/manifests/mod/python.pp +++ b/manifests/mod/python.pp @@ -1,14 +1,6 @@ class apache::mod::python { - include apache - - package { 'mod_python_package': - ensure => installed, - name => $apache::params::mod_python_package, - require => Package['httpd']; - } - - a2mod { 'python': ensure => present; } - + #include apache + apache::mod { 'python': } } From c1a3c927a805d3babdf99c5a464c284af1c60a2a Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Thu, 23 Aug 2012 16:27:06 -0700 Subject: [PATCH 08/10] Update apache::mod::ssl tests, and fixup for master branch --- spec/classes/mod/ssl_spec.rb | 22 +++++++++++++++++++++ spec/classes/ssl_spec.rb | 30 +---------------------------- spec/defines/vhost/proxy_spec.rb | 6 +++--- spec/defines/vhost/redirect_spec.rb | 2 +- 4 files changed, 27 insertions(+), 33 deletions(-) create mode 100644 spec/classes/mod/ssl_spec.rb diff --git a/spec/classes/mod/ssl_spec.rb b/spec/classes/mod/ssl_spec.rb new file mode 100644 index 0000000000..e5947be795 --- /dev/null +++ b/spec/classes/mod/ssl_spec.rb @@ -0,0 +1,22 @@ +require 'spec_helper' + +describe 'apache::mod::ssl', :type => :class do + describe 'when running on an unsupported OS' do + let(:facts) { {:operatingsystem => 'MagicUnicorn', :osfamily => 'Magic'} } + it { expect { should raise_error(Puppet::Error, "Unsupported operatingsystem:") } } + end + + describe 'when running on redhat' do + let(:facts) { {:operatingsystem => 'redhat', :osfamily => 'redhat'} } + it { should include_class('apache::params') } + it { should contain_package('mod_ssl') } + it { should contain_a2mod('ssl') } + end + + describe 'when running on debian' do + let(:facts) { {:operatingsystem => 'debian', :osfamily => 'debian'} } + it { should include_class('apache::params') } + it { should_not contain_package('libapache2-mod-ssl') } + it { should contain_a2mod('ssl') } + end +end diff --git a/spec/classes/ssl_spec.rb b/spec/classes/ssl_spec.rb index 1c7b30c00a..ab6a5a34b8 100644 --- a/spec/classes/ssl_spec.rb +++ b/spec/classes/ssl_spec.rb @@ -1,36 +1,8 @@ require 'spec_helper' describe 'apache::ssl', :type => :class do - - describe 'when running on an unsupported OS' do - let(:facts) { {:operatingsystem => 'MagicUnicorn', :osfamily => 'Magic'} } - it { - expect { - should raise_error(Puppet::Error, /not defined in apache::ssl/ ) - } - } - end - - describe 'when running on a supported OS' do - let(:facts) { {:operatingsystem => 'redhat', :osfamily => 'redhat'} } - it { should include_class('apache') } - it { should include_class('apache::params') } - end - describe 'when running on redhat' do let(:facts) { {:operatingsystem => 'redhat', :osfamily => 'redhat'} } - it { - should contain_package('apache_ssl_package').with( - 'ensure' => 'installed' - ) - } - end - - describe 'when running on debian' do - let(:facts) { {:operatingsystem => 'debian', :osfamily => 'debian'} } - it { - should contain_a2mod('ssl').with('ensure' => 'present') - } + it { should include_class('apache::mod::ssl') } end - end diff --git a/spec/defines/vhost/proxy_spec.rb b/spec/defines/vhost/proxy_spec.rb index 3afec6e9f8..da242b99bf 100644 --- a/spec/defines/vhost/proxy_spec.rb +++ b/spec/defines/vhost/proxy_spec.rb @@ -48,13 +48,13 @@ it { if param_hash[:ssl] - should contain_apache__ssl + should contain_apache__mod__ssl else - should_not contain_apache__ssl + should_not contain_apache__mod__ssl end } - it { should contain_file("#{param_hash[:priority]}-#{title}").with({ + it { should contain_file("#{param_hash[:priority]}-#{title}.conf").with({ 'owner' => 'root', 'group' => 'root', 'mode' => '0755', diff --git a/spec/defines/vhost/redirect_spec.rb b/spec/defines/vhost/redirect_spec.rb index c529bb200e..396d03938b 100644 --- a/spec/defines/vhost/redirect_spec.rb +++ b/spec/defines/vhost/redirect_spec.rb @@ -31,7 +31,7 @@ end it { should include_class("apache") } it { should contain_apache__params } - it { should contain_file("#{param_hash[:priority]}-#{title}").with({ + it { should contain_file("#{param_hash[:priority]}-#{title}.conf").with({ 'owner' => 'root', 'group' => 'root', 'mode' => '0755', From ec83e5599308c6caf4473defe5327f51669ef5de Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Thu, 23 Aug 2012 17:27:22 -0700 Subject: [PATCH 09/10] Update the quoted hash-indexes for puppet 2.6+2.7 compatibility --- manifests/mod.pp | 10 ++++++---- manifests/params.pp | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/manifests/mod.pp b/manifests/mod.pp index 915b48cf38..a40e664e8e 100644 --- a/manifests/mod.pp +++ b/manifests/mod.pp @@ -5,14 +5,16 @@ include apache::params #include apache #This creates duplicate resources in rspec-puppet $mod_packages = $apache::params::mod_packages + $mod_package = $mod_packages[$mod] # 2.6 compatibility hack if $package { $package_REAL = $package - } elsif $mod_packages[$mod] { - $package_REAL = $mod_packages[$mod] + } elsif "$mod_package" { + $package_REAL = $mod_package } $mod_libs = $apache::params::mod_libs - if $mod_libs { - $lib = $mod_libs[$mod] + $mod_lib = $mod_libs[$mod] # 2.6 compatibility hack + if "${mod_lib}" { + $lib = $mod_lib } if $package_REAL { diff --git a/manifests/params.pp b/manifests/params.pp index 085606ded8..e7e3f550b2 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -77,6 +77,7 @@ 'python' => 'libapache2-mod-python', 'wsgi' => 'libapache2-mod-wsgi', } + $mod_libs = {} } else { fail("Class['apache::params']: Unsupported operatingsystem: $operatingsystem") } From 0685f22f3fcf8e6b164ae81d4c2bfe1fbec3579d Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Fri, 24 Aug 2012 12:03:29 -0700 Subject: [PATCH 10/10] Release 0.4.0 Changes: - `include apache` is now required when using apache::mod::* Bugfixes: - Fix syntax for validate_re - Fix formatting in vhost template - Fix spec tests such that they pass --- CHANGELOG | 9 +++++++++ Modulefile | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 7834d9976f..7a7185ae33 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,12 @@ +2012-08-24 Release 0.4.0 +Changes: +- `include apache` is now required when using apache::mod::* + +Bugfixes: +- Fix syntax for validate_re +- Fix formatting in vhost template +- Fix spec tests such that they pass + 2012-05-08 Puppet Labs - 0.0.4 e62e362 Fix broken tests for ssl, vhost, vhost::* 42c6363 Changes to match style guide and pass puppet-lint without error diff --git a/Modulefile b/Modulefile index 33af2a8fb5..d051348593 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'puppetlabs-apache' -version '0.3.0' +version '0.4.0' source 'git://github.com/puppetlabs/puppetlabs-apache.git' author 'puppetlabs' license 'Apache 2.0'