[buildout]
parts =
  switch_softwaretype

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

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

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

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:target}
template-replicated-destination = ${template-replicated:target}
import-list = file parts :template-parts-destination
              file replicated :template-replicated-destination
mode = 0644

[template-runner-export-configuration]
coreutils-location = ${coreutils:location}
gawk-location = ${gawk:location}
backup_wait_time = ${exporter-default-configuration:backup_wait_time}

[template-runner-export]
recipe = slapos.recipe.template:jinja2
template = ${instance-runner-export:target}
rendered = $${buildout:directory}/instance-runner-export.cfg
mode = 640
context =
  key pbsready_export_template_path template-pbsready-export:rendered
  key template_runner_path instance-base-runner:rendered
  section parameter_dict template-runner-export-configuration
  raw exporter_script_path ${template-runner-export-script:location}/${template-runner-export-script:filename}
  raw monitor_check_resilient_feed_template_path ${template-monitor-check-resilient-feed:location}/${template-monitor-check-resilient-feed:filename}
  raw buildout_executable_location ${buildout:executable}
  raw bash_executable_location ${bash:location}/bin/bash
  raw rsync_executable_location ${rsync:location}/bin/rsync

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