From 7488739eeb3ec11b1b66a9feebae576a941f6998 Mon Sep 17 00:00:00 2001 From: Lee Boynton <lee@lboynton.com> Date: Fri, 19 Oct 2012 11:33:59 +0100 Subject: [PATCH 01/13] Add parameter to allow access logs to be turned off --- manifests/vhost.pp | 1 + templates/vhost-default.conf.erb | 2 ++ 2 files changed, 3 insertions(+) diff --git a/manifests/vhost.pp b/manifests/vhost.pp index 5d053899e9..c2bd9e27ad 100644 --- a/manifests/vhost.pp +++ b/manifests/vhost.pp @@ -54,6 +54,7 @@ $apache_name = $apache::params::apache_name, $vhost_name = $apache::params::vhost_name, $logroot = "/var/log/$apache::params::apache_name", + $access_log = true, $ensure = 'present' ) { diff --git a/templates/vhost-default.conf.erb b/templates/vhost-default.conf.erb index 511ac38596..acdf473136 100644 --- a/templates/vhost-default.conf.erb +++ b/templates/vhost-default.conf.erb @@ -23,7 +23,9 @@ NameVirtualHost <%= vhost_name %>:<%= port %> </Directory> ErrorLog <%= logroot %>/<%= name %>_error.log LogLevel warn +<% if access_log %> CustomLog <%= logroot %>/<%= name %>_access.log combined +<% end %> ServerSignature Off </VirtualHost> From d136df60246a653848735566856fef093791a2b5 Mon Sep 17 00:00:00 2001 From: Hunter Haugen <h.haugen@gmail.com> Date: Wed, 12 Dec 2012 13:55:45 -0800 Subject: [PATCH 02/13] Add spec tests for apache::vhost access_log --- spec/defines/vhost_spec.rb | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/spec/defines/vhost_spec.rb b/spec/defines/vhost_spec.rb index a184fbe7ff..e1147d158d 100644 --- a/spec/defines/vhost_spec.rb +++ b/spec/defines/vhost_spec.rb @@ -29,14 +29,15 @@ end [{ - :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', + :apache_name => 'httpd', + :docroot => 'path/to/docroot', + :override => ['Options', 'FileInfo'], + :port => '80', + :priority => '25', + :serveradmin => 'serveradmin@puppet', + :ssl => false, + :access_log => false, + :template => 'apache/vhost-default.conf.erb', }, ].each do |param_set| @@ -80,5 +81,18 @@ end end + + [true,false].each do |value| + describe "when access_log is #{value}" do + let :params do + default_params.merge({:access_log => value}) + end + + it "#{value ? "should" : "should not"} contain access logs" do + lines = subject.resource('file', "#{params[:priority]}-#{title}.conf").send(:parameters)[:content].split("\n") + !!lines.grep('_access.log combined').should == value + end + end + end end end From 3b694f2c227df27a669c92fd9ead0b68b14d815a Mon Sep 17 00:00:00 2001 From: Hunter Haugen <h.haugen@gmail.com> Date: Wed, 12 Dec 2012 13:56:09 -0800 Subject: [PATCH 03/13] Add template comment and formatting for apache::vhost --- manifests/vhost.pp | 12 ++++++++++++ templates/vhost-default.conf.erb | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/manifests/vhost.pp b/manifests/vhost.pp index c2bd9e27ad..2d73778f74 100644 --- a/manifests/vhost.pp +++ b/manifests/vhost.pp @@ -98,6 +98,18 @@ } } + # Template uses: + # - $vhost_name + # - $port + # - $srvname + # - $serveradmin + # - $serveraliases + # - $docroot + # - $options + # - $override + # - $logroot + # - $access_log + # - $name file { "${priority}-${name}.conf": ensure => $ensure, path => "${apache::params::vdir}/${priority}-${name}.conf", diff --git a/templates/vhost-default.conf.erb b/templates/vhost-default.conf.erb index acdf473136..658979fa23 100644 --- a/templates/vhost-default.conf.erb +++ b/templates/vhost-default.conf.erb @@ -23,9 +23,9 @@ NameVirtualHost <%= vhost_name %>:<%= port %> </Directory> ErrorLog <%= logroot %>/<%= name %>_error.log LogLevel warn -<% if access_log %> +<% if access_log -%> CustomLog <%= logroot %>/<%= name %>_access.log combined -<% end %> +<% end -%> ServerSignature Off </VirtualHost> From da8ce0e1cfa9b6473c780b8d7e9d254be7130e87 Mon Sep 17 00:00:00 2001 From: Hunter Haugen <h.haugen@gmail.com> Date: Wed, 12 Dec 2012 13:56:41 -0800 Subject: [PATCH 04/13] Add access_log parameter to apache::vhost::proxy also The vhosts should really be condensed into one template with multiple options and/or subclasses, but until that happens we just have to repeat code and tests. --- manifests/vhost/proxy.pp | 13 +++++++++++++ spec/defines/vhost/proxy_spec.rb | 16 +++++++++++++++- templates/vhost-proxy.conf.erb | 2 ++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/manifests/vhost/proxy.pp b/manifests/vhost/proxy.pp index a17031814f..296cc1b481 100644 --- a/manifests/vhost/proxy.pp +++ b/manifests/vhost/proxy.pp @@ -27,6 +27,7 @@ $serveraliases = '', $ssl = false, $vhost_name = '*', + $access_log = true, $no_proxy_uris = [] ) { @@ -45,6 +46,18 @@ include apache::mod::ssl } + # Template uses: + # - $vhost_name + # - $port + # - $ssl + # - $ssl_path + # - $srvname + # - $serveraliases + # - $no_proxy_uris + # - $dest + # - $apache::params::apache_name + # - $access_log + # - $name file { "${priority}-${name}.conf": path => "${apache::params::vdir}/${priority}-${name}.conf", content => template($template), diff --git a/spec/defines/vhost/proxy_spec.rb b/spec/defines/vhost/proxy_spec.rb index 50f78fd317..4ede33343b 100644 --- a/spec/defines/vhost/proxy_spec.rb +++ b/spec/defines/vhost/proxy_spec.rb @@ -30,7 +30,8 @@ :dest => 'example2.com', :servername => 'example3.com', :port => '80', - :ssl => true + :ssl => true, + :access_log => false, }, ].each do |param_set| @@ -70,5 +71,18 @@ ] ) end end + + [true,false].each do |value| + describe "when access_log is #{value}" do + let :params do + default_params.merge({:access_log => value}) + end + + it "#{value ? "should" : "should not"} contain access logs" do + lines = subject.resource('file', "#{params[:priority]}-#{title}.conf").send(:parameters)[:content].split("\n") + !!lines.grep('_access.log combined').should == value + end + end + end end end diff --git a/templates/vhost-proxy.conf.erb b/templates/vhost-proxy.conf.erb index 2f625572a4..9f804fc81b 100644 --- a/templates/vhost-proxy.conf.erb +++ b/templates/vhost-proxy.conf.erb @@ -26,6 +26,8 @@ NameVirtualHost <%= vhost_name %>:<%= port %> ErrorLog /var/log/<%= scope.lookupvar("apache::params::apache_name") %>/<%= name %>_error.log LogLevel warn +<% if access_log -%> CustomLog /var/log/<%= scope.lookupvar("apache::params::apache_name") %>/<%= name %>_access.log combined +<% end -%> </VirtualHost> From 799c32e13e47b9f9402b70701e7d5634b3ac6ed5 Mon Sep 17 00:00:00 2001 From: Hunter Haugen <h.haugen@gmail.com> Date: Wed, 12 Dec 2012 14:00:59 -0800 Subject: [PATCH 05/13] Add parameter docs for access_log --- manifests/vhost.pp | 1 + manifests/vhost/proxy.pp | 1 + 2 files changed, 2 insertions(+) diff --git a/manifests/vhost.pp b/manifests/vhost.pp index 2d73778f74..0bba85cefe 100644 --- a/manifests/vhost.pp +++ b/manifests/vhost.pp @@ -20,6 +20,7 @@ # - The $vhost_name for name based virtualhosting, defaulting to * # - The $logroot specifies the location of the virtual hosts logfiles, default # to /var/log/<apache log location>/ +# - The $access_log specifies if *_access.log directives should be configured. # - The $ensure specifies if vhost file is present or absent. # # Actions: diff --git a/manifests/vhost/proxy.pp b/manifests/vhost/proxy.pp index 296cc1b481..ec9714698e 100644 --- a/manifests/vhost/proxy.pp +++ b/manifests/vhost/proxy.pp @@ -9,6 +9,7 @@ # URI that the requests will be proxied for # - $priority # - $template -- the template to use for the vhost +# - $access_log - specifies if *_access.log directives should be configured. # - $vhost_name - the name to use for the vhost, defaults to '*' # # Actions: From 9355b064a808af1777c595e4685419fe7afc82ff Mon Sep 17 00:00:00 2001 From: Martin Janser <martin@gogan.ch> Date: Thu, 24 Jan 2013 10:27:16 +0100 Subject: [PATCH 06/13] Add parameter for purging vdir The new parameter $purge_vdir in apache class gives the possibility to disable the purging of the virtual hosts directory. --- manifests/init.pp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 61430118f6..670068c5c0 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -16,7 +16,8 @@ $default_mods = true, $service_enable = true, $serveradmin = 'root@localhost', - $sendfile = false + $sendfile = false, + $purge_vdir = true ) { include apache::params @@ -39,7 +40,7 @@ ensure => directory, path => $apache::params::vdir, recurse => true, - purge => true, + purge => $purge_vdir, notify => Service['httpd'], require => Package['httpd'], } From c00f9f99ca386360100f6c397f503e967d01f802 Mon Sep 17 00:00:00 2001 From: William Van Hevelingen <blkperl@cat.pdx.edu> Date: Sat, 2 Feb 2013 12:20:52 -0800 Subject: [PATCH 07/13] Enable puppet 3.0.1 in travis.yml A fix for rodjek/rspec-puppet#58 has been merged which should allow puppet 3.0.1 to run the spec tests --- .travis.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index fdbc95dc69..0847b41b6e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ branches: env: - PUPPET_VERSION=2.6.17 - PUPPET_VERSION=2.7.19 - #- PUPPET_VERSION=3.0.1 # Breaks due to rodjek/rspec-puppet#58 + - PUPPET_VERSION=3.0.1 notifications: email: false gemfile: .gemfile @@ -18,6 +18,3 @@ matrix: - rvm: 1.9.3 gemfile: .gemfile env: PUPPET_VERSION=2.6.17 - - rvm: 1.8.7 - gemfile: .gemfile - env: PUPPET_VERSION=3.0.1 From 53682276a235956bf792e22db6370d1918ff484c Mon Sep 17 00:00:00 2001 From: Ken Barber <ken@bob.sh> Date: Sat, 2 Feb 2013 23:22:22 +0100 Subject: [PATCH 08/13] Build all branches on travis We should build all branches for travis, otherwise users won't be able to test their own feature branches. Signed-off-by: Ken Barber <ken@bob.sh> --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0847b41b6e..070dd49d3d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,9 +3,6 @@ rvm: - 1.8.7 - 1.9.3 script: "rake spec" -branches: - only: - - master env: - PUPPET_VERSION=2.6.17 - PUPPET_VERSION=2.7.19 From dde292e76143d70ae38e7444bfb6b4df74e7e9d9 Mon Sep 17 00:00:00 2001 From: William Van Hevelingen <blkperl@cat.pdx.edu> Date: Sat, 2 Feb 2013 17:32:38 -0800 Subject: [PATCH 09/13] Standardize travis and gemfile This commit standardizes the travis and gemfile to be similar to the files in stdlib. --- .gemfile | 5 ----- .gitignore | 1 + .travis.yml | 28 ++++++++++++++++++---------- Gemfile | 13 +++++++++++++ 4 files changed, 32 insertions(+), 15 deletions(-) delete mode 100644 .gemfile create mode 100644 Gemfile diff --git a/.gemfile b/.gemfile deleted file mode 100644 index 9aad840c0a..0000000000 --- a/.gemfile +++ /dev/null @@ -1,5 +0,0 @@ -source :rubygems - -puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 2.7'] -gem 'puppet', puppetversion -gem 'puppetlabs_spec_helper', '>= 0.1.0' diff --git a/.gitignore b/.gitignore index 5a6ed48b93..45b6d17d3e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .pkg +Gemfile.lock diff --git a/.travis.yml b/.travis.yml index 070dd49d3d..dd3394d8d2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,17 +1,25 @@ language: ruby +bundler_args: --without development +script: "bundle exec rake spec SPEC_OPTS='--format documentation'" rvm: - 1.8.7 - 1.9.3 -script: "rake spec" + - ruby-head env: - - PUPPET_VERSION=2.6.17 - - PUPPET_VERSION=2.7.19 - - PUPPET_VERSION=3.0.1 -notifications: - email: false -gemfile: .gemfile + - PUPPET_GEM_VERSION="~> 2.6" + - PUPPET_GEM_VERSION="~> 2.7" + - PUPPET_GEM_VERSION="~> 3.0" matrix: + allow_failures: + - rvm: ruby-head exclude: - - rvm: 1.9.3 - gemfile: .gemfile - env: PUPPET_VERSION=2.6.17 + - rvm: 1.9.3 + env: PUPPET_GEM_VERSION="~> 2.7" + - rvm: ruby-head + env: PUPPET_GEM_VERSION="~> 2.7" + - rvm: 1.9.3 + env: PUPPET_GEM_VERSION="~> 2.6" + - rvm: ruby-head + env: PUPPET_GEM_VERSION="~> 2.6" +notifications: + email: false diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000000..8e5e04d744 --- /dev/null +++ b/Gemfile @@ -0,0 +1,13 @@ +source :rubygems + +group :development, :test do + gem 'puppetlabs_spec_helper', :require => false +end + +if puppetversion = ENV['PUPPET_GEM_VERSION'] + gem 'puppet', puppetversion, :require => false +else + gem 'puppet', :require => false +end + +# vim:ft=ruby From ef013c7c98cc453ab1e0e13f99c059a762cacfa0 Mon Sep 17 00:00:00 2001 From: Richard Clamp <richardc@unixbeard.net> Date: Mon, 25 Feb 2013 20:07:00 +0000 Subject: [PATCH 10/13] Restrict the versions and add 3.1 ~> 2.6 will match 2.7 --- .travis.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index dd3394d8d2..8f713e06b8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,20 +6,21 @@ rvm: - 1.9.3 - ruby-head env: - - PUPPET_GEM_VERSION="~> 2.6" - - PUPPET_GEM_VERSION="~> 2.7" - - PUPPET_GEM_VERSION="~> 3.0" + - PUPPET_GEM_VERSION="~> 2.6.0" + - PUPPET_GEM_VERSION="~> 2.7.0" + - PUPPET_GEM_VERSION="~> 3.0.0" + - PUPPET_GEM_VERSION="~> 3.1.0" matrix: allow_failures: - rvm: ruby-head exclude: - rvm: 1.9.3 - env: PUPPET_GEM_VERSION="~> 2.7" + env: PUPPET_GEM_VERSION="~> 2.7.0" - rvm: ruby-head - env: PUPPET_GEM_VERSION="~> 2.7" + env: PUPPET_GEM_VERSION="~> 2.7.0" - rvm: 1.9.3 - env: PUPPET_GEM_VERSION="~> 2.6" + env: PUPPET_GEM_VERSION="~> 2.6.0" - rvm: ruby-head - env: PUPPET_GEM_VERSION="~> 2.6" + env: PUPPET_GEM_VERSION="~> 2.6.0" notifications: email: false From 6be2d8ace81c1426aca0e00e484fd54b00a31712 Mon Sep 17 00:00:00 2001 From: Wolf Noble <wnoble@datapipe.com> Date: Tue, 19 Mar 2013 11:35:46 -0500 Subject: [PATCH 11/13] Capitalize RedHat to be in-line with actual factor output --- spec/defines/mod_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/defines/mod_spec.rb b/spec/defines/mod_spec.rb index 0e93019612..0bb686c0c4 100644 --- a/spec/defines/mod_spec.rb +++ b/spec/defines/mod_spec.rb @@ -3,7 +3,7 @@ describe 'apache::mod', :type => :define do context "On a Red Hat OS with shibboleth module and package param passed" do let :facts do - { :osfamily => 'redhat' } + { :osfamily => 'RedHat' } end # name/title for the apache::mod define let :title do From 6884cbc6cc8aac0de94501ddcb0ead9fb86bdd69 Mon Sep 17 00:00:00 2001 From: Wolf Noble <wnoble@datapipe.com> Date: Tue, 19 Mar 2013 11:37:07 -0500 Subject: [PATCH 12/13] Fix vhost defined type unit test context to reflect actual test being performed. context lists 'Debian' but test is for RedHat. --- spec/defines/vhost_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/defines/vhost_spec.rb b/spec/defines/vhost_spec.rb index e1147d158d..ed23822aef 100644 --- a/spec/defines/vhost_spec.rb +++ b/spec/defines/vhost_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe 'apache::vhost', :type => :define do - context "On a Debian OS" do + context "On a RedHat OS" do let :facts do { :osfamily => 'RedHat' } end From 8b4b06702f789648d1ff9b024d62de0fd9cfd245 Mon Sep 17 00:00:00 2001 From: Dan Bode <dan@puppetlabs.com> Date: Thu, 28 Mar 2013 15:40:39 -0700 Subject: [PATCH 13/13] release 0.6.0 --- CHANGELOG | 5 +++++ Modulefile | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 7a7185ae33..1a2fa1a749 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,8 @@ +2013-03-2 Release 0.6.0 +- update travis tests (add more supported versions) +- add access log_parameter +- make purging of vhost dir configurable + 2012-08-24 Release 0.4.0 Changes: - `include apache` is now required when using apache::mod::* diff --git a/Modulefile b/Modulefile index b229fdab78..300706fb4a 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'puppetlabs-apache' -version '0.5.0-rc1' +version '0.6.0' source 'git://github.com/puppetlabs/puppetlabs-apache.git' author 'puppetlabs' license 'Apache 2.0'