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):
zodb_dir = os.path.join(self.data_root_directory,
CONFIG['zodb_data_prefix'])
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:
simple_zope = False
CONFIG['zope_amount'] = int(self.parameter_dict.get('zope_amount'))
......@@ -121,6 +122,7 @@ class Recipe(BaseSlapRecipe):
self.installZeo()
for zope_number in xrange(1, CONFIG['zope_amount'] + 1):
self.installZope(zope_number, simple_zope)
self.installHaproxy()
self.installTestRunner()
self.linkBinary()
......@@ -198,13 +200,14 @@ class Recipe(BaseSlapRecipe):
)
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
# (ERP5 specific runUnitTest script shall be generated by erp5 eggg) will
# be solved
testinstance = self.createDataDirectory('testinstance')
# workaround wrong assumptions of ERP5Type.tests.runUnitTest about directory
# existence
# workaround wrong assumptions of ERP5Type.tests.runUnitTest about
# directory existence
unit_test = os.path.join(testinstance, 'unit_test')
if not os.path.isdir(unit_test):
os.mkdir(unit_test)
......@@ -219,16 +222,18 @@ class Recipe(BaseSlapRecipe):
'--erp5_sql_connection_string', '%(mysql_test_database)s@%'
'(mysql_ip)s:%(mysql_port)s %(mysql_test_user)s '
'%(mysql_test_password)s' % self.connection_dict,
'--conversion_server_hostname=%(conversion_server_ip)s' % self.connection_dict,
'--conversion_server_port=%(conversion_server_port)s' % self.connection_dict
'--conversion_server_hostname=%(conversion_server_ip)s' % \
self.connection_dict,
'--conversion_server_port=%(conversion_server_port)s' % \
self.connection_dict
]
)])[0]
self.path_list.append(runUnitTest)
def _installCertificateAuthority(self, prefix=''):
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(
ca_certificate=os.path.join(CONFIG['ca_dir'], 'cacert.pem'),
ca_key=os.path.join(CONFIG['ca_dir'], 'private', 'cakey.pem'),
......@@ -400,6 +405,27 @@ class Recipe(BaseSlapRecipe):
self._createDirectory(os.path.join(self.erp5_directory, directory))
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):
CONFIG.update(
zeo_event_log=os.path.join(self.log_directory, 'zeo.log'),
......@@ -517,8 +543,8 @@ SSLRandomSeed connect builtin
self.getLocalIPv4Address(), CONFIG['login_apache_port_base'] + index)
apache_conf['server_name'] = '%s' % apache_conf['ip']
apache_conf['ssl_snippet'] = ssl_template % CONFIG
apache_config_file = self._writeApacheConfiguration('login_apache_%s' % index,
apache_conf)
apache_config_file = self._writeApacheConfiguration('login_apache_%s' % \
index, apache_conf)
self.path_list.append(apache_config_file)
self.path_list.extend(zc.buildout.easy_install.scripts([(
'login_apache_%s' % index,
......@@ -541,13 +567,14 @@ SSLCertificateFile %(key_auth_certificate)s
SSLCertificateKeyFile %(key_auth_key)s
SSLCACertificateFile %(ca_certificate)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(),
CONFIG['key_auth_apache_port_base'] + index)
apache_conf['ssl_snippet'] = ssl_template % CONFIG
prefix = 'ssl_key_auth_apache_%s' % index
rewrite_rule_template = \
"RewriteRule (.*) http://%(backend_ip)s:%(backend_port)s%(key_auth_path)s$1 [L,P]"
"RewriteRule (.*) http://%(backend_ip)s:%(backend_port)s%(key_auth_path)s$1 [L,P]"
path_template = pkg_resources.resource_string(__name__,
'template/apache.zope.conf.path.in')
path = path_template % dict(path='/')
......
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