From ff9f8763942186a287b53dd32360dd3335889b56 Mon Sep 17 00:00:00 2001
From: Matthieu Faure <mfaure@asqatasun.org>
Date: Mon, 18 Mar 2019 17:51:10 +0100
Subject: [PATCH] re-enable perms check on dirs tmp/

---
 manifests/init.pp | 46 ++++++++++++++--------------------------------
 1 file changed, 14 insertions(+), 32 deletions(-)

diff --git a/manifests/init.pp b/manifests/init.pp
index 4977966..fd07e0e 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -63,7 +63,7 @@ class comptoir (
   }
 
   # Install app with Composer
-  -> exec { 'Install app with Composer':
+  -> exec { 'composer install':
     command     => '/usr/local/bin/composer --no-progress install',
     cwd         => $comptoir_dir,
     user        => $comptoir_user,
@@ -79,7 +79,7 @@ class comptoir (
       user        => $comptoir_user,
       environment => [ 'HOME=/home/comptoir' ],
       onlyif      => "/bin/grep '//COMPTOIR-DEBUG' ${_file_app_php}",
-      require     => Exec['Install app with Composer'],
+      require     => Exec['composer install'],
     }
     -> exec { 'Comptoir APP.PHP barman-DEV':
       command     => "${_my_sed} ${_sed_barman_dev} ${_file_app_php}",
@@ -97,7 +97,7 @@ class comptoir (
     user        => $comptoir_user,
     environment => [ 'HOME=/home/comptoir' ],
     onlyif      => "/bin/grep '__SALT__' ${_file_app_php}",
-    require     => Exec['Install app with Composer'],
+    require     => Exec['composer install'],
   }
   -> exec { 'Comptoir APP.PHP Session default':
     command => "${_my_sed} \"s!'php',!env('SESSION_DEFAULTS', 'php'), !\" ${_file_app_php}",
@@ -112,37 +112,19 @@ class comptoir (
     path    => $_file_comptoir_php,
     content => template('comptoir/comptoir.php.epp'),
     owner   => $comptoir_user,
-    require => Exec['Install app with Composer'],
+    require => Exec['composer install'],
   }
 
-  # Note: is it really useful compared to 'Comptoir tmp/' as only files in tmp/ are modified ?
-  # file { 'Chmod -R o-w':
-  #   ensure  => directory,
-  #   path    => $comptoir_dir,
-  #   mode    => 'o-w',
-  #   recurse => true,
-  #   require => Exec['Install app with Composer'],
-  # }
-
   # Set permissions on directories tmp/ logs/ webroot/
-  # file { 'Comptoir tmp/':
-  #   ensure  => directory,
-  #   path    => "${comptoir_dir}/tmp",
-  #   mode    => '0755',
-  #   owner   => $apache_user,
-  #   group   => $comptoir_user,
-  #   recurse => true,
-  #   require => Exec['Install app with Composer'],
-  # }
-  # file { 'Comptoir webroot/':
-  #   ensure  => directory,
-  #   path    => "${comptoir_dir}/webroot",
-  #   mode    => '0755',
-  #   owner   => $apache_user,
-  #   group   => $comptoir_user,
-  #   recurse => true,
-  #   require => Exec['Install app with Composer'],
-  # }
+  file { 'Comptoir tmp/':
+    ensure  => directory,
+    path    => "${comptoir_dir}/tmp",
+    mode    => '0755',
+    owner   => $apache_user,
+    group   => $comptoir_user,
+    recurse => true,
+    require => Exec['composer install'],
+  }
   # file { 'Comptoir logs/':
   #   ensure  => directory,
   #   path    => "${comptoir_dir}/logs",
@@ -150,7 +132,7 @@ class comptoir (
   #   owner   => $apache_user,
   #   group   => $comptoir_user,
   #   recurse => true,
-  #   require => Exec['Install app with Composer'],
+  #   require => Exec['composer install'],
   # }
 
   # TODO: find "Comptoir-srv/$i" -type f -exec sudo chmod 664 {} \;
-- 
GitLab