From 92837c0f85ab30e0793bfb1010cfc126ce6d3dde Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Fri, 6 May 2016 22:24:33 +0100 Subject: [PATCH 1/1] Get rid of pre 14.04 compatibility that is no longer needed --- cookbooks/apache/providers/conf.rb | 40 +++++-------------- cookbooks/apache/providers/site.rb | 23 +++-------- cookbooks/apache/recipes/default.rb | 38 +++++------------- cookbooks/apache/recipes/ssl.rb | 4 -- .../apache/templates/default/ports.conf.erb | 9 ----- cookbooks/apache/templates/default/ssl.erb | 2 - cookbooks/tile/recipes/default.rb | 4 -- .../tile/templates/default/renderd.conf.erb | 4 -- 8 files changed, 26 insertions(+), 98 deletions(-) diff --git a/cookbooks/apache/providers/conf.rb b/cookbooks/apache/providers/conf.rb index d7eddc636..9b9a7a174 100644 --- a/cookbooks/apache/providers/conf.rb +++ b/cookbooks/apache/providers/conf.rb @@ -23,32 +23,20 @@ end use_inline_resources -action :create do # ~FC017 - if node[:lsb][:release].to_f >= 14.04 - create_conf - end +action :create do + create_conf end -action :enable do # ~FC017 - if node[:lsb][:release].to_f >= 14.04 - enable_conf - else - create_conf - end +action :enable do + enable_conf end -action :disable do # ~FC017 - if node[:lsb][:release].to_f >= 14.04 - disable_conf - else - delete_conf - end +action :disable do + disable_conf end -action :delete do # ~FC017 - if node[:lsb][:release].to_f >= 14.04 - delete_conf - end +action :delete do + delete_conf end def create_conf @@ -83,17 +71,9 @@ def delete_conf end def available_name - if node[:lsb][:release].to_f >= 14.04 - "/etc/apache2/conf-available/#{new_resource.name}.conf" - else - "/etc/apache2/conf.d/#{new_resource.name}" - end + "/etc/apache2/conf-available/#{new_resource.name}.conf" end def enabled_name - if node[:lsb][:release].to_f >= 14.04 - "/etc/apache2/conf-enabled/#{new_resource.name}.conf" - else - "/etc/apache2/conf.d/#{new_resource.name}" - end + "/etc/apache2/conf-enabled/#{new_resource.name}.conf" end diff --git a/cookbooks/apache/providers/site.rb b/cookbooks/apache/providers/site.rb index a8c903449..3913764da 100644 --- a/cookbooks/apache/providers/site.rb +++ b/cookbooks/apache/providers/site.rb @@ -59,27 +59,14 @@ def site_directory end def available_name - if node[:lsb][:release].to_f >= 14.04 - "/etc/apache2/sites-available/#{new_resource.name}.conf" - else - "/etc/apache2/sites-available/#{new_resource.name}" - end + "/etc/apache2/sites-available/#{new_resource.name}.conf" end def enabled_name - if node[:lsb][:release].to_f >= 14.04 - case new_resource.name - when "default" - "/etc/apache2/sites-enabled/000-default.conf" - else - "/etc/apache2/sites-enabled/#{new_resource.name}.conf" - end + case new_resource.name + when "default" + "/etc/apache2/sites-enabled/000-default.conf" else - case new_resource.name - when "default" - "/etc/apache2/sites-enabled/000-default" - else - "/etc/apache2/sites-enabled/#{new_resource.name}" - end + "/etc/apache2/sites-enabled/#{new_resource.name}.conf" end end diff --git a/cookbooks/apache/recipes/default.rb b/cookbooks/apache/recipes/default.rb index 2b412eefc..d9bcaba1b 100644 --- a/cookbooks/apache/recipes/default.rb +++ b/cookbooks/apache/recipes/default.rb @@ -20,39 +20,23 @@ package "apache2" package "libwww-perl" -if node[:lsb][:release].to_f < 14.04 - package "apache2-mpm-#{node[:apache][:mpm]}" do - notifies :restart, "service[apache2]" - end -else - %w(event itk prefork worker).each do |mpm| - if mpm == node[:apache][:mpm] - apache_module "mpm_#{mpm}" do - action [:enable] - end - else - apache_module "mpm_#{mpm}" do - action [:disable] - end +%w(event itk prefork worker).each do |mpm| + if mpm == node[:apache][:mpm] + apache_module "mpm_#{mpm}" do + action [:enable] + end + else + apache_module "mpm_#{mpm}" do + action [:disable] end end end admins = data_bag_item("apache", "admins") -if node[:lsb][:release].to_f < 14.04 - template "/etc/apache2/httpd.conf" do - source "httpd.conf.erb" - owner "root" - group "root" - mode 0644 - notifies :reload, "service[apache2]" - end -else - apache_conf "httpd" do - template "httpd.conf.erb" - notifies :reload, "service[apache2]" - end +apache_conf "httpd" do + template "httpd.conf.erb" + notifies :reload, "service[apache2]" end template "/etc/apache2/ports.conf" do diff --git a/cookbooks/apache/recipes/ssl.rb b/cookbooks/apache/recipes/ssl.rb index d0b1b74d5..0dbe07c2f 100644 --- a/cookbooks/apache/recipes/ssl.rb +++ b/cookbooks/apache/recipes/ssl.rb @@ -25,10 +25,6 @@ node.default[:ssl][:certificates] = node[:ssl][:certificates] | [certificate] include_recipe "apache" include_recipe "ssl" -apache_module "socache_shmcb" do - only_if { node[:lsb][:release].to_f >= 14.04 } -end - apache_module "ssl" apache_conf "ssl" do diff --git a/cookbooks/apache/templates/default/ports.conf.erb b/cookbooks/apache/templates/default/ports.conf.erb index aa6d4e5e2..600f07ad1 100644 --- a/cookbooks/apache/templates/default/ports.conf.erb +++ b/cookbooks/apache/templates/default/ports.conf.erb @@ -1,23 +1,14 @@ # DO NOT EDIT - This file is being maintained by Chef # Listen on port 80 -<% if node[:lsb][:release].to_f < 14.04 -%> -NameVirtualHost *:80 -<% end -%> Listen <%= node[:apache][:listen_address] %>:80 # Listen on port 443 if mod_ssl is enabled - <% if node[:lsb][:release].to_f < 14.04 -%> - NameVirtualHost *:443 - <% end -%> Listen <%= node[:apache][:listen_address] %>:443 # Listen on port 443 if mod_gnutls is enabled - <% if node[:lsb][:release].to_f < 14.04 -%> - NameVirtualHost *:443 - <% end -%> Listen <%= node[:apache][:listen_address] %>:443 diff --git a/cookbooks/apache/templates/default/ssl.erb b/cookbooks/apache/templates/default/ssl.erb index caf0b3a55..63f0e21b0 100644 --- a/cookbooks/apache/templates/default/ssl.erb +++ b/cookbooks/apache/templates/default/ssl.erb @@ -8,10 +8,8 @@ SSLCipherSuite <%= node[:ssl][:ciphers] -%> SSLCertificateFile /etc/ssl/certs/<%= @certificate %>.pem SSLCertificateKeyFile /etc/ssl/private/<%= @certificate %>.key SSLCertificateChainFile /etc/ssl/certs/<%= @certificate_chain %>.pem -<% if node[:lsb][:release].to_f >= 14.04 -%> SSLUseStapling On SSLStaplingResponderTimeout 5 SSLStaplingReturnResponderErrors off SSLStaplingCache shmcb:${APACHE_RUN_DIR}/ssl_ocspcache(512000) -<% end -%> diff --git a/cookbooks/tile/recipes/default.rb b/cookbooks/tile/recipes/default.rb index 89489f5bd..5c923c8b7 100644 --- a/cookbooks/tile/recipes/default.rb +++ b/cookbooks/tile/recipes/default.rb @@ -381,10 +381,6 @@ package "osmosis" package "ruby" package "ruby-dev" -if node[:lsb][:release].to_f < 14.04 - package "rubygems" -end - package "libproj-dev" package "libxml2-dev" diff --git a/cookbooks/tile/templates/default/renderd.conf.erb b/cookbooks/tile/templates/default/renderd.conf.erb index 4ce29d976..ce5c55a22 100644 --- a/cookbooks/tile/templates/default/renderd.conf.erb +++ b/cookbooks/tile/templates/default/renderd.conf.erb @@ -7,11 +7,7 @@ tile_dir=/srv/tile.openstreetmap.org/tiles stats_file=/var/run/renderd/renderd.stats [mapnik] -<% if node[:lsb][:release].to_f >= 14.04 -%> plugins_dir=/usr/lib/mapnik/2.2/input -<% else -%> -plugins_dir=/usr/lib/mapnik/input -<% end -%> font_dir=/usr/share/fonts font_dir_recurse=true <% node[:tile][:styles].each do |name,details| -%> -- 2.39.5