[buildout]
parts = switch-softwaretype
eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}

[slap-configuration]
recipe = slapos.cookbook:slapconfiguration.serialised
computer = ${slap-connection:computer-id}
partition = ${slap-connection:partition-id}
url = ${slap-connection:server-url}
key = ${slap-connection:key-file}
cert = ${slap-connection:cert-file}

[jinja2-template-base]
recipe = slapos.recipe.template:jinja2
rendered = ${buildout:parts-directory}/${:_buildout_section_name_}/${:filename}
extra-context =
context =
    key ipv4_set slap-configuration:ipv4
    key ipv6_set slap-configuration:ipv6
    key slapparameter_dict slap-configuration:configuration
    key computer_id slap-configuration:computer
    raw slapos_core_version {{ slapos_core_version }}
    raw logrotate_cfg {{ template_logrotate_base }}
    ${:extra-context}

[dynamic-template-cloudooo-parameters]
cups = {{ cups_location }}
dbus = {{ dbus_location }}
dbus-glib = {{ dbus_glib_location }}
file = {{ file_location }}
fontconfig = {{ fontconfig_location }}
freetype = {{ freetype_location }}
glib = {{ glib_location }}
glu = {{ glu_location }}
libICE = {{ libICE_location }}
libSM = {{ libSM_location }}
libX11 = {{ libX11_location }}
libXau = {{ libXau_location }}
libXdmcp = {{ libXdmcp_location }}
libXext = {{ libXext_location }}
libXrender = {{ libXrender_location }}
libexpat = {{ libexpat_location }}
libffi = {{ libffi_location }}
libpng12 = {{ libpng12_location }}
libxcb = {{ libxcb_location }}
mesa = {{ mesa_location }}
xdamage = {{ xdamage_location }}
xfixes = {{ xfixes_location }}
zlib = {{ zlib_location }}
libreoffice-bin = {{ libreoffice_bin_location }}
fonts = {{ fonts_location }}
buildout-bin-directory = {{ buildout_bin_directory }}
6tunnel = {{ sixtunnel_location }}
dash = {{ dash_location }}

[dynamic-template-cloudooo]
< = jinja2-template-base
template = {{ template_cloudooo }}
filename = instance-cloudoo.cfg
extra-context =
    section parameter_dict dynamic-template-cloudooo-parameters

[dynamic-template-erp5-parameters]
local-bt5-repository = {{ local_bt5_repository }}

[dynamic-template-erp5]
< = jinja2-template-base
template = {{ template_erp5 }}
filename = instance-erp5.cfg
extensions = jinja2.ext.do
extra-context =
    key local_bt5_repository dynamic-template-erp5-parameters:local-bt5-repository
    key openssl_location :openssl-location
openssl-location = {{ openssl_location }}

[dynamic-template-balancer-parameters]
apache = {{ apache_location }}
openssl = {{ openssl_location }}
haproxy = {{ haproxy_location }}
bin-directory = {{ bin_directory }}
6tunnel = {{ sixtunnel_location }}
dash = {{ dash_location }}
template-haproxy-cfg = {{ template_haproxy_cfg }}
template-apache-conf = {{ template_apache_conf }}

[dynamic-template-balancer]
< = jinja2-template-base
template = {{ template_balancer }}
extensions = jinja2.ext.do
filename = instance-balancer.cfg
extra-context =
    section parameter_dict dynamic-template-balancer-parameters

[dynamic-template-zeo-parameters]
buildout-bin-directory = {{ buildout_bin_directory }}
6tunnel = {{ sixtunnel_location }}
dash = {{ dash_location }}
findutils-location = {{ findutils_location }}

[dynamic-template-zeo]
< = jinja2-template-base
template = {{ template_zeo }}
filename = instance-zeo.cfg
extensions = jinja2.ext.do
extra-context =
    key buildout_directory buildout:directory
    section parameter_dict dynamic-template-zeo-parameters
    import json_module json

[dynamic-template-zope-parameters]
bin-directory = {{ bin_directory }}
zope-conf-template = {{ template_zope_conf }}
buildout-bin-directory = {{ buildout_bin_directory }}
6tunnel = {{ sixtunnel_location }}
dash = {{ dash_location }}
jsl = {{ jsl_location }}
link-binary = {{ dumps(zope_link_binary) }}
userhosts = {{ userhosts_location }}
runzope-userhosts-preloaded-template = {{ template_runzope_userhosts_preloaded }}

[dynamic-template-zope]
< = jinja2-template-base
template = {{ template_zope }}
filename = instance-zope.cfg
extensions = jinja2.ext.do
extra-context =
    key buildout_directory buildout:directory
    section parameter_dict dynamic-template-zope-parameters
    import urlparse urlparse

[dynamic-template-kumofs-parameters]
dash-location = {{ dash_location }}
dcron-location = {{ dcron_location }}
gzip-location = {{ gzip_location }}
kumo-location = {{ kumo_location }}
logrotate-location = {{ logrotate_location }}

[dynamic-template-kumofs]
< = jinja2-template-base
template = {{ template_kumofs }}
filename = instance-kumofs.cfg
extra-context =
    section parameter_dict dynamic-template-kumofs-parameters

[dynamic-template-mariadb-parameters]
coreutils-location = {{ coreutils_location }}
findutils-location = {{ findutils_location }}
gzip-location = {{ gzip_location }}
mariadb-location = {{ mariadb_location }}
template-my-cnf = {{ template_my_cnf }}
template-mariadb-initial-setup = {{ template_mariadb_initial_setup }}
link-binary = {{ dumps(mariadb_link_binary) }}
bin-directory = {{ bin_directory }}

[dynamic-template-mariadb]
< = jinja2-template-base
template = {{ template_mariadb }}
filename = instance-mariadb.cfg
extensions = jinja2.ext.do
extra-context =
    section parameter_dict dynamic-template-mariadb-parameters

[dynamic-template-create-erp5-site-parameters]
instance-erp5 = ${dynamic-template-erp5:rendered}
template-create-erp5-site-real = {{ template_create_erp5_site_real }}
dash-location = {{ dash_location }}
curl-location = {{ curl_location }}

[dynamic-template-create-erp5-site]
< = jinja2-template-base
template = {{ template_create_erp5_site }}
filename = instance-create-erp5-site.cfg
extra-context =
    section parameter_dict dynamic-template-create-erp5-site-parameters

[switch-softwaretype]
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
RootSoftwareInstance = ${:default}
# 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