[buildout]
parts =
  switch_softwaretype

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

[switch_softwaretype]
recipe = slapos.cookbook:softwaretype
default = $${instance-base-runner:rendered}
resilient = $${instance-resilient:rendered}
test = $${instance-resilient-test:rendered}
runner = $${instance-base-runner:rendered}
runner-import = ${instance-runner-import:output}
runner-export = ${instance-runner-export:output}

frozen = ${instance-frozen:output}
pull-backup = ${template-pull-backup:output}

[instance-base-runner]
recipe = slapos.recipe.template:jinja2
template = ${template-runner:output}
rendered = $${buildout:directory}/template-runner.cfg
extensions = jinja2.ext.do
context = key buildout buildout:bin-directory
          key develop_eggs_directory buildout:develop-eggs-directory
          key eggs_directory buildout:eggs-directory
          key slapparameter_dict slap-configuration:configuration
          raw curl_executable_location ${curl:location}/bin/curl
          raw dash_executable_location ${dash:location}/bin/dash
          raw dcron_executable_location ${dcron:location}/sbin/crond
mode = 0644

[instance-resilient]
recipe = slapos.recipe.template:jinja2
template = ${template-resilient:target}
rendered = $${buildout:directory}/instance-resilient.cfg
extensions = jinja2.ext.do
context = key buildout buildout:bin-directory
          key develop_eggs_directory buildout:develop-eggs-directory
          key eggs_directory buildout:eggs-directory
          key slapparameter_dict slap-configuration:configuration
template-parts-destination = ${template-parts:destination}
template-replicated-destination = ${template-replicated:destination}
import-list = file parts :template-parts-destination
              file replicated :template-replicated-destination
mode = 0644

[instance-resilient-test]
recipe = slapos.recipe.template:jinja2
template = ${template-resilient-test:location}/instance-resilient-test.cfg.jinja2
rendered = $${buildout:directory}/template-resilient-test.cfg
bin-directory = ${buildout:bin-directory}
context =
    key bin_directory instance-resilient-test:bin-directory
    key develop_eggs_directory buildout:develop-eggs-directory
    key eggs_directory buildout:eggs-directory
    key slapparameter_dict slap-configuration:configuration
mode = 0644

[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}