[buildout]
parts =
  switch-softwaretype

extends =
  ${template-resilient-templates:output}

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

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

[switch-softwaretype]
recipe = slapos.cookbook:switch-softwaretype
RootSoftwareInstance = $${:default}
default = $${:theia}
theia = theia:rendered
export = export:rendered
import = import:rendered
resilient = resilient:rendered
frozen = instance-frozen:rendered
pull-backup = template-pull-backup:rendered

[theia]
recipe = slapos.recipe.template:jinja2
template = ${instance-theia:output}
rendered = $${buildout:directory}/instance-theia.cfg
mode = 0644
context =
  jsonkey default_parameter_dict :default-parameters
  key parameter_dict slap-configuration:configuration
  key root_title slap-configuration:root-instance-title
  key partition_root_path buildout:directory
  key ipv6_random slap-configuration:ipv6-random
  key ipv4_random slap-configuration:ipv4-random
  import os_module os
  import hashlib_module hashlib
default-parameters =
  {
    "autorun": "running",
    "embedded-sr": null,
    "embedded-sr-type": null,
    "embedded-instance-parameters": null,
    "frontend-name": "Theia Frontend",
    "frontend-sr": "$${:frontend-sr}",
    "frontend-sr-type": "RootSoftwareInstance",
    "frontend-guid": null,
    "additional-frontend-name":"Theia Additional Frontend",
    "additional-frontend-sr": "$${:frontend-sr}",
    "additional-frontend-sr-type": "RootSoftwareInstance",
    "additional-frontend-guid": null,
    "monitor-httpd-port": 8386
  }
frontend-sr = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg

[import]
recipe = slapos.recipe.template:jinja2
template = ${instance-import:output}
rendered = $${buildout:directory}/instance-import.cfg
mode = 0644
context =
  jsonkey default_parameter_dict theia:default-parameters
  key parameter_dict slap-configuration:configuration
  key theia_instance_cfg theia:rendered
  key pbsready_import_cfg template-pbsready-import:rendered
  key root_title slap-configuration:root-instance-title

[export]
recipe = slapos.recipe.template:jinja2
template = ${instance-export:output}
rendered = $${buildout:directory}/instance-export.cfg
mode = 0644
context =
  jsonkey default_parameter_dict theia:default-parameters
  key parameter_dict slap-configuration:configuration
  key theia_instance_cfg theia:rendered
  key pbsready_export_cfg template-pbsready-export:rendered

[resilient]
recipe = slapos.recipe.template:jinja2
template = ${instance-resilient:output}
rendered = $${buildout:directory}/instance-resilient.cfg
mode = 0644
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 monitor_template ${monitor-template:rendered}
template-parts-destination = ${template-parts:target}
template-replicated-destination = ${template-replicated:target}
import-list = file parts :template-parts-destination
              file replicated :template-replicated-destination