Commit 27a988f3 authored by Rafael Monnerat's avatar Rafael Monnerat

Implemented installERP5Site (not enabled yet) and few pep8 fixes.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@44087 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 24c9d96c
...@@ -110,7 +110,8 @@ class Recipe(BaseSlapRecipe): ...@@ -110,7 +110,8 @@ class Recipe(BaseSlapRecipe):
zodb_dir = os.path.join(self.data_root_directory, zodb_dir = os.path.join(self.data_root_directory,
CONFIG['zodb_data_prefix']) CONFIG['zodb_data_prefix'])
self._createDirectory(zodb_dir) self._createDirectory(zodb_dir)
CONFIG['zodb_root_path'] = os.path.join(zodb_dir, CONFIG['zodb_root_filename']) CONFIG['zodb_root_path'] = os.path.join(zodb_dir,
CONFIG['zodb_root_filename'])
if 'zope_amount' in self.parameter_dict: if 'zope_amount' in self.parameter_dict:
simple_zope = False simple_zope = False
CONFIG['zope_amount'] = int(self.parameter_dict.get('zope_amount')) CONFIG['zope_amount'] = int(self.parameter_dict.get('zope_amount'))
...@@ -121,6 +122,7 @@ class Recipe(BaseSlapRecipe): ...@@ -121,6 +122,7 @@ class Recipe(BaseSlapRecipe):
self.installZeo() self.installZeo()
for zope_number in xrange(1, CONFIG['zope_amount'] + 1): for zope_number in xrange(1, CONFIG['zope_amount'] + 1):
self.installZope(zope_number, simple_zope) self.installZope(zope_number, simple_zope)
self.installHaproxy() self.installHaproxy()
self.installTestRunner() self.installTestRunner()
self.linkBinary() self.linkBinary()
...@@ -198,13 +200,14 @@ class Recipe(BaseSlapRecipe): ...@@ -198,13 +200,14 @@ class Recipe(BaseSlapRecipe):
) )
def installTestRunner(self): def installTestRunner(self):
"""Installs bin/runTestSuite executable to run all tests using bin/runUnitTest""" """Installs bin/runTestSuite executable to run all tests using
bin/runUnitTest"""
# XXX: This method can be drastically simplified after #20110128-1ECA63 # XXX: This method can be drastically simplified after #20110128-1ECA63
# (ERP5 specific runUnitTest script shall be generated by erp5 eggg) will # (ERP5 specific runUnitTest script shall be generated by erp5 eggg) will
# be solved # be solved
testinstance = self.createDataDirectory('testinstance') testinstance = self.createDataDirectory('testinstance')
# workaround wrong assumptions of ERP5Type.tests.runUnitTest about directory # workaround wrong assumptions of ERP5Type.tests.runUnitTest about
# existence # directory existence
unit_test = os.path.join(testinstance, 'unit_test') unit_test = os.path.join(testinstance, 'unit_test')
if not os.path.isdir(unit_test): if not os.path.isdir(unit_test):
os.mkdir(unit_test) os.mkdir(unit_test)
...@@ -219,16 +222,18 @@ class Recipe(BaseSlapRecipe): ...@@ -219,16 +222,18 @@ class Recipe(BaseSlapRecipe):
'--erp5_sql_connection_string', '%(mysql_test_database)s@%' '--erp5_sql_connection_string', '%(mysql_test_database)s@%'
'(mysql_ip)s:%(mysql_port)s %(mysql_test_user)s ' '(mysql_ip)s:%(mysql_port)s %(mysql_test_user)s '
'%(mysql_test_password)s' % self.connection_dict, '%(mysql_test_password)s' % self.connection_dict,
'--conversion_server_hostname=%(conversion_server_ip)s' % self.connection_dict, '--conversion_server_hostname=%(conversion_server_ip)s' % \
'--conversion_server_port=%(conversion_server_port)s' % self.connection_dict self.connection_dict,
'--conversion_server_port=%(conversion_server_port)s' % \
self.connection_dict
] ]
)])[0] )])[0]
self.path_list.append(runUnitTest) self.path_list.append(runUnitTest)
def _installCertificateAuthority(self, prefix=''): def _installCertificateAuthority(self, prefix=''):
CONFIG.update( CONFIG.update(
ca_dir=os.path.join(self.data_root_directory, CONFIG['%sca_prefix' % prefix]) ca_dir=os.path.join(self.data_root_directory,
) CONFIG['%sca_prefix' % prefix]))
CONFIG.update( CONFIG.update(
ca_certificate=os.path.join(CONFIG['ca_dir'], 'cacert.pem'), ca_certificate=os.path.join(CONFIG['ca_dir'], 'cacert.pem'),
ca_key=os.path.join(CONFIG['ca_dir'], 'private', 'cakey.pem'), ca_key=os.path.join(CONFIG['ca_dir'], 'private', 'cakey.pem'),
...@@ -400,6 +405,27 @@ class Recipe(BaseSlapRecipe): ...@@ -400,6 +405,27 @@ class Recipe(BaseSlapRecipe):
self._createDirectory(os.path.join(self.erp5_directory, directory)) self._createDirectory(os.path.join(self.erp5_directory, directory))
return [] return []
def installERP5Site(self):
""" Create a script controlled by supervisor, which creates a erp5
site on current available zope and mysql environment"""
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'],
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]))
return []
def installZeo(self): def installZeo(self):
CONFIG.update( CONFIG.update(
zeo_event_log=os.path.join(self.log_directory, 'zeo.log'), zeo_event_log=os.path.join(self.log_directory, 'zeo.log'),
...@@ -517,8 +543,8 @@ SSLRandomSeed connect builtin ...@@ -517,8 +543,8 @@ SSLRandomSeed connect builtin
self.getLocalIPv4Address(), CONFIG['login_apache_port_base'] + index) self.getLocalIPv4Address(), CONFIG['login_apache_port_base'] + index)
apache_conf['server_name'] = '%s' % apache_conf['ip'] apache_conf['server_name'] = '%s' % apache_conf['ip']
apache_conf['ssl_snippet'] = ssl_template % CONFIG apache_conf['ssl_snippet'] = ssl_template % CONFIG
apache_config_file = self._writeApacheConfiguration('login_apache_%s' % index, apache_config_file = self._writeApacheConfiguration('login_apache_%s' % \
apache_conf) index, apache_conf)
self.path_list.append(apache_config_file) self.path_list.append(apache_config_file)
self.path_list.extend(zc.buildout.easy_install.scripts([( self.path_list.extend(zc.buildout.easy_install.scripts([(
'login_apache_%s' % index, 'login_apache_%s' % index,
...@@ -541,7 +567,8 @@ SSLCertificateFile %(key_auth_certificate)s ...@@ -541,7 +567,8 @@ SSLCertificateFile %(key_auth_certificate)s
SSLCertificateKeyFile %(key_auth_key)s SSLCertificateKeyFile %(key_auth_key)s
SSLCACertificateFile %(ca_certificate)s SSLCACertificateFile %(ca_certificate)s
SSLCARevocationPath %(ca_crl)s""" SSLCARevocationPath %(ca_crl)s"""
apache_conf = self._getApacheConfigurationDict('key_auth_apache_%s' % index, apache_conf = self._getApacheConfigurationDict('key_auth_apache_%s' % \
index,
self.getLocalIPv4Address(), self.getLocalIPv4Address(),
CONFIG['key_auth_apache_port_base'] + index) CONFIG['key_auth_apache_port_base'] + index)
apache_conf['ssl_snippet'] = ssl_template % CONFIG apache_conf['ssl_snippet'] = ssl_template % CONFIG
......
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