[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:switch-softwaretype
default = $${:runner}
resilient = instance-resilient:rendered
runner = instance-base-runner:rendered
runner-import = template-runner-import:rendered
runner-export = template-runner-export:rendered

frozen = instance-frozen:rendered
pull-backup = template-pull-backup:rendered

# BBB
RootSoftwareInstance = $${:default}

[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
          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
mode = 0644

[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
  key slapparameter_dict slap-configuration:configuration
  raw software_release_bin ${buildout:bin-directory}
  raw backup_wait_time ${exporter-default-configuration:backup_wait_time}
  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_bin_folder ${rsync:location}/bin

[template-runner-import]
recipe = slapos.recipe.template:jinja2
template = ${instance-runner-import:target}
rendered = $${buildout:directory}/instance-runner-import.cfg
mode = 640
context =
  key pbsready_import_template_path template-pbsready-import:rendered
  key template_runner_path instance-base-runner:rendered
  key slapparameter_dict slap-configuration:configuration
  raw software_release_bin ${buildout:bin-directory}
  raw importer_script_path ${template-runner-import-script:location}/${template-runner-import-script:filename}
  raw buildout_executable_location ${buildout:executable}
  raw bash_executable_location ${bash:location}/bin/bash
  raw sqlite3_executable_location ${sqlite3:location}/bin/sqlite3
  raw rsync_executable_location ${rsync:location}/bin/rsync
  raw software_release_information_template ${template-resilient-software-release-information:destination}/${template-resilient-software-release-information:filename}

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