From 2a0bc2128579878443eeb95af52162d2fa6bc765 Mon Sep 17 00:00:00 2001
From: Rafael Monnerat <rafael@nexedi.com>
Date: Thu, 19 Jul 2012 11:59:16 +0900
Subject: [PATCH] Add promise to check erp5 site creation

The erp5 is created by erp5-bootstrap, this promise assert if the site
is already created.
---
 stack/erp5/buildout.cfg                     | 5 +++--
 stack/erp5/instance-erp5-development.cfg.in | 8 ++++++++
 stack/erp5/instance.cfg.in                  | 4 ++++
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/stack/erp5/buildout.cfg b/stack/erp5/buildout.cfg
index 4a9bc1b81..7098ba75f 100644
--- a/stack/erp5/buildout.cfg
+++ b/stack/erp5/buildout.cfg
@@ -252,12 +252,13 @@ mode = 640
 # XXX: "template.cfg" is hardcoded in instanciation recipe
 filename = template.cfg
 template = ${:_profile_base_location_}/instance.cfg.in
-md5sum = 88356e0017fc9e231c583a5f3544a5b9
+md5sum = 9704211fdbed6b23854dcc2222d387c4
 extra-context =
     key apache_location apache:location
     key aspell_location aspell:location
     key buildout_bin_directory buildout:bin-directory
     key coreutils_location coreutils:location
+    key curl_location curl:location
     key dash_location dash:location
     key dcron_location dcron:location
     key dmtx_utils_location dmtx-utils:location
@@ -318,7 +319,7 @@ extra-context =
 [template-erp5-development]
 recipe = slapos.recipe.build:download
 url = ${:_profile_base_location_}/instance-erp5-development.cfg.in
-md5sum = e95429fa0e4e3bb87b042277ba52fd8f
+md5sum = 2a4312202a3160f874c4fa3ee9155a1d
 mode = 640
 
 [template-erp5-production]
diff --git a/stack/erp5/instance-erp5-development.cfg.in b/stack/erp5/instance-erp5-development.cfg.in
index 01759e21b..15aa6ebd9 100644
--- a/stack/erp5/instance-erp5-development.cfg.in
+++ b/stack/erp5/instance-erp5-development.cfg.in
@@ -15,6 +15,7 @@ parts +=
   test-runner
   erp5-bootstrap
   erp5-promise
+  promise-erp5-site
 
 eggs-directory = {{ eggs_directory }}
 develop-eggs-directory = {{ develop_eggs_directory }}
@@ -127,3 +128,10 @@ site-id = ${slap-parameter:site-id}
 test-ca-dir = ${rootdirectory:srv}/test-ca
 test-instance-path = ${rootdirectory:srv}/test-instance
 unit-test-path = ${:test-instance-path}/unit_test
+
+[promise-erp5-site]
+recipe = slapos.cookbook:check_url_available
+path = ${basedirectory:promises}/erp5site
+url = http://${zope-instance:ip}:${zope-instance:port}/${slap-parameter:site-id}
+dash_path = {{ dash_location }}/bin/dash
+curl_path = {{ curl_location }}/bin/curl
diff --git a/stack/erp5/instance.cfg.in b/stack/erp5/instance.cfg.in
index 5e89d0712..492b2a3c7 100644
--- a/stack/erp5/instance.cfg.in
+++ b/stack/erp5/instance.cfg.in
@@ -169,6 +169,8 @@ extra-context =
 bin-directory = {{ bin_directory }}
 openssl = {{ openssl_location }}
 local_bt5_repository = {{ local_bt5_repository  }}
+dash = {{ dash_location }}
+curl = {{ curl_location }}
 
 [template-erp5-development]
 < = jinja2-template-base
@@ -180,6 +182,8 @@ filename = instance-erp5-development.cfg
 extra-context =
     key bin_directory template-erp5-development-parameters:bin-directory
     key openssl_location template-erp5-development-parameters:openssl
+    key curl_location template-erp5-development-parameters:curl
+    key dash_location template-erp5-development-parameters:dash
     key template_zope dynamic-template-zope:rendered
     key local_bt5_repository template-erp5-development-parameters:local_bt5_repository
 
-- 
2.30.9