[buildout]
parts =
  switch-softwaretype

eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true


[switch-softwaretype]
recipe = slapos.cookbook:switch-softwaretype
default = dynamic-powerdns-replicate:output
single-default = dynamic-template-powerdns:output

[jinja2-template-base]
recipe = slapos.recipe.template:jinja2
output = $${buildout:directory}/$${:filename}
extra-context =
context =
    import json_module json
    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 slave_instance_list slap-configuration:slave-instance-list
    $${:extra-context}

[dynamic-template-powerdns]
< = jinja2-template-base
url = ${template-powerdns:output}
filename = instance-powerdns.cfg
extensions = jinja2.ext.do
extra-context =
# Must match the key id in [switch-softwaretype] which uses this section.
    raw software_type single-default

[dynamic-powerdns-replicate]
< = jinja2-template-base
url = ${template-dns-replicate:target}
filename = instance-powerdns-replicate.cfg
extensions = jinja2.ext.do
extra-context =
# Must match the key id in [switch-softwaretype] which uses this section.
# Keep RootSoftwareInstance for backward compatibility until we are sure all
# instances have software_type default
    raw software_type RootSoftwareInstance-default
    raw template_monitor ${monitor2-template:output}

[slap-configuration]
recipe = slapos.cookbook:slapconfiguration
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}
slave-instance-list =
