From ec5775ec69513e53761868ffb4ddc6d4050b01d6 Mon Sep 17 00:00:00 2001
From: Alain Takoudjou <alain.takoudjou@nexedi.com>
Date: Tue, 3 Mar 2020 18:16:59 +0100
Subject: [PATCH] postgres recipe: on update or re-install generate
 configuration and wrapper file

If pgdata already exists, then postgres recipe will not update or install anything when buildout will run. This result to no configuration or wrapper updated if configuration changes.

For example this change:  29d1ed689d0e37360af287e5de6c87d4c3736de7  the path of `posgtres bin` is now in shared folder, then impossible to run postgres service anymore because path was not updated by buildout in wrapper.

/reviewed-on https://lab.nexedi.com/nexedi/slapos/merge_requests/703
---
 slapos/recipe/postgres/__init__.py | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/slapos/recipe/postgres/__init__.py b/slapos/recipe/postgres/__init__.py
index a0f2fe216..cedba1dc7 100644
--- a/slapos/recipe/postgres/__init__.py
+++ b/slapos/recipe/postgres/__init__.py
@@ -91,16 +91,13 @@ class Recipe(GenericBaseRecipe):
                 # run we won't update it.
                 shutil.rmtree(pgdata)
                 raise
-
-
-
-        # install() methods usually return the pathnames of managed files.
-        # If they are missing, they will be rebuilt.
-        # In this case, we already check for the existence of pgdata,
-        # so we don't need to return anything here.
+        else:
+            self.createConfig()
+            self.createRunScript()
 
         return []
 
+    update = install
 
     def check_exists(self, path):
         if not os.path.isfile(path):
-- 
2.30.9