From 909fe8a1bb2486e836ce915d4388b96db2d2f851 Mon Sep 17 00:00:00 2001
From: Rafael Monnerat <rafael@nexedi.com>
Date: Tue, 22 Nov 2016 12:09:10 +0100
Subject: [PATCH] apache-frontend: Few cosmetics to reduce final file size.

---
 .../instance-apache-frontend.cfg                |  6 +++---
 .../templates/apache-custom-slave-list.cfg.in   | 17 ++++++++---------
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/software/apache-frontend/instance-apache-frontend.cfg b/software/apache-frontend/instance-apache-frontend.cfg
index 0a5f93f93..3ae456c69 100644
--- a/software/apache-frontend/instance-apache-frontend.cfg
+++ b/software/apache-frontend/instance-apache-frontend.cfg
@@ -52,9 +52,9 @@ srv = $${buildout:directory}/srv/
 var = $${buildout:directory}/var/
 template = $${buildout:directory}/template/
 
-backup = $${buildout:directory}/srv/backup
-log = $${buildout:directory}/var/log
-run = $${buildout:directory}/var/run
+backup = $${:srv}/backup
+log = $${:var}/log
+run = $${:var}/run
 service = $${:etc}/service
 etc-run = $${:etc}/run
 promise = $${:etc}/promise
diff --git a/software/apache-frontend/templates/apache-custom-slave-list.cfg.in b/software/apache-frontend/templates/apache-custom-slave-list.cfg.in
index a5744bc76..f92f4674d 100644
--- a/software/apache-frontend/templates/apache-custom-slave-list.cfg.in
+++ b/software/apache-frontend/templates/apache-custom-slave-list.cfg.in
@@ -13,6 +13,7 @@
 {% endif -%}
 [jinja2-template-base]
 recipe = slapos.recipe.template:jinja2
+extensions = jinja2.ext.do
 extra-context =
 context =
     key eggs_directory buildout:eggs-directory
@@ -184,6 +185,10 @@ cert-content = {{ dumps(slave_instance.get('ssl_crt')) }}
 {%     set apache_custom_https = ((slave_instance.pop('apache_custom_https', '')) % slave_parameter_dict) -%}
 apache_custom_http = {{ dumps(apache_custom_http) }}
 apache_custom_https = {{ dumps(apache_custom_https) }}
+{{ '\n' }}
+{%     for key, value in slave_instance.iteritems() -%}
+{{ key }} = {{ dumps(value) }}
+{%     endfor %}
 
 [{{ slave_section_title }}]
 < = jinja2-template-base
@@ -192,22 +197,16 @@ template = {{ template_custom_slave_configuration }}
 {%   else %}
 template = {{ template_default_slave_configuration }}
 {%   endif %}
+
 filename = {{ '%s.conf' % slave_reference }}
-rendered = {{ apache_configuration_directory }}/${:filename}
-extensions = jinja2.ext.do
 extra-context =
     raw https_port {{ https_port }}
     raw http_port {{ http_port }}
     section slave_parameter {{ slave_configuration_section_name }}
 {{ '\n' }}
  
-[{{ slave_configuration_section_name }}]
-{%     for key, value in slave_instance.iteritems() -%}
-{{ key }} = {{ dumps(value) }}
-{%     endfor %}
-
-############################
-#### Publish Slave Information
+{# ###############################  #}
+{# Publish Slave Information        #}
 {%   if not extra_slave_instance_list -%}
 {%     set publish_section_title = 'publish-%s-connection-information' % slave_instance.get('slave_reference') -%}
 {%     do part_list.append(publish_section_title) -%}
-- 
2.30.9