From 86d9628a5a79aebd6b58d61b35f2439e2ce08700 Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Thu, 20 Aug 2015 14:39:25 +0000 Subject: [PATCH] Fix races in httpd install and config Add necessary dependency/ordering hints to the etherpad_lite::apache class so that configuration parent directories are created before they're needed rather than later through package installation, and so that vhost configuration won't be loaded until Apache module dependencies are in place. Change-Id: Iaeafd30b19276ff438bd9e2708031c1064a2314d --- manifests/apache.pp | 83 ++++++++++++++++++++++++++++++++------------- 1 file changed, 59 insertions(+), 24 deletions(-) diff --git a/manifests/apache.pp b/manifests/apache.pp index 2a4e887..faae63c 100644 --- a/manifests/apache.pp +++ b/manifests/apache.pp @@ -24,43 +24,78 @@ class etherpad_lite::apache ( template => 'etherpad_lite/etherpadlite.vhost.erb', ssl => true, } - httpd_mod { 'rewrite': - ensure => present, + + if !defined(Mod['rewrite']) { + httpd::mod { 'rewrite': + ensure => present, + } } - httpd_mod { 'proxy': - ensure => present, + if !defined(Mod['proxy']) { + httpd::mod { 'proxy': + ensure => present, + } } - httpd_mod { 'proxy_http': - ensure => present, + if !defined(Mod['proxy_http']) { + httpd::mod { 'proxy_http': + ensure => present, + } } + file { '/etc/apache2': + ensure => directory, + owner => 'root', + group => 'root', + mode => '0755', + } if ($::lsbdistcodename == 'precise') { + file { '/etc/apache2/conf.d': + ensure => directory, + owner => 'root', + group => 'root', + mode => '0755', + require => File['/etc/apache2'], + } file { '/etc/apache2/conf.d/connection-tuning': - ensure => present, - owner => 'root', - group => 'root', - mode => '0644', - source => 'puppet:///modules/etherpad_lite/apache-connection-tuning', - notify => Service['httpd'], + ensure => present, + owner => 'root', + group => 'root', + mode => '0644', + source => 'puppet:///modules/etherpad_lite/apache-connection-tuning', + notify => Service['httpd'], + require => File['/etc/apache2/conf.d'], } } else { - file { '/etc/apache2/conf-available/connection-tuning.conf': - ensure => present, - owner => 'root', - group => 'root', - mode => '0644', - source => 'puppet:///modules/etherpad_lite/apache-connection-tuning', + file { '/etc/apache2/conf-available': + ensure => directory, + owner => 'root', + group => 'root', + mode => '0755', + require => File['/etc/apache2'], + } + file { '/etc/apache2/conf-available/connection-tuning': + ensure => present, + owner => 'root', + group => 'root', + mode => '0644', + source => 'puppet:///modules/etherpad_lite/apache-connection-tuning', + require => File['/etc/apache2/conf-available'], } - file { '/etc/apache2/conf-enabled/connection-tuning.conf': + file { '/etc/apache2/conf-enabled': + ensure => directory, + owner => 'root', + group => 'root', + mode => '0755', + require => File['/etc/apache2'], + } + file { '/etc/apache2/conf-enabled/connection-tuning': ensure => link, target => '/etc/apache2/conf-available/connection-tuning.conf', notify => Service['httpd'], - require => File['/etc/apache2/conf-available/connection-tuning.conf'], - } - - httpd_mod { 'proxy_wstunnel': - ensure => present, + require => [ + File['/etc/apache2/conf-enabled'], + File['/etc/apache2/conf-available/connection-tuning'], + ], } }