From b11efdaef09f6a3910a822d3497ed37b2e27aae8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com>
Date: Wed, 4 May 2011 13:54:12 +0000
Subject: [PATCH] Finalize tidstorage server part installation by setting up
 repozo wrapper and configuring backup cron job.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45835 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5/src/slapos/recipe/erp5/__init__.py      | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/slapos/recipe/erp5/src/slapos/recipe/erp5/__init__.py b/slapos/recipe/erp5/src/slapos/recipe/erp5/__init__.py
index 6e5356af2e..3a6823918f 100644
--- a/slapos/recipe/erp5/src/slapos/recipe/erp5/__init__.py
+++ b/slapos/recipe/erp5/src/slapos/recipe/erp5/__init__.py
@@ -568,6 +568,7 @@ class Recipe(BaseSlapRecipe):
     pidfile = os.path.join(self.run_directory, 'tidstorage.pid')
     timestamp_file_path = os.path.join(self.log_directory,
           'repozo_tidstorage_timestamp.log')
+    # shared configuration file
     tidstorage_config = self.createConfigurationFile('tidstorage.py',
         self.substituteTemplate(self.getTemplateFilename('tidstorage.py.in'),
           dict(
@@ -580,6 +581,7 @@ class Recipe(BaseSlapRecipe):
         logfile=logfile,
         pidfile=pidfile
       )))
+    # TID server
     tidstorage_server = zc.buildout.easy_install.scripts([('tidstoraged',
       __name__ + '.execute', 'execute')], self.ws, sys.executable,
       self.wrapper_directory, arguments=[
@@ -589,7 +591,19 @@ class Recipe(BaseSlapRecipe):
           self.killpidfromfile + ' ' + pidfile + ' SIGHUP')
     self.path_list.append(tidstorage_config)
     self.path_list.append(tidstorage_server)
-    raise NotImplementedError
+
+    # repozo wrapper
+    tidstorage_repozo = zc.buildout.easy_install.scripts([('tidstorage_repozo',
+      __name__ + '.execute', 'execute')], self.ws, sys.executable,
+      self.bin_directory, arguments=[
+        self.options['tidstorage_repozo_binary'], '--config', tidstorage_config,
+      '--repozo', self.options['repozo_binary']])[0]
+    self.path_list.append(tidstorage_repozo)
+
+    # and backup configuration
+    tidstorage_repozo_cron = os.path.join(self.cron_d, 'tidstorage_repozo')
+    open(tidstorage_repozo_cron, 'w').write('0 0 * * * %s' % tidstorage_repozo)
+    self.path_list.append(tidstorage_repozo_cron)
 
   def installZope(self, ip, port, name, zodb_configuration_string,
       with_timerservice=False):
-- 
2.30.9