Commit 7ece1a48 authored by Julien Muchembled's avatar Julien Muchembled

New recipe 'switch-softwaretype' deprecating 'softwaretype'

The inline recipe for ERP5 has been improved and converted into recipe,
which is reused for NEO.

Templates are instanciated only if they're used, so no need anymore to
wrap them with:

  {% if slap_software_type == software_type -%}
  ...
  {% endif %}
parent 6f11404d
......@@ -189,12 +189,13 @@ setup(name=name,
'slapmonitor = slapos.recipe.slapmonitor:MonitorRecipe',
'slapmonitor-xml = slapos.recipe.slapmonitor:MonitorXMLRecipe',
'slapreport = slapos.recipe.slapreport:Recipe',
'softwaretype = slapos.recipe.softwaretype:Recipe',
'softwaretype = slapos.recipe.softwaretype:Recipe', # BBB
'sphinx= slapos.recipe.sphinx:Recipe',
'squid = slapos.recipe.squid:Recipe',
'sshkeys_authority = slapos.recipe.sshkeys_authority:Recipe',
'sshkeys_authority.request = slapos.recipe.sshkeys_authority:Request',
'stunnel = slapos.recipe.stunnel:Recipe',
'switch-softwaretype = slapos.recipe.switch_softwaretype:Recipe',
'symbolic.link = slapos.recipe.symbolic_link:Recipe',
'tidstorage = slapos.recipe.tidstorage:Recipe',
'trac = slapos.recipe.trac:Recipe',
......
##############################################################################
#
# Copyright (c) 2014 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 advised 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
import os, subprocess, sys
class Recipe:
def __init__(self, buildout, name, options):
self.buildout = buildout
self.options = options
self.name = name
self.software_type = buildout["slap-configuration"]["slap-software-type"]
section, key = self.options[self.software_type].split(":")
self.base = self.buildout[section][key]
def install(self):
# XXX-Antoine: We gotta find a better way to do this. I tried to check
# out how slapgrid-cp was running buildout. But it is worse than that.
args = sys.argv[:]
for x in self.buildout["slap-connection"].iteritems():
args.append("slap-connection:%s=%s" % x)
for x in "directory", "eggs-directory", "develop-eggs-directory":
args.append("buildout:%s=%s" % (x, self.buildout["buildout"][x]))
args.append("buildout:installed=.installed-%s.cfg" % self.name)
# Options.get (from zc.buildout) should deserialize.
try:
override = self.options["override"][self.software_type]
except (KeyError, TypeError):
buildout = self.base
else:
# unfortunately, buildout:extends does not work when given at command line
buildout = os.path.join(self.buildout["buildout"]["parts-directory"],
self.name + ".cfg")
with open(override) as src, open(buildout, "w", 0) as dst:
dst.write("[buildout]\nextends = %s\n\n" % self.base + src.read())
subprocess.check_call(args + ["-oc", buildout])
return []
update = install
{% if slap_software_type not in (
mysql_storage_software_type,
admin_software_type,
) -%}
{% macro section(name) %}{% do part_list.append(name) %}{{ name }}{% endmacro -%}
{% set part_list = [] -%}
{% set master_list = [] -%}
......@@ -73,12 +69,9 @@ name = {{ section_id }}
{% endfor -%}
[buildout]
parts =
parts =
{{ part_list | join('\n\t') }}
publish
eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
offline = true
[all-masters]
addresses = {% for master in master_list -%}
......@@ -91,4 +84,3 @@ addresses = {% for admin in admin_list -%}
{{ '${' + admin + ':connection-admin}' -}}
{% if not loop.last %} {% endif -%}
{% endfor %}
{% endif -%}
[buildout]
parts =
neo-admin-run-wrapper
neo-admin-promise
eggs-directory = {{eggs_directory}}
develop-eggs-directory = {{develop_eggs_directory}}
offline = true
[neo-admin]
recipe = slapos.cookbook:neoppod.admin
binary = {{bin_directory}}/neoadmin
wrapper = ${directory:bin}/neoadmin
wrapper = ${directory:run}/neoadmin
logfile = ${directory:log}/neoadmin.log
ip = ${publish:ip}
port = ${publish:port}
cluster = ${slap-parameter:cluster}
masters = ${slap-parameter:masters}
cluster = {{ dumps(slapparameter_dict['cluster']) }}
masters = {{ dumps(slapparameter_dict['masters']) }}
[publish]
recipe = slapos.cookbook:publish
# TODO: make port a partition parameter
# TODO: stop using slap-network-information
ip = [${slap-network-information:global-ipv6}]
ip = {{ (ipv4_set | list)[0] }}
port = 10002
admin = ${:ip}:${:port}
[neo-admin-run-wrapper]
recipe = slapos.cookbook:symbolic.link
target-directory = ${directory:run}
link-binary = ${neo-admin:wrapper}
[directory]
recipe = slapos.cookbook:mkdirectory
promises = ${buildout:directory}/etc/promises
run = ${buildout:directory}/etc/run
log = ${buildout:directory}/var/log
bin = ${buildout:directory}/bin
[neo-admin-promise]
recipe = slapos.cookbook:check_port_listening
......
[buildout]
parts =
neo-master-run-wrapper
neo-master-promise
eggs-directory = {{eggs_directory}}
develop-eggs-directory = {{develop_eggs_directory}}
offline = true
[neo-master]
recipe = slapos.cookbook:neoppod.master
binary = {{bin_directory}}/neomaster
wrapper = ${directory:bin}/neomaster
wrapper = ${directory:run}/neomaster
logfile = ${directory:log}/neomaster.log
ip = ${publish:ip}
port = ${publish:port}
cluster = ${slap-parameter:cluster}
partitions = ${slap-parameter:partitions}
replicas = ${slap-parameter:replicas}
masters = ${slap-parameter:masters}
cluster = {{ dumps(slapparameter_dict['cluster']) }}
partitions = {{ dumps(slapparameter_dict.get('partitions', 12)) }}
replicas = {{ dumps(slapparameter_dict.get('replicas', 0)) }}
# "masters" parameter is not provided when just requesting a partition.
# No actuall installation takes place at that time
# (slapos.cookbook:neoppod.master raises), but cfg expansion must succeed. So
# this default value is required.
masters = {{ dumps(slapparameter_dict.get('masters', '')) }}
[publish]
recipe = slapos.cookbook:publish
# TODO: make port a partition parameter
# TODO: stop using slap-network-information
ip = [${slap-network-information:global-ipv6}]
ip = {{ (ipv4_set | list)[0] }}
port = 10000
master = ${:ip}:${:port}
[neo-master-run-wrapper]
recipe = slapos.cookbook:symbolic.link
target-directory = ${directory:run}
link-binary = ${neo-master:wrapper}
[directory]
recipe = slapos.cookbook:mkdirectory
promises = ${buildout:directory}/etc/promises
run = ${buildout:directory}/etc/run
log = ${buildout:directory}/var/log
bin = ${buildout:directory}/bin
[neo-master-promise]
recipe = slapos.cookbook:check_port_listening
hostname = ${neo-master:ip}
port = ${neo-master:port}
path = ${directory:promises}/neo-master-promise
[slap-parameter]
# "masters" parameter is not provided when just requesting a partition.
# No actuall installation takes place at that time
# (slapos.cookbook:neoppod.master raises), but cfg expansion must succeed. So
# this default value is required.
masters =
[buildout]
extends = {{ master_cfg }}
parts += neo-storage-run-wrapper
parts += neo-storage
[mariadb-instance]
recipe = slapos.cookbook:generic.mysql
......@@ -29,21 +29,17 @@ mroonga =
[neo-storage]
recipe = slapos.cookbook:neoppod.storage
binary = {{ bin_directory }}/neostorage
wrapper = ${directory:bin}/neostorage
wrapper = ${directory:etc_run}/neostorage
logfile = ${directory:log}/neostorage.log
ip = [${slap-network-information:global-ipv6}]
cluster = ${slap-parameter:cluster}
masters = ${slap-parameter:masters}
ip = {{ (ipv4_set | list)[0] }}
cluster = {{ dumps(slapparameter_dict['cluster']) }}
masters = {{ dumps(slapparameter_dict.get('masters', '')) }}
database-adapter = MySQL
database-parameters = ${mariadb-instance:user}:${mariadb-instance:password}@${mariadb-instance:database}${mariadb-instance:socket}
wait-database = 60
[neo-storage-run-wrapper]
recipe = slapos.cookbook:symbolic.link
target-directory = ${directory:etc_run}
link-binary = ${neo-storage:wrapper}
[directory]
bin = ${buildout:directory}/bin
etc = ${buildout:directory}/etc
var = ${buildout:directory}/var
etc_run = ${:etc}/run
......
......@@ -4,15 +4,6 @@
parts = switch-softwaretype
eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
offline = true
[slap-connection]
computer-id = ${slap_connection:computer_id}
partition-id = ${slap_connection:partition_id}
server-url = ${slap_connection:server_url}
software-release-url = ${slap_connection:software_release_url}
key-file = ${slap_connection:key_file}
cert-file = ${slap_connection:cert_file}
[slap-configuration]
recipe = slapos.cookbook:slapconfiguration.serialised
......@@ -22,21 +13,42 @@ url = ${slap-connection:server-url}
key = ${slap-connection:key-file}
cert = ${slap-connection:cert-file}
[neo-cluster]
[jinja2-template-base]
recipe = slapos.recipe.template:jinja2
template = {{ cluster }}
rendered = ${buildout:parts-directory}/${:_buildout_section_name_}/cluster.cfg
rendered = ${buildout:parts-directory}/${:_buildout_section_name_}.cfg
extensions = jinja2.ext.do
extra-context =
context =
key eggs_directory buildout:eggs-directory
key develop_eggs_directory buildout:develop-eggs-directory
key slap_software_type slap-configuration:slap-software-type
key ipv4_set slap-configuration:ipv4
raw bin_directory {{ bin_directory }}
key slapparameter_dict slap-configuration:configuration
${:extra-context}
[neo-cluster]
<= jinja2-template-base
template = {{ cluster }}
extra-context =
raw admin_software_type {{ admin_software_type }}
raw mysql_storage_software_type {{ mysql_storage_software_type }}
[neo-admin]
<= jinja2-template-base
template = {{ neo_admin }}
[neo-master]
<= jinja2-template-base
template = {{ neo_master }}
[neo-storage-mysql]
<= jinja2-template-base
template = {{ neo_storage_mysql }}
extra-context =
key master_cfg neo-master:rendered
raw mariadb_location {{ mariadb_location }}
[switch-softwaretype]
recipe = slapos.cookbook:softwaretype
default = ${neo-cluster:rendered}
{{ admin_software_type }} = {{ neo_admin }}
{{ mysql_storage_software_type }} = {{ neo_storage_mysql }}
recipe = slapos.cookbook:switch-softwaretype
override = {{ dumps(override_switch_softwaretype |default) }}
default = neo-cluster:rendered
{{ admin_software_type }} = neo-admin:rendered
{{ mysql_storage_software_type }} = neo-storage-mysql:rendered
......@@ -23,7 +23,7 @@ parts =
mysql-python
neoppod
# NEO instanciation
template-instance
template
[slapos-deps-eggs]
recipe = zc.recipe.egg
......@@ -32,53 +32,39 @@ eggs =
${lxml-python:egg}
#END LXML
[base-template]
recipe = slapos.recipe.template:jinja2
template = ${:_profile_base_location_}/${:filename}.in
rendered = ${buildout:directory}/${:filename}
extensions = jinja2.ext.do
extra-context =
context =
key eggs_directory buildout:eggs-directory
key develop_eggs_directory buildout:develop-eggs-directory
key bin_directory buildout:bin-directory
${:extra-context}
[cluster]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/${:_buildout_section_name_}.cfg.in
md5sum = 84cba584198a26289daacb3e6d199e2b
[template-neo-master]
< = base-template
filename = instance-neo-master.cfg
md5sum = 8947620b15535b95163c11a0efab546e
[instance-neo-admin]
< = cluster
md5sum = d9213500262acd61f0bb8e840b9af18b
[template-neo-storage-mysql]
< = base-template
filename = instance-neo-storage-mysql.cfg
md5sum = 518c8c41ce73f0b608fbb1c3b889ca1b
extra-context =
key mariadb_location mariadb:location
key master_cfg template-neo-master:rendered
[instance-neo-master]
< = cluster
md5sum = 00e2a270d6d4e15b77e2e651ee5e7fa9
[template-neo-admin]
< = base-template
filename = instance-neo-admin.cfg
md5sum = 987f69333c563898cab21455509f8024
[instance-neo-storage-mysql]
< = cluster
md5sum = c9dcaf0f4d45dd9422c39ce6ae87dfb3
[template-cluster]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/cluster.cfg.in
md5sum = 7177d129e171b20044bf435ed549af43
[template-instance]
< = base-template
[template]
recipe = slapos.recipe.template:jinja2
template = ${:_profile_base_location_}/instance.cfg.in
md5sum = 1d427e8aca550efda1635b4ee112f8ac
# XXX: "template.cfg" is hardcoded in instanciation recipe
filename = template.cfg
md5sum = 17e761b371487b55b39da1c39ebb1bb6
extra-context =
key neo_master template-neo-master:rendered
key neo_storage_mysql template-neo-storage-mysql:rendered
key neo_admin template-neo-admin:rendered
key cluster template-cluster:target
rendered = ${buildout:directory}/template.cfg
context =
key eggs_directory buildout:eggs-directory
key develop_eggs_directory buildout:develop-eggs-directory
key bin_directory buildout:bin-directory
key cluster cluster:target
key neo_admin instance-neo-admin:target
key neo_master instance-neo-master:target
key neo_storage_mysql instance-neo-storage-mysql:target
key mariadb_location mariadb:location
[neoppod]
recipe = zc.recipe.egg
eggs = neoppod[admin, master, storage-mysqldb]
eggs = neoppod[admin, ctl, master, storage-importer, storage-mysqldb]
......@@ -159,7 +159,7 @@ context =
[template-mariadb]
< = download-base
filename = instance-mariadb.cfg.in
md5sum = 99a9e71b599def71322c86c0bd02a21e
md5sum = 17c9e0f260c6464493e10582e9239409
link-binary =
${coreutils:location}/bin/basename
${coreutils:location}/bin/cat
......@@ -175,12 +175,12 @@ link-binary =
[template-kumofs]
< = download-base
filename = instance-kumofs.cfg.in
md5sum = fe9a9349c4bad2ba999e9d8bac065ebb
md5sum = 2e3230d57f2cfb3a9783fe808ccce08c
[template-cloudooo]
< = download-base
filename = instance-cloudoo.cfg.in
md5sum = 6d52007d9bdc25ed0c83a49d63d59a18
md5sum = 838e56f46ba749dfc53b8e69e21be008
[template-zope-conf]
< = download-base
......@@ -205,7 +205,7 @@ md5sum = b8d2d9af0c4cab45c8337aeac28d5fae
[template-create-erp5-site]
< = download-base
filename = instance-create-erp5-site.cfg.in
md5sum = 2ce65ad372433ae8e11e30f3191bca68
md5sum = 408fd955a876a1004ed35f578029a7d2
[template-create-erp5-site-real]
< = download-base
......@@ -217,7 +217,7 @@ md5sum = e40e2e39f4941c6372f4357e8589a5cf
# XXX: "template.cfg" is hardcoded in instanciation recipe
filename = template.cfg
template = ${:_profile_base_location_}/instance.cfg.in
md5sum = ffe07d9516691dd57014e5af73b7443e
md5sum = 92398630799f98dd3bffb0f2802d07e3
extra-context =
key mariadb_link_binary template-mariadb:link-binary
key zope_link_binary template-zope:link-binary
......@@ -284,22 +284,22 @@ extra-context =
[template-erp5]
< = download-base
filename = instance-erp5.cfg.in
md5sum = b628da98dbed2f7e46f0de207b4bd228
md5sum = ef382581a0b8f2ad01ffc523a59bfe66
[template-neo]
< = download-base
filename = instance-neo.cfg.in
md5sum = 7735d535aa34dfdc18a776b80bc0ca3d
md5sum = 7dcac2eae332e2def17579888c045320
[template-zeo]
< = download-base
filename = instance-zeo.cfg.in
md5sum = 7bbb690cb2ea38cd2aa84c8a79c50399
md5sum = 9a34fa84f8d0cfc0698ed2527f63aa61
[template-zope]
< = download-base
filename = instance-zope.cfg.in
md5sum = e67bf593eb980761c61f126417c67b0c
md5sum = 91c5b56ba750cc4010bef4845b712861
link-binary =
${aspell:location}/bin/aspell
${coreutils:location}/bin/basename
......@@ -329,7 +329,7 @@ link-binary =
[template-balancer]
< = download-base
filename = instance-balancer.cfg.in
md5sum = 86131104949100316eece4bcae8ee1b8
md5sum = fc13d528e76eb9567925077d5472b285
[template-apache-conf]
< = download-base
......
{% if software_type == slap_software_type -%}
{% set part_list = [] -%}
{% set ssl_parameter_dict = slapparameter_dict.get('ssl', {}) %}
{% macro section(name) %}{% do part_list.append(name) %}{{ name }}{% endmacro -%}
......@@ -213,7 +212,3 @@ parts +=
publish
logrotate-apache
{{ part_list | join('\n ') }}
eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
{% endif %}
{% if software_type == slap_software_type -%}
{% set bin_directory = parameter_dict['buildout-bin-directory'] -%}
{% set use_ipv6 = slapparameter_dict.get('use-ipv6', False) -%}
[buildout]
......@@ -8,8 +7,6 @@ parts =
promise
promise-openoffice
{% if use_ipv6 %}promise-tunnel{% endif %}
eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
[publish-cloudooo-connection-information]
recipe = slapos.cookbook:publish.serialised
......@@ -95,4 +92,3 @@ service = ${:etc}/run
promise = ${:etc}/promise
cloudooo-data = ${:srv}/cloudooo
font = ${:srv}/font
{% endif %}
{% if software_type == slap_software_type -%}
{# To create the script (wrapper) which creates the ERP5Site object, pieces
# of what is published by extended file are required. Because they are not
# available at the time the file you are reading is rendered, and because
......@@ -39,4 +38,3 @@ slapos_promise =
extends = {{ parameter_dict['instance-erp5'] }}
parts +=
instance-create-erp5-site-real-run
{% endif %}
{% if slap_software_type == software_type -%}
{% set frontend_dict = slapparameter_dict.get('frontend', {}) %}
{% set has_frontend = frontend_dict.get('software-url', '') != '' -%}
{% set site_id = slapparameter_dict.get('site-id', 'erp5') -%}
......@@ -222,6 +221,3 @@ hosts-dict = {{ '${' ~ zope_address_list_id_dict.keys()[0] ~ ':connection-hosts-
[buildout]
parts = publish
eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
{% endif %}
{% if software_type == slap_software_type -%}
{% set use_ipv6 = slapparameter_dict.get('use-ipv6', False) -%}
[buildout]
parts =
......@@ -13,9 +12,6 @@ parts =
promise-kumofs-gateway
promise-kumofs-manager
eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
[publish-kumofs-connection-information]
recipe = slapos.cookbook:publish.serialised
{% if use_ipv6 -%}
......@@ -156,4 +152,3 @@ port = ${kumofs-instance:gateway-port}
<= promise-template
path = ${basedirectory:promise}/kumofs-manager
port = ${kumofs-instance:manager-port}
{% endif %}
{% if software_type == slap_software_type -%}
{% set part_list = [] -%}
{% macro section(name) %}{% do part_list.append(name) %}{{ name }}{% endmacro -%}
{% set use_ipv6 = slapparameter_dict.get('use-ipv6', False) -%}
......@@ -229,7 +228,3 @@ parts +=
mysqld
promise
{{ part_list | join('\n ') }}
eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
{% endif %}
{% if software_type == slap_software_type -%}
{% set zodb_dict = {} -%}
{% for export_id, mountpoint_dict in slapparameter_dict['zodb-dict'].items() -%}
{% do zodb_dict.__setitem__(export_id, [
......@@ -15,6 +14,3 @@ zodb-dict = {{ dumps(zodb_dict) }}
[buildout]
parts +=
publish
eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
{% endif %}
{% if software_type == slap_software_type -%}
{% set use_ipv6 = slapparameter_dict.get('use-ipv6', False) -%}
{% set next_port = slapparameter_dict['tcpv4-port'] -%}
{% set part_list = [] -%}
......@@ -232,6 +231,3 @@ extends =
parts +=
{{ part_list | join('\n ') }}
publish
eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
{% endif %}
{% if slap_software_type == software_type -%}
{% set use_ipv6 = slapparameter_dict.get('use-ipv6', False) -%}
{% set next_port = slapparameter_dict['port-base'] -%}
{% set site_id = slapparameter_dict['site-id'] -%}
......@@ -362,8 +361,6 @@ bt5 = {{ dumps(slapparameter_dict['bt5']) }}
bt5-repository-url = {{ dumps(slapparameter_dict['bt5-repository-url']) }}
[buildout]
eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
extends =
{{ parameter_dict['instance-logrotate-cfg'] }}
parts +=
......@@ -374,4 +371,3 @@ versions = versions
[versions]
slapos.core = {{ slapos_core_version }}
{% endif %}
[buildout]
parts =
switch-softwaretype
parts = switch-softwaretype
eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
......@@ -20,9 +18,6 @@ extra-context =
context =
key ipv4_set slap-configuration:ipv4
key ipv6_set slap-configuration:ipv6
key eggs_directory buildout:eggs-directory
key develop_eggs_directory buildout:develop-eggs-directory
key slap_software_type slap-configuration:slap-software-type
key slapparameter_dict slap-configuration:configuration
key computer_id slap-configuration:computer
raw slapos_core_version {{ slapos_core_version }}
......@@ -59,8 +54,7 @@ template = {{ template_cloudooo }}
filename = instance-cloudoo.cfg
extra-context =
section parameter_dict dynamic-template-cloudooo-parameters
# Must match the key id in [switch-softwaretype] which uses this section.
raw software_type cloudooo
[dynamic-template-erp5-parameters]
local-bt5-repository = {{ local_bt5_repository }}
......@@ -71,17 +65,6 @@ filename = instance-erp5.cfg
extensions = jinja2.ext.do
extra-context =
key local_bt5_repository dynamic-template-erp5-parameters:local-bt5-repository
# Must match the key id in [switch-softwaretype] which uses this section.
key software_type :software-type
software-type = default
[dynamic-template-erp5-RootSoftwareInstance]
< = dynamic-template-erp5
software-type = RootSoftwareInstance
[dynamic-template-erp5-create-erp5-site]
< = dynamic-template-erp5
software-type = create-erp5-site
[dynamic-template-balancer-parameters]
apache = {{ apache_location }}
......@@ -101,17 +84,12 @@ extensions = jinja2.ext.do
filename = instance-balancer.cfg
extra-context =
section parameter_dict dynamic-template-balancer-parameters
# Must match the key id in [switch-softwaretype] which uses this section.
raw software_type balancer
[dynamic-template-neo]
< = jinja2-template-base
template = {{ template_neo }}
filename = instance-neo.cfg
extensions = jinja2.ext.do
extra-context =
# Must match the key id in [switch-softwaretype] which uses this section.
raw software_type zodb-neo
[dynamic-template-zeo-parameters]
buildout-bin-directory = {{ buildout_bin_directory }}
......@@ -129,8 +107,6 @@ extra-context =
key buildout_directory buildout:directory
section parameter_dict dynamic-template-zeo-parameters
import json_module json
# Must match the key id in [switch-softwaretype] which uses this section.
raw software_type zodb-zeo
[dynamic-template-zope-parameters]
bin-directory = {{ bin_directory }}
......@@ -153,13 +129,6 @@ extra-context =
key buildout_directory buildout:directory
section parameter_dict dynamic-template-zope-parameters
import urlparse urlparse
# Must match the key id in [switch-softwaretype] which uses this section.
key software_type :software-type
software-type = zope
[dynamic-template-cluster-zope]
< = dynamic-template-zope
software-type = cluster-zope
[dynamic-template-kumofs-parameters]
dash-location = {{ dash_location }}
......@@ -174,8 +143,6 @@ template = {{ template_kumofs }}
filename = instance-kumofs.cfg
extra-context =
section parameter_dict dynamic-template-kumofs-parameters
# Must match the key id in [switch-softwaretype] which uses this section.
raw software_type kumofs
[dynamic-template-mariadb-parameters]
coreutils-location = {{ coreutils_location }}
......@@ -197,11 +164,9 @@ filename = instance-mariadb.cfg
extensions = jinja2.ext.do
extra-context =
section parameter_dict dynamic-template-mariadb-parameters
# Must match the key id in [switch-softwaretype] which uses this section.
raw software_type mariadb
[dynamic-template-create-erp5-site-parameters]
instance-erp5 = ${dynamic-template-erp5-create-erp5-site:rendered}
instance-erp5 = ${dynamic-template-erp5:rendered}
template-create-erp5-site-real = {{ template_create_erp5_site_real }}
dash-location = {{ dash_location }}
curl-location = {{ curl_location }}
......@@ -212,45 +177,20 @@ template = {{ template_create_erp5_site }}
filename = instance-create-erp5-site.cfg
extra-context =
section parameter_dict dynamic-template-create-erp5-site-parameters
# Must match the key id in [switch-softwaretype] which uses this section.
raw software_type create-erp5-site
[switch-softwaretype]
recipe = slapos.recipe.build
script =
import subprocess, sys
software_type = self.buildout["slap-configuration"]["slap-software-type"]
# XXX-Antoine: We gotta find a better way to do this. I tried to check
# out how slapgrid-cp was running buildout. But it is worse than that.
args = sys.argv[:]
args += map("slap-connection:%%s=%%s".__mod__,
self.buildout["slap-connection"].iteritems())
args += ("buildout:directory=${buildout:directory}",
"buildout:installed=.installed-${:_buildout_section_name_}.cfg")
buildout = self.options[software_type]
# Options.get (from zc.buildout) should deserialize.
try: override = open(self.options["override"][software_type]).read()
except (KeyError, TypeError): pass
else: \
override = "[buildout]\nextends = %%s\n\n" %% buildout + override; \
buildout = "${buildout:parts-directory}/${:_buildout_section_name_}.cfg"; \
open(buildout, "w", 0).write(override)
subprocess.check_call(args + ["-oc", buildout])
update_script = ${:script}
slapos_promise =
slapos_update_promise = ${:slapos_promise}
recipe = slapos.cookbook:switch-softwaretype
override = {{ dumps(override_switch_softwaretype |default) }}
# Public software types
default = ${dynamic-template-erp5:rendered}
create-erp5-site = ${dynamic-template-create-erp5-site:rendered}
# BBB: Legacy software types, aliased to "default"
RootSoftwareInstance = ${dynamic-template-erp5-RootSoftwareInstance:rendered}
default = dynamic-template-erp5:rendered
create-erp5-site = dynamic-template-create-erp5-site:rendered
RootSoftwareInstance = ${:default} # BBB
# Internal software types
kumofs = ${dynamic-template-kumofs:rendered}
cloudooo = ${dynamic-template-cloudooo:rendered}
mariadb = ${dynamic-template-mariadb:rendered}
balancer = ${dynamic-template-balancer:rendered}
zodb-neo = ${dynamic-template-neo:rendered}
zodb-zeo = ${dynamic-template-zeo:rendered}
zope = ${dynamic-template-zope:rendered}
kumofs = dynamic-template-kumofs:rendered
cloudooo = dynamic-template-cloudooo:rendered
mariadb = dynamic-template-mariadb:rendered
balancer = dynamic-template-balancer:rendered
zodb-neo = dynamic-template-neo:rendered
zodb-zeo = dynamic-template-zeo:rendered
zope = dynamic-template-zope:rendered
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