Commit 42ff3dc8 authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

Update Release Candidate

parents ae9720a3 2c8da742
Pipeline #36805 failed with stage
in 0 seconds
...@@ -46,8 +46,8 @@ environment = ...@@ -46,8 +46,8 @@ environment =
[openssl-3.0] [openssl-3.0]
<= openssl-common <= openssl-common
url = https://www.openssl.org/source/openssl-3.0.14.tar.gz url = https://github.com/openssl/openssl/releases/download/openssl-3.0.15/openssl-3.0.15.tar.gz
md5sum = e6fe71fb59a502db54a25cd0f34ea67e md5sum = 08f458c00fff496a52ef931c481045cd
[openssl-quictls] [openssl-quictls]
<= openssl-3.0 <= openssl-3.0
......
...@@ -28,7 +28,7 @@ from setuptools import setup, find_packages ...@@ -28,7 +28,7 @@ from setuptools import setup, find_packages
import glob import glob
import os import os
version = '1.0.365' version = '1.0.367'
name = 'slapos.cookbook' name = 'slapos.cookbook'
long_description = open("README.rst").read() long_description = open("README.rst").read()
...@@ -98,7 +98,6 @@ setup(name=name, ...@@ -98,7 +98,6 @@ setup(name=name,
'dropbear.client = slapos.recipe.dropbear:Client', 'dropbear.client = slapos.recipe.dropbear:Client',
'equeue = slapos.recipe.equeue:Recipe', 'equeue = slapos.recipe.equeue:Recipe',
'erp5.promise = slapos.recipe.erp5_promise:Recipe', 'erp5.promise = slapos.recipe.erp5_promise:Recipe',
'erp5scalabilitytestbed = slapos.recipe.erp5scalabilitytestbed:Recipe',
'erp5testnode = slapos.recipe.erp5testnode:Recipe', 'erp5testnode = slapos.recipe.erp5testnode:Recipe',
'free_port = slapos.recipe.free_port:Recipe', 'free_port = slapos.recipe.free_port:Recipe',
'generate.mac = slapos.recipe.random:Mac', 'generate.mac = slapos.recipe.random:Mac',
...@@ -145,7 +144,6 @@ setup(name=name, ...@@ -145,7 +144,6 @@ setup(name=name,
'requestoptional.serialised = ' 'requestoptional.serialised = '
'slapos.recipe.request:RequestOptionalJSONEncoded', 'slapos.recipe.request:RequestOptionalJSONEncoded',
're6stnet.registry = slapos.recipe.re6stnet:Recipe', 're6stnet.registry = slapos.recipe.re6stnet:Recipe',
'sheepdogtestbed = slapos.recipe.sheepdogtestbed:SheepDogTestBed',
'shell = slapos.recipe.shell:Recipe', 'shell = slapos.recipe.shell:Recipe',
'signalwrapper= slapos.recipe.signal_wrapper:Recipe', 'signalwrapper= slapos.recipe.signal_wrapper:Recipe',
'simplelogger = slapos.recipe.simplelogger:Recipe', 'simplelogger = slapos.recipe.simplelogger:Recipe',
...@@ -165,7 +163,6 @@ setup(name=name, ...@@ -165,7 +163,6 @@ setup(name=name,
'userinfo = slapos.recipe.userinfo:Recipe', 'userinfo = slapos.recipe.userinfo:Recipe',
'wrapper = slapos.recipe.wrapper:Recipe', 'wrapper = slapos.recipe.wrapper:Recipe',
'zabbixagent = slapos.recipe.zabbixagent:Recipe', 'zabbixagent = slapos.recipe.zabbixagent:Recipe',
'zeo = slapos.recipe.zeo:Recipe',
'zero-knowledge.read = slapos.recipe.zero_knowledge:ReadRecipe', 'zero-knowledge.read = slapos.recipe.zero_knowledge:ReadRecipe',
'zero-knowledge.write = slapos.recipe.zero_knowledge:WriteRecipe' 'zero-knowledge.write = slapos.recipe.zero_knowledge:WriteRecipe'
], ],
......
##############################################################################
#
# Copyright (c) 2011 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs End users who
# are looking for a ready-to-use solution with commercial guarantees and
# support are strongly adviced to contract a Free Software Service Company
#
# This program is Free Software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 3 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import os
import pkg_resources
from slapos.recipe.librecipe import BaseSlapRecipe
class Recipe(BaseSlapRecipe):
def _install(self):
self.parameter_dict = self.computer_partition.getInstanceParameterDict()
software_type = self.parameter_dict.get('slap_software_type', 'default')
if software_type is None or software_type == 'RootSoftwareInstance':
software_type = 'erp5_scalability_cloud'
if "run_%s" % software_type in dir(self) and \
callable(getattr(self, "run_%s" % software_type)):
return getattr(self, "run_%s" % software_type)()
else:
raise NotImplementedError("Do not support %s" % software_type)
def run_erp5_scalability_cloud(self):
config = {}
config.update(self.options)
config.update(self.parameter_dict)
config['address'] = self.getGlobalIPv6Address()
config['report_path'] = self.log_directory
config.setdefault('user_range_increment', 1)
config['software_release_url'] = self.software_release_url
config['server_url'] = self.server_url
config['key_file'] = self.key_file
config['cert_file'] = self.cert_file
config['computer_id'] = self.computer_id
config['computer_partition_id'] = self.computer_partition_id
config['plugin_name'] = 'erp5'
if ',' in config['nb_users']:
config['nb_tester_init'] = config['nb_users'].split(',')[0]
config['nb_tester_max'] = config['nb_users'].split(',')[1]
else:
config['nb_tester_init'] = config['nb_users']
config['nb_tester_max'] = config['nb_users']
connection = {}
connection['url'] = 'http://['+config['address']+']:5000/'
connection['erp5_url'] = config['erp5_url']
connection['repeat'] = config['repeat']
connection['nb_users'] = config['nb_users']
connection['benchmark_suites'] = config['benchmark_suites']
connection['erp5_publish_url'] = config.get('erp5_publish_url', '')
connection['erp5_publish_project'] = config.get('erp5_publish_project', '')
self.computer_partition.setConnectionDict(connection)
nosqltester_manager_wrapper_template_location = pkg_resources.resource_filename(
__name__, os.path.join('template', 'erp5tester_manager_run.in'))
nosqltester_manager_runner_path = self.createRunningWrapper("erp5tester_manager",
self.substituteTemplate(nosqltester_manager_wrapper_template_location, config))
return [nosqltester_manager_runner_path]
def run_erp5_tester(self):
tester_config = {}
tester_config.update(self.options)
tester_config.update(self.parameter_dict)
tester_config['tester_address'] = self.getGlobalIPv6Address()
tester_config['report_path'] = self.log_directory
tester_config['filename_prefix'] = '%s-%s' % (self.computer_id,
self.computer_partition_id)
tester_connection = {'url': 'http://[%s]:5000/' % \
tester_config['tester_address']}
self.computer_partition.setConnectionDict(tester_connection)
tester_wrapper_template_location = pkg_resources.resource_filename(
__name__, os.path.join('template', 'nosqltester_run.in'))
tester_runner_path = self.createRunningWrapper("nosqltester",
self.substituteTemplate(tester_wrapper_template_location, tester_config))
return [tester_runner_path]
#!/bin/sh
# BEWARE: This file is operated by slapos node
# BEWARE: It will be overwritten automatically
exec %(scalability_tester_manager_binary)s %(plugin_name)s -a %(address)s \
-r %(report_path)s -m %(nb_tester_init)s -t %(nb_tester_max)s \
-i %(user_range_increment)s --erp5-publish-url "%(erp5_publish_url)s" \
--erp5-publish-project "%(erp5_publish_project)s" %(software_release_url)s \
%(server_url)s "%(key_file)s" "%(cert_file)s" %(computer_id)s \
%(computer_partition_id)s
#!/bin/sh
# BEWARE: This file is operated by slapos node
# BEWARE: It will be overwritten automatically
cd %(benchmark_suite_path)s && \
exec %(scalability_tester_binary)s -m %(host_address)s -a %(tester_address)s \
-r %(report_path)s -l %(report_path)s --filename-prefix %(filename_prefix)s \
--repeat %(repeat)s %(erp5_url)s 1 %(benchmark_suites)s
...@@ -36,7 +36,7 @@ import traceback ...@@ -36,7 +36,7 @@ import traceback
import six import six
SOFTWARE_PRODUCT_NAMESPACE = "product." SOFTWARE_PRODUCT_NAMESPACE = "product."
DEFAULT_SOFTWARE_TYPE = 'RootSoftwareInstance' DEFAULT_SOFTWARE_TYPE = 'default'
class Recipe(object): class Recipe(object):
""" """
......
##############################################################################
#
# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import os
import pkg_resources
from slapos.recipe.librecipe import BaseSlapRecipe
class SheepDogTestBed(BaseSlapRecipe):
def _install(self):
self.parameter_dict = self.computer_partition.getInstanceParameterDict()
software_type = self.parameter_dict.get('slap_software_type', 'default')
if software_type is None or software_type == 'RootSoftwareInstance':
software_type = 'default'
if "run_%s" % software_type in dir(self) and \
callable(getattr(self, "run_%s" % software_type)):
return getattr(self, "run_%s" % software_type)()
else:
raise NotImplementedError("Do not support %s" % software_type)
def run_default(self):
return self.run_sheepdog_test()
def run_sheepdog_test(self):
""" Launch sheepdog test process. """
sheepdog_test_config = {}
sheepdog_test_config.update(self.options)
sheepdog_test_config.update(self.parameter_dict)
sheepdog_test_config['address'] = self.getGlobalIPv6Address()
sheepdog_test_config['report_path'] = self.log_directory
if 'nb_server_max' not in sheepdog_test_config:
sheepdog_test_config['nb_server_max'] = 0
if 'nb_tester_max' not in sheepdog_test_config:
sheepdog_test_config['nb_tester_max'] = 3
if 'nb_thread' not in sheepdog_test_config:
sheepdog_test_config['nb_thread'] = 1
if 'nb_request' not in sheepdog_test_config:
sheepdog_test_config['nb_request'] = 1000
sheepdog_test_config['software_release_url'] = self.software_release_url
sheepdog_test_config['server_url'] = self.server_url
sheepdog_test_config['key_file'] = self.key_file
sheepdog_test_config['cert_file'] = self.cert_file
sheepdog_test_config['computer_id'] = self.computer_id
sheepdog_test_config['computer_partition_id'] = self.computer_partition_id
sheepdog_test_config['plugin_name'] = 'sheepdog'
sheepdog_test_connection = {}
sheepdog_test_connection['url'] = "http://["+sheepdog_test_config['address']+"]:5000/"
self.computer_partition.setConnectionDict(sheepdog_test_connection)
nosqltester_manager_wrapper_template_location = pkg_resources.resource_filename(
__name__, os.path.join(
'template', 'nosqltester_manager_run.in'))
nosqltester_manager_runner_path = self.createRunningWrapper("sheepdog_test_manager",
self.substituteTemplate(nosqltester_manager_wrapper_template_location, sheepdog_test_config))
return [nosqltester_manager_runner_path]
def run_sheepdog_tester(self):
""" Runs the sheepdog tester. """
tester_config = {}
tester_config.update(self.options)
tester_config.update(self.parameter_dict)
tester_config['tester_address'] = self.getGlobalIPv6Address()
tester_config['report_path'] = self.log_directory
tester_config['binary'] = tester_config['sheepstrike_binary'] + \
" -t " + \
tester_config['nb_thread'] + " " + \
tester_config['nb_request'] #" 1000" " -t 32 1024000"
tester_connection = {}
tester_connection['start_url'] = "http://%s:5000/start" % tester_config['tester_address']
self.computer_partition.setConnectionDict(tester_connection)
tester_wrapper_template_location = pkg_resources.resource_filename(
__name__, os.path.join(
'template', 'nosqltester_run.in'))
tester_runner_path = self.createRunningWrapper("nosqltester",
self.substituteTemplate(tester_wrapper_template_location, tester_config))
return [tester_runner_path]
#!/bin/sh
# BEWARE: This file is operated by slapos node
# BEWARE: It will be overwritten automatically
exec %(nosqltester_manager_binary)s -a %(address)s -r %(report_path)s -s %(nb_server_max)s -t %(nb_tester_max)s %(software_release_url)s %(server_url)s "%(key_file)s" "%(cert_file)s" %(computer_id)s %(computer_partition_id)s %(plugin_name)s
#!/bin/sh
# BEWARE: This file is operated by slapos node
# BEWARE: It will be overwritten automatically
exec %(nosqltester_binary)s -h %(host_address)s -a %(tester_address)s -r %(report_path)s -b "%(binary)s"
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
# #
############################################################################## ##############################################################################
import logging
from zc.buildout.buildout import Buildout, MissingOption, MissingSection from zc.buildout.buildout import Buildout, MissingOption, MissingSection
from zc.buildout import UserError from zc.buildout import UserError
...@@ -67,6 +68,7 @@ class SubBuildout(Buildout): ...@@ -67,6 +68,7 @@ class SubBuildout(Buildout):
class Recipe: class Recipe:
def __init__(self, buildout, name, options): def __init__(self, buildout, name, options):
self.logger = logging.getLogger(name)
self.buildout = buildout self.buildout = buildout
self.options = options self.options = options
self.name = name self.name = name
...@@ -79,7 +81,19 @@ class Recipe: ...@@ -79,7 +81,19 @@ class Recipe:
try: try:
section, key = self.options[self.software_type].split(":") section, key = self.options[self.software_type].split(":")
except MissingOption: except MissingOption:
raise MissingOption("This software type (%s) isn't mapped. RootSoftwareInstance " # backward compatibility with previous default
if self.software_type == "RootSoftwareInstance":
self.software_type = "default"
try:
section, key = self.options[self.software_type].split(":")
self.logger.info("The software_type 'RootSoftwareInstance' is "
"deprecated. We used 'default' instead. Please change the "
"software_type of your instance to 'default'.")
except MissingOption:
raise MissingOption("The software type 'RootSoftwareInstance' isn't mapped. "
"We even tried 'default' but it isn't mapped either.")
else:
raise MissingOption("This software type (%s) isn't mapped. 'default' "
"is the default software type." % self.software_type) "is the default software type." % self.software_type)
except ValueError: except ValueError:
raise UserError("The software types in the section [%s] must be separated " raise UserError("The software types in the section [%s] must be separated "
......
##############################################################################
#
# Copyright (c) 2011 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from slapos.recipe.librecipe import GenericBaseRecipe
import os
class Recipe(GenericBaseRecipe):
"""
ZEO instance configuration.
wrapper-path -- location of the init script to generate
binary-path -- location of the runzeo command
ip -- ip of the zeo server
port -- port of the zeo server
log-path -- location of the log file
pid-path -- location of the pid file
conf-path -- location of the configuration file
zodb-path -- location of the zodb directory (which contains all storage)
storage -- string with list of all resquested storage
Example: event_module person_module
"""
def install(self):
snippet_filename = self.getTemplateFilename(
'zeo-filestorage-snippet.conf.in')
# Prepare all filestorages
filestorage_snippet = ""
storage = self.options['storage']
if isinstance(storage, str):
for storage_definition in storage.splitlines():
storage_definition = storage_definition.strip()
if not storage_definition:
continue
for q in storage_definition.split():
if 'storage-name' in q:
storage_name = q.split('=')[1].strip()
if 'zodb-path' in q:
zodb_path = q.split('=')[1].strip()
filestorage_snippet += self.substituteTemplate(
snippet_filename, dict(storage_name=storage_name, path=zodb_path))
else:
for storage_name, path in storage:
filestorage_snippet += self.substituteTemplate(snippet_filename,
{'storage_name': storage_name, 'path': path})
config = dict(
zeo_ip=self.options['ip'],
zeo_port=self.options['port'],
zeo_event_log=self.options['log-path'],
zeo_pid=self.options['pid-path'],
zeo_filestorage_snippet=filestorage_snippet,
)
# Create configuration file
template_filename = self.getTemplateFilename('zeo.conf.in')
configuration_path = self.createFile(
self.options['conf-path'],
self.substituteTemplate(template_filename, config))
# Create running wrapper
wrapper_path = self.createWrapper(
self.options['wrapper-path'],
(self.options['binary-path'].strip(),
'-C', self.options['conf-path']))
return [configuration_path, wrapper_path]
<filestorage %(storage_name)s>
path %(path)s
# pack-gc false
</filestorage>
# ZEO configuration file generated by SlapOS
<zeo>
address %(zeo_ip)s:%(zeo_port)s
pid-filename %(zeo_pid)s
</zeo>
%(zeo_filestorage_snippet)s
<eventlog>
<logfile>
dateformat
path %(zeo_event_log)s
</logfile>
</eventlog>
...@@ -39,7 +39,7 @@ class RecipeTestMixin(object): ...@@ -39,7 +39,7 @@ class RecipeTestMixin(object):
'No parameter to return to main instance.Be careful about that...'), 'No parameter to return to main instance.Be careful about that...'),
) )
self.request_instance.assert_called_with( self.request_instance.assert_called_with(
'', 'RootSoftwareInstance', '', filter_kw={}, '', 'default', '', filter_kw={},
partition_parameter_kw=self.called_partition_parameter_kw, partition_parameter_kw=self.called_partition_parameter_kw,
shared=False, state='started') shared=False, state='started')
...@@ -53,7 +53,7 @@ class RecipeTestMixin(object): ...@@ -53,7 +53,7 @@ class RecipeTestMixin(object):
self.recipe(self.buildout, "request", options) self.recipe(self.buildout, "request", options)
log.check() log.check()
self.request_instance.assert_called_with( self.request_instance.assert_called_with(
'', 'RootSoftwareInstance', '', filter_kw={}, '', 'default', '', filter_kw={},
partition_parameter_kw=self.called_partition_parameter_kw, partition_parameter_kw=self.called_partition_parameter_kw,
shared=False, state='started') shared=False, state='started')
...@@ -69,7 +69,7 @@ class RecipeTestMixin(object): ...@@ -69,7 +69,7 @@ class RecipeTestMixin(object):
self.assertRaises(KeyError, recipe.install) self.assertRaises(KeyError, recipe.install)
self.assertEqual(options['connection-anything'], '') self.assertEqual(options['connection-anything'], '')
self.request_instance.assert_called_with( self.request_instance.assert_called_with(
'', 'RootSoftwareInstance', '', filter_kw={}, '', 'default', '', filter_kw={},
partition_parameter_kw=self.called_partition_parameter_kw, partition_parameter_kw=self.called_partition_parameter_kw,
shared=False, state='started') shared=False, state='started')
...@@ -85,7 +85,7 @@ class RecipeTestMixin(object): ...@@ -85,7 +85,7 @@ class RecipeTestMixin(object):
self.assertEqual(options['connection-anything'], 'done') self.assertEqual(options['connection-anything'], 'done')
self.assertIsInstance(options['connection-anything'], str) self.assertIsInstance(options['connection-anything'], str)
self.request_instance.assert_called_with( self.request_instance.assert_called_with(
'', 'RootSoftwareInstance', '', filter_kw={}, '', 'default', '', filter_kw={},
partition_parameter_kw=self.called_partition_parameter_kw, partition_parameter_kw=self.called_partition_parameter_kw,
shared=False, state='started') shared=False, state='started')
...@@ -100,7 +100,7 @@ class RecipeTestMixin(object): ...@@ -100,7 +100,7 @@ class RecipeTestMixin(object):
self.recipe(self.buildout, "request", options) self.recipe(self.buildout, "request", options)
log.check() log.check()
self.request_instance.assert_called_with( self.request_instance.assert_called_with(
'', 'RootSoftwareInstance', '', filter_kw={}, '', 'default', '', filter_kw={},
partition_parameter_kw=self.called_partition_parameter_kw, partition_parameter_kw=self.called_partition_parameter_kw,
shared=False, state='stopped') shared=False, state='stopped')
...@@ -115,7 +115,7 @@ class RecipeTestMixin(object): ...@@ -115,7 +115,7 @@ class RecipeTestMixin(object):
self.recipe(self.buildout, "request", options) self.recipe(self.buildout, "request", options)
log.check() log.check()
self.request_instance.assert_called_with( self.request_instance.assert_called_with(
'', 'RootSoftwareInstance', '', filter_kw={}, '', 'default', '', filter_kw={},
partition_parameter_kw=self.called_partition_parameter_kw, partition_parameter_kw=self.called_partition_parameter_kw,
shared=False, state='started') shared=False, state='started')
......
from unittest.mock import MagicMock
import unittest
from slapos.recipe import switch_softwaretype
import zc.buildout.testing
from zc.buildout.buildout import MissingOption, MissingSection
class SwitchSoftwaretypeTest(unittest.TestCase):
def setUp(self):
self.buildout = buildout = zc.buildout.testing.Buildout()
buildout['slap-configuration'] = {
'slap-software-type': 'type1'
}
buildout['switch-softwaretype'] = {
'recipe': 'slapos.cookbook:switch-softwaretype',
'default': 'instance-default:output',
'type1': 'instance-type1:output',
'type2': 'instance-type2:output'
}
buildout['instance-default'] = {
'recipe': 'slapos.recipe.template:jinja2',
'output': 'instance-default.cfg'
}
buildout['instance-type1'] = {
'recipe': 'slapos.recipe.template:jinja2',
'output': 'instance-type1.cfg'
}
self.magick_sub_buildout = switch_softwaretype.SubBuildout = MagicMock()
def install_recipe(self):
switch_softwaretype.Recipe(
self.buildout,
'switch-softwaretype',
self.buildout['switch-softwaretype'],
).install()
def test_correct_type(self):
self.install_recipe()
self.magick_sub_buildout.assert_called_once()
self.assertIn('instance-type1.cfg', self.magick_sub_buildout.call_args.args)
def test_type_section_not_present(self):
self.buildout['slap-configuration']['slap-software-type'] = 'type2'
with self.assertRaises(MissingSection) as cm:
self.install_recipe()
self.magick_sub_buildout.assert_not_called()
self.assertEqual('instance-type2', cm.exception.args[0])
def test_type_not_present(self):
self.buildout['slap-configuration']['slap-software-type'] = 'type3'
with self.assertRaises(MissingOption) as cm:
self.install_recipe()
self.magick_sub_buildout.assert_not_called()
self.assertIn("This software type (type3) isn't mapped", cm.exception.args[0])
def test_fallback_default(self):
self.buildout['slap-configuration']['slap-software-type'] = 'RootSoftwareInstance'
with self.assertLogs('switch-softwaretype', level='INFO') as lc:
self.install_recipe()
self.magick_sub_buildout.assert_called_once()
self.assertIn("The software_type 'RootSoftwareInstance' is deprecated", lc.output[0])
self.assertIn('instance-default.cfg', self.magick_sub_buildout.call_args.args)
...@@ -125,6 +125,7 @@ ...@@ -125,6 +125,7 @@
"patternProperties": { "patternProperties": {
"^[a-zA-Z0-9_-]+$": { "^[a-zA-Z0-9_-]+$": {
"default": {}, "default": {},
"additionalProperties": false,
"properties": { "properties": {
"webdav": { "webdav": {
"description": "Serve webdav queries, implies timerserver-interval=0 (disabled)", "description": "Serve webdav queries, implies timerserver-interval=0 (disabled)",
......
...@@ -86,6 +86,11 @@ class TestOrderBuildPackingListSimulation( ...@@ -86,6 +86,11 @@ class TestOrderBuildPackingListSimulation(
"port-base": 2200 "port-base": 2200
}, },
}, },
"family-override": {
"default": {
"xml-rpc": True
}
}
}) })
} }
......
...@@ -107,6 +107,10 @@ class TheiaTestCase(SlapOSInstanceTestCase): ...@@ -107,6 +107,10 @@ class TheiaTestCase(SlapOSInstanceTestCase):
class TestTheia(TheiaTestCase): class TestTheia(TheiaTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {"autorun": "user-controlled"} # we interact with slapos in this test
def setUp(self): def setUp(self):
self.connection_parameters = self.computer_partition.getConnectionParameterDict() self.connection_parameters = self.computer_partition.getConnectionParameterDict()
......
...@@ -226,6 +226,7 @@ context = ...@@ -226,6 +226,7 @@ context =
key template_postfix_master_cf template-postfix-master-cf:target key template_postfix_master_cf template-postfix-master-cf:target
key instance_wcfs_cfg_in instance-wcfs.cfg.in:target key instance_wcfs_cfg_in instance-wcfs.cfg.in:target
key template_zeo template-zeo:target key template_zeo template-zeo:target
key template_zeo_conf template-zeo-conf:target
key template_zodb_base template-zodb-base:target key template_zodb_base template-zodb-base:target
key template_zope template-zope:target key template_zope template-zope:target
key template_zope_conf template-zope-conf:target key template_zope_conf template-zope-conf:target
...@@ -245,6 +246,9 @@ context = ...@@ -245,6 +246,9 @@ context =
[template-zeo] [template-zeo]
<= download-base <= download-base
[template-zeo-conf]
<= download-base
[template-zodb-base] [template-zodb-base]
<= download-base <= download-base
......
...@@ -70,7 +70,7 @@ md5sum = b95084ae9eed95a68eada45e28ef0c04 ...@@ -70,7 +70,7 @@ md5sum = b95084ae9eed95a68eada45e28ef0c04
[template] [template]
filename = instance.cfg.in filename = instance.cfg.in
md5sum = ca0cb83950dd9079cc289891cce08e76 md5sum = b15425c6e37314c499ad4c0dd52a8212
[template-erp5] [template-erp5]
filename = instance-erp5.cfg.in filename = instance-erp5.cfg.in
...@@ -78,7 +78,11 @@ md5sum = d6f7d2fa1bde019892897c767f93e089 ...@@ -78,7 +78,11 @@ md5sum = d6f7d2fa1bde019892897c767f93e089
[template-zeo] [template-zeo]
filename = instance-zeo.cfg.in filename = instance-zeo.cfg.in
md5sum = a9d42d8b2aee3c329913d46e0e3cd108 md5sum = 3190fb6b2380ffbef40db62e1d4ba4d0
[template-zeo-conf]
filename = zeo.conf.in
md5sum = 9e15886206c5deda35542c98acb42e70
[template-zodb-base] [template-zodb-base]
filename = instance-zodb-base.cfg.in filename = instance-zodb-base.cfg.in
......
...@@ -8,14 +8,6 @@ ...@@ -8,14 +8,6 @@
{% set default_backup_path = buildout_directory ~ '/srv/backup/zodb' -%} {% set default_backup_path = buildout_directory ~ '/srv/backup/zodb' -%}
{% set bin_directory = parameter_dict['buildout-bin-directory'] -%} {% set bin_directory = parameter_dict['buildout-bin-directory'] -%}
[zeo-base]
recipe = slapos.cookbook:zeo
log-path = ${directory:log}/${:base-name}.log
pid-path = ${directory:run}/${:base-name}.pid
conf-path = ${directory:etc}/${:base-name}.conf
wrapper-path = ${directory:services}/${:base-name}
binary-path = {{ bin_directory }}/runzeo
ip = {{ ipv4 }}
{% set known_tid_storage_identifier_dict = {} -%} {% set known_tid_storage_identifier_dict = {} -%}
{% set zodb_dict = {} -%} {% set zodb_dict = {} -%}
...@@ -41,12 +33,33 @@ ip = {{ ipv4 }} ...@@ -41,12 +33,33 @@ ip = {{ ipv4 }}
{% endfor -%} {% endfor -%}
{% set zeo_section_name = 'zeo-' ~ family %} {% set zeo_section_name = 'zeo-' ~ family %}
[{{ zeo_section_name }}] [{{ zeo_section_name ~ "-base" }}]
< = zeo-base
base-name = zeo-{{ family }} base-name = zeo-{{ family }}
log-path = ${directory:log}/${:base-name}.log
pid-path = ${directory:run}/${:base-name}.pid
ip = {{ ipv4 }}
port = {{ current_port }} port = {{ current_port }}
storage = {{ dumps(storage_list) }} storage = {{ dumps(storage_list) }}
[{{ zeo_section_name ~ "-conf" }}]
<= {{ zeo_section_name ~ "-base" }}
recipe = slapos.recipe.template:jinja2
url = {{ parameter_dict['zeo-conf-template'] }}
output = ${directory:etc}/${:base-name}.conf
context =
section parameter_dict ${:_buildout_section_name_}
[{{ zeo_section_name }}]
<= {{ zeo_section_name ~ "-base" }}
recipe = slapos.cookbook:wrapper
base-name = {{ "${" ~ zeo_section_name ~"-conf:base-name}" }}
log-path = {{ "${" ~ zeo_section_name ~"-conf:log-path}" }}
wrapper-path = ${directory:services}/${:base-name}
command-line = {{ bin_directory }}/runzeo -C {{ "${" ~ zeo_section_name ~"-conf:output}" }}
environment =
TMPDIR=${directory:tmp}
TMP=${directory:tmp}
[{{ section("logrotate-" ~ zeo_section_name) }}] [{{ section("logrotate-" ~ zeo_section_name) }}]
< = logrotate-entry-base < = logrotate-entry-base
name = {{ "${" ~ zeo_section_name ~ ":base-name}" }} name = {{ "${" ~ zeo_section_name ~ ":base-name}" }}
...@@ -196,6 +209,7 @@ srv = ${buildout:directory}/srv ...@@ -196,6 +209,7 @@ srv = ${buildout:directory}/srv
var = ${buildout:directory}/var var = ${buildout:directory}/var
log = ${:var}/log log = ${:var}/log
run = ${:var}/run run = ${:var}/run
tmp = ${buildout:directory}/tmp
backup-zodb = {{ default_backup_path }} backup-zodb = {{ default_backup_path }}
zodb = {{ default_zodb_path }} zodb = {{ default_zodb_path }}
tidstorage = {{ tidstorage_repozo_path }} tidstorage = {{ tidstorage_repozo_path }}
......
...@@ -102,6 +102,7 @@ import-list = ...@@ -102,6 +102,7 @@ import-list =
[dynamic-template-zeo-parameters] [dynamic-template-zeo-parameters]
<= default-dynamic-template-parameters <= default-dynamic-template-parameters
zeo-conf-template = {{ template_zeo_conf }}
[dynamic-template-zeo] [dynamic-template-zeo]
<= jinja2-template-base <= jinja2-template-base
......
<zeo>
address {{ parameter_dict['ip'] }}:{{ parameter_dict['port'] }}
pid-filename {{ parameter_dict['pid-path'] }}
</zeo>
{% for (storage_name, storage_path) in parameter_dict['storage'] -%}
<filestorage {{ storage_name }}>
path {{ storage_path }}
# pack-gc false
</filestorage>
{% endfor %}
<eventlog>
<logfile>
dateformat
path {{ parameter_dict['log-path'] }}
</logfile>
</eventlog>
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