[buildout]
parts =
  service-fluentd

eggs-directory = {{ buildout['eggs-directory'] }}
develop-eggs-directory = {{ buildout['develop-eggs-directory'] }}
offline = true

[instance-parameter]
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}

[directory]
recipe = slapos.cookbook:mkdirectory
home = ${buildout:directory}
etc = ${:home}/etc
var = ${:home}/var
script = ${:etc}/run/
service = ${:etc}/service
promise = ${:etc}/promise/
log = ${:var}/log
bin = ${:home}/bin

[service-fluentd]
recipe  = slapos.cookbook:wrapper
wrapper-path    = ${directory:service}/fluentd-service
command-line    = {{ fluentd_location }}/bin/fluentd
    -v
    -c ${fluentd-agent-conf:rendered}
environment =
  GEM_PATH={{ fluentd_location }}/lib/ruby/gems/1.8/

[fluentd-agent-conf]
recipe  = slapos.recipe.template:jinja2
template = inline:{% raw -%}
  {{ slapparameter_dict.get('conf_text', '') }}
  {%- endraw %}
rendered = ${directory:etc}/fluentd-agent.conf
mode = 0644
context =
  key slapparameter_dict instance-parameter:configuration
