Commit 84b7e0e8 authored by Rafael Monnerat's avatar Rafael Monnerat

Provide the erp5 site id as parameter.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@44143 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6667ce1f
......@@ -40,6 +40,8 @@ CONFIG = dict(
test_ca_prefix='test_ca',
# Zope
zope_user='zope',
# ERP5
erp5_site_id='erp5',
# MySQL
mysql_database='erp5',
mysql_port=45678,
......@@ -386,21 +388,23 @@ class Recipe(BaseSlapRecipe):
def installERP5Site(self):
""" Create a script controlled by supervisor, which creates a erp5
site on current available zope and mysql environment"""
erp5_site_id = CONFIG['erp5_site_id']
mysql_connection_string = "%s@%s:%s %s %s" % (CONFIG['mysql_database'],
CONFIG['mysql_ip'],
CONFIG['mysql_port'],
CONFIG['mysql_user'],
CONFIG['mysql_password'])
https_connection_url = "https://%s:%s@%s:%s/" % (CONFIG['zope_user'],
CONFIG['zope_password'],
https_connection_url = "https://%s:%s@%s:%s/" % (self.connection_dict['zope_user'],
self.connection_dict['zope_password'],
self.backend_ip,
self.backend_port)
self.path_list.extend(zc.buildout.easy_install.scripts([('erp5_update',
__name__ + '.erp5', 'updateERP5')], self.ws,
sys.executable, self.wrapper_directory,
arguments=[mysql_connection_string, https_connection_url]))
arguments=[erp5_site_id, mysql_connection_string,
https_connection_url]))
return []
......
......@@ -28,26 +28,26 @@ import time
import urllib
def updateERP5(args):
base_url = args[1]
mysql_string = args[0]
base_url = args[2]
mysql_string = args[1]
site_id = args[0]
sleep = 30
while True:
try:
url = '%s/erp5/getId' % base_url
result = urllib.urlopen(url).read()
test_url = '%s/%s/getId' % (base_url, site_id)
result = urllib.urlopen(test_url).read()
# XXX This result should be more assertive
if result != 'erp5':
if result != site_id:
url = '%s/manage_addProduct/ERP5/manage_addERP5Site' % base_url
result = urllib.urlopen(url, urllib.urlencode({
"id": "erp5",
"id": site_id,
"erp5_sql_connection_string": mysql_string,
"cmf_activity_sql_connection_string": mysql_string, }))
print result.read()
url = '%s/erp5/getId' % base_url
result = urllib.urlopen(url).read()
result = urllib.urlopen(test_url).read()
if result == 'erp5':
if result == site_id:
print "Ready for install one business."
# XXX Suggestion for future
# POST '%s/erp5/portal_templates/updateRepositoryBusinessTemplateList <
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment