[buildout]
parts =
  switch_softwaretype

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

[switch_softwaretype]
recipe = slapos.cookbook:switch-softwaretype
default = instance-base-monitor:rendered
edgetest = instance-base-edgetest:rendered
edgebot = instance-base-edgebot:rendered
edgetest-basic = instance-edgetest-basic:rendered
RootSoftwareInstance = $${:default}

[instance-base-monitor]
recipe = slapos.recipe.template:jinja2
template = ${template-monitor:target}
rendered = $${buildout:directory}/template-base-monitor.cfg
extensions = jinja2.ext.do
context = key develop_eggs_directory buildout:develop-eggs-directory
          key eggs_directory buildout:eggs-directory
          key slapparameter_dict slap-configuration:configuration
          section slap_configuration slap-configuration
          raw buildout_bin ${buildout:bin-directory}
          raw monitor_template_output ${monitor-template:output}
          raw network_benck_cfg_output ${network-bench-cfg:output}
          raw monitor_collect_csv_dump ${monitor-collect-csv-dump:target}
mode = 0644

[instance-template]
recipe = slapos.recipe.template:jinja2
extensions = jinja2.ext.do
rendered = $${buildout:directory}/$${:_buildout_section_name_}.cfg
context =
  import json_module json
  import hashlib_module hashlib
  key develop_eggs_directory buildout:develop-eggs-directory
  key eggs_directory buildout:eggs-directory
  key slapparameter_dict slap-configuration:configuration
  key slap_software_type slap-configuration:slap-software-type
  key instance_base_monitor instance-base-monitor:rendered
  raw buildout_bin ${buildout:bin-directory}
  $${:extra-context}
mode = 0644

[surykatka]
binary = ${buildout:bin-directory}/${surykatka:script-name}
ini = ${template-surykatka-ini:target}

[instance-edgetest-basic]
<= instance-template
template = ${template-monitor-edgetest-basic:target}
extra-context =
  raw software_type edgetest-basic
  key template_surykatka_ini surykatka:ini
  key surykatka_binary surykatka:binary

[instance-base-edgetest]
recipe = slapos.recipe.template:jinja2
template = ${template-monitor-edgetest:target}
rendered = $${buildout:directory}/template-monitor-base-edgetest.cfg
extensions = jinja2.ext.do
context = import json_module json
          import hashlib_module hashlib
          key develop_eggs_directory buildout:develop-eggs-directory
          key eggs_directory buildout:eggs-directory
          key slapparameter_dict slap-configuration:configuration
          key slap_software_type slap-configuration:slap-software-type
          section slap_configuration slap-configuration
          raw software_type edgetest
          key instance_base_monitor instance-base-monitor:rendered
          key slave_instance_list slap-configuration:slave-instance-list
          raw buildout_bin ${buildout:bin-directory}
          raw template_json_edgetest_test ${json-test-template:target}
mode = 0644

[instance-base-edgebot]
recipe = slapos.recipe.template:jinja2
template = ${template-monitor-edgebot:target}
rendered = $${buildout:directory}/template-monitor-edgebot.cfg
extensions = jinja2.ext.do

context = import json_module json
          import hashlib_module hashlib
          key develop_eggs_directory buildout:develop-eggs-directory
          key eggs_directory buildout:eggs-directory
          section slap_configuration slap-configuration
          key slapparameter_dict slap-configuration:configuration
          key slap_software_type slap-configuration:slap-software-type
          raw software_type edgebot
          key surykatka_binary surykatka:binary
          key template_surykatka_ini surykatka:ini
          raw buildout_bin ${buildout:bin-directory}
          raw monitor_template_output ${monitor-template:output}
          raw monitor_collect_csv_dump ${monitor-collect-csv-dump:target}
mode = 0644


[slap-configuration]
recipe = slapos.cookbook:slapconfiguration.serialised
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}
# Defaults
configuration.nameserver-list =
configuration.check-frontend-ip-list =
# use monitor-base-port to have monitor listening on each instance
# on different port and also on different port than other services
# it makes it possible to instantiate it correctly on signle IP, for
# example in case of webrunner
configuration.monitor-base-port = 9700
