From 78e213940597181fd9475069769c742a2ce461a2 Mon Sep 17 00:00:00 2001
From: Matthieu Faure <mfaure@asqatasun.org>
Date: Fri, 15 Mar 2019 09:41:06 +0100
Subject: [PATCH] debug SQL

---
 manifests/init.pp | 33 ++++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/manifests/init.pp b/manifests/init.pp
index 200e54b..3abc787 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -32,21 +32,28 @@ class comptoir (
   # TODO 1. add an 'onlyif' statement to Exec (for instance COMPTOIR_create_DB_tables_and_procedures.sh is executable)
   # TODO 2. improve puppet code to avoid Exec,
   # TODO 3. ...maybe by creating an idempotent SQL, see https://stackoverflow.com/questions/33631186/how-do-i-make-alter-column-idempotent
-  -> Exec { 'Create SQL tables & procedures':
-    command     => "${comptoir_dir}/bin/COMPTOIR_create_DB_tables_and_procedures.sh -d ${comptoir_dir}",
-    cwd         => $comptoir_dir,
-    user        => $comptoir_user,
-    environment => [ 'HOME=/home/comptoir' ],
-  }
+  # -> Exec { 'Create SQL tables & procedures':
+  #   command     => "${comptoir_dir}/bin/COMPTOIR_create_DB_tables_and_procedures.sh -d ${comptoir_dir}",
+  #   cwd         => $comptoir_dir,
+  #   user        => $comptoir_user,
+  #   environment => [ 'HOME=/home/comptoir' ],
+  # }
 
-  # Install app with Composer
-  -> Exec { 'Install app with Composer':
-    command     => '/usr/local/bin/composer --no-progress install',
-    cwd         => $comptoir_dir,
-    user        => $comptoir_user,
-    environment => [ 'HOME=/home/comptoir' ],
-    timeout     => 600, # doubled default value which is 300s
+  postgresql_psql { 'Create SQL tables & procedures':
+    command   => '\d',
+    # cwd       => '',
+    db        => 'comptoir', # TODO set this as a parameter
+    psql_user => 'comptoir', # TODO set this as a parameter
   }
 
+  # # Install app with Composer
+  # -> Exec { 'Install app with Composer':
+  #   command     => '/usr/local/bin/composer --no-progress install',
+  #   cwd         => $comptoir_dir,
+  #   user        => $comptoir_user,
+  #   environment => [ 'HOME=/home/comptoir' ],
+  #   timeout     => 600, # doubled default value which is 300s
+  # }
+
   #
 }
-- 
GitLab