From 0026f37b233e0859821ec017cf2d5c2f3efef98a Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Thu, 29 Mar 2012 11:36:40 +0200
Subject: [PATCH] Jinja2-ify instance-erp5-production.cfg .

---
 software/erp5/instance-erp5-production.cfg    | 118 ------------------
 software/erp5/instance-erp5-production.cfg.in | 118 ++++++++++++++++++
 software/erp5/instance.cfg                    |   2 +-
 software/erp5/software.cfg                    |  10 +-
 4 files changed, 124 insertions(+), 124 deletions(-)
 delete mode 100644 software/erp5/instance-erp5-production.cfg
 create mode 100644 software/erp5/instance-erp5-production.cfg.in

diff --git a/software/erp5/instance-erp5-production.cfg b/software/erp5/instance-erp5-production.cfg
deleted file mode 100644
index 50e0c606d..000000000
--- a/software/erp5/instance-erp5-production.cfg
+++ /dev/null
@@ -1,118 +0,0 @@
-#############################
-#
-# Request erp5 production environnment
-#
-#############################
-[buildout]
-
-parts =
-  request-mariadb
-  request-sphinx
-  request-cloudooo
-  request-memcached
-  request-kumofs
-  request-tidstorage
-  basedirectory
-
-eggs-directory = ${buildout:eggs-directory}
-develop-eggs-directory = ${buildout:develop-eggs-directory}
-offline = true
-
-[request-common]
-recipe = slapos.cookbook:request
-software-url = $${slap-connection:software-release-url}
-sla = computer_guid
-return = url
-server-url = $${slap-connection:server-url}
-key-file = $${slap-connection:key-file}
-cert-file = $${slap-connection:cert-file}
-computer-id = $${slap-connection:computer-id}
-partition-id = $${slap-connection:partition-id}
-
-[request-sphinx]
-<=request-common
-name = Sphinx Search Engine
-software-type = sphinx
-sla-computer_guid = $${slap-parameter:sphinx-computer-guid}
-return = url-sphinx url-sphinx-sql
-
-[request-mariadb]
-<=request-common
-name = MariaDB DataBase
-software-type = mariadb
-sla-computer_guid = $${slap-parameter:mariadb-computer-guid}
-
-[request-cloudooo]
-<=request-common
-name = Cloudooo
-config = cloudooo-json
-config-cloudooo-json = $${slap-parameter:cloudooo-json}
-software-type = cloudooo
-sla-computer_guid = $${slap-parameter:cloudooo-computer-guid}
-
-[request-memcached]
-<=request-common
-name = Memcached
-software-type = memcached
-sla-computer_guid = $${slap-parameter:memcached-computer-guid}
-
-[request-kumofs]
-<=request-common
-name = KumoFS
-software-type = kumofs
-sla-computer_guid = $${slap-parameter:kumofs-computer-guid}
-
-[request-tidstorage]
-<=request-common
-name = TidStorage
-return = url-login
-config = json mysql-url memcached-url cloudooo-url kumofs-url sphinx-url-sphinx sphinx-url-sphinx-sql smtp-url bt5 bt5-repository-url
-config-json = $${slap-parameter:json}
-config-mysql-url = $${request-mariadb:connection-url}
-config-memcached-url = $${request-memcached:connection-url}
-config-cloudooo-url = $${request-cloudooo:connection-url}
-config-kumofs-url = $${request-kumofs:connection-url}
-config-sphinx-url-sphinx = $${request-sphinx:connection-url-sphinx}
-config-sphinx-url-sphinx-sql = $${request-sphinx:connection-url-sphinx-sql}
-config-bt5 = $${slap-parameter:bt5}
-config-bt5-repository-url = $${slap-parameter:bt5-repository-url}
-config-smtp-url = $${slap-parameter:smtp-url}
-software-type = tidstorage
-sla-computer_guid = $${slap-parameter:tidstorage-computer-guid}
-
-[request-varnish]
-<=request-common
-name = Varnish
-config = tidstorage-url
-config-tidstorage-url = $${request-tidstorage:connection-url-login}
-config-web-checker-mail-address = $${slap-parameter:web-checker-mail-address}
-config-web-checker-smtp-host = $${slap-parameter:web-checker-smtp-host}
-software-type = varnish
-sla-computer_guid = $${slap-parameter:varnish-computer-guid}
-
-[slap-parameter]
-# Default value if no computer_guid is specified for each type
-sphinx-computer-guid = $${slap-connection:computer-id}
-mariadb-computer-guid = $${slap-connection:computer-id}
-cloudooo-computer-guid = $${slap-connection:computer-id}
-memcached-computer-guid = $${slap-connection:computer-id}
-kumofs-computer-guid = $${slap-connection:computer-id}
-tidstorage-computer-guid = $${slap-connection:computer-id}
-varnish-computer-guid = $${slap-connection:computer-id}
-cloudooo-json =
-bt5 = erp5_full_text_myisam_catalog
-  erp5_configurator_standard
-  erp5_configurator_maxma_demo
-  erp5_configurator_ung
-  erp5_configurator_run_my_doc
-bt5-repository-url = ${local-bt5-repository:list}
-smtp-url = smtp://localhost:25/
-
-# rest of parts are candidates for some generic stuff
-[basedirectory]
-recipe = slapos.cookbook:mkdirectory
-services = $${rootdirectory:etc}/run
-
-[rootdirectory]
-recipe = slapos.cookbook:mkdirectory
-etc = $${buildout:directory}/etc
diff --git a/software/erp5/instance-erp5-production.cfg.in b/software/erp5/instance-erp5-production.cfg.in
new file mode 100644
index 000000000..f6f29c3b2
--- /dev/null
+++ b/software/erp5/instance-erp5-production.cfg.in
@@ -0,0 +1,118 @@
+#############################
+#
+# Request erp5 production environnment
+#
+#############################
+[buildout]
+
+parts =
+  request-mariadb
+  request-sphinx
+  request-cloudooo
+  request-memcached
+  request-kumofs
+  request-tidstorage
+  basedirectory
+
+eggs-directory = {{ eggs_directory }}
+develop-eggs-directory = {{ develop_eggs_directory }}
+offline = true
+
+[request-common]
+recipe = slapos.cookbook:request
+software-url = ${slap-connection:software-release-url}
+sla = computer_guid
+return = url
+server-url = ${slap-connection:server-url}
+key-file = ${slap-connection:key-file}
+cert-file = ${slap-connection:cert-file}
+computer-id = ${slap-connection:computer-id}
+partition-id = ${slap-connection:partition-id}
+
+[request-sphinx]
+<=request-common
+name = Sphinx Search Engine
+software-type = sphinx
+sla-computer_guid = ${slap-parameter:sphinx-computer-guid}
+return = url-sphinx url-sphinx-sql
+
+[request-mariadb]
+<=request-common
+name = MariaDB DataBase
+software-type = mariadb
+sla-computer_guid = ${slap-parameter:mariadb-computer-guid}
+
+[request-cloudooo]
+<=request-common
+name = Cloudooo
+config = cloudooo-json
+config-cloudooo-json = ${slap-parameter:cloudooo-json}
+software-type = cloudooo
+sla-computer_guid = ${slap-parameter:cloudooo-computer-guid}
+
+[request-memcached]
+<=request-common
+name = Memcached
+software-type = memcached
+sla-computer_guid = ${slap-parameter:memcached-computer-guid}
+
+[request-kumofs]
+<=request-common
+name = KumoFS
+software-type = kumofs
+sla-computer_guid = ${slap-parameter:kumofs-computer-guid}
+
+[request-tidstorage]
+<=request-common
+name = TidStorage
+return = url-login
+config = json mysql-url memcached-url cloudooo-url kumofs-url sphinx-url-sphinx sphinx-url-sphinx-sql smtp-url bt5 bt5-repository-url
+config-json = ${slap-parameter:json}
+config-mysql-url = ${request-mariadb:connection-url}
+config-memcached-url = ${request-memcached:connection-url}
+config-cloudooo-url = ${request-cloudooo:connection-url}
+config-kumofs-url = ${request-kumofs:connection-url}
+config-sphinx-url-sphinx = ${request-sphinx:connection-url-sphinx}
+config-sphinx-url-sphinx-sql = ${request-sphinx:connection-url-sphinx-sql}
+config-bt5 = ${slap-parameter:bt5}
+config-bt5-repository-url = ${slap-parameter:bt5-repository-url}
+config-smtp-url = ${slap-parameter:smtp-url}
+software-type = tidstorage
+sla-computer_guid = ${slap-parameter:tidstorage-computer-guid}
+
+[request-varnish]
+<=request-common
+name = Varnish
+config = tidstorage-url
+config-tidstorage-url = ${request-tidstorage:connection-url-login}
+config-web-checker-mail-address = ${slap-parameter:web-checker-mail-address}
+config-web-checker-smtp-host = ${slap-parameter:web-checker-smtp-host}
+software-type = varnish
+sla-computer_guid = ${slap-parameter:varnish-computer-guid}
+
+[slap-parameter]
+# Default value if no computer_guid is specified for each type
+sphinx-computer-guid = ${slap-connection:computer-id}
+mariadb-computer-guid = ${slap-connection:computer-id}
+cloudooo-computer-guid = ${slap-connection:computer-id}
+memcached-computer-guid = ${slap-connection:computer-id}
+kumofs-computer-guid = ${slap-connection:computer-id}
+tidstorage-computer-guid = ${slap-connection:computer-id}
+varnish-computer-guid = ${slap-connection:computer-id}
+cloudooo-json =
+bt5 = erp5_full_text_myisam_catalog
+  erp5_configurator_standard
+  erp5_configurator_maxma_demo
+  erp5_configurator_ung
+  erp5_configurator_run_my_doc
+bt5-repository-url = {{ local_bt5_repository }}
+smtp-url = smtp://localhost:25/
+
+# rest of parts are candidates for some generic stuff
+[basedirectory]
+recipe = slapos.cookbook:mkdirectory
+services = ${rootdirectory:etc}/run
+
+[rootdirectory]
+recipe = slapos.cookbook:mkdirectory
+etc = ${buildout:directory}/etc
diff --git a/software/erp5/instance.cfg b/software/erp5/instance.cfg
index 1591f09c8..ffc8fcc5c 100644
--- a/software/erp5/instance.cfg
+++ b/software/erp5/instance.cfg
@@ -25,7 +25,7 @@ snippet-fontconfig = ${template-snippet-fontconfig:output}
 [switch-softwaretype]
 recipe = slapos.cookbook:softwaretype
 default = ${template-erp5-development:rendered}
-production = ${template-erp5-production:output}
+production = ${template-erp5-production:rendered}
 kumofs = ${template-kumofs:output}
 memcached = ${template-memcached:rendered}
 cloudooo = $${dynamic-template-cloudooo:output}
diff --git a/software/erp5/software.cfg b/software/erp5/software.cfg
index 4b120799f..e69940fb0 100644
--- a/software/erp5/software.cfg
+++ b/software/erp5/software.cfg
@@ -121,11 +121,11 @@ extra-context =
     key template_zope template-zope:output
 
 [template-erp5-production]
-recipe = slapos.recipe.template
-url = ${:_profile_base_location_}/instance-erp5-production.cfg
-md5sum = 54ad3c5e92af02d0db98d1085adf986d
-output = ${buildout:directory}/template-erp5-production.cfg
-mode = 0644
+< = template-jinja2-base
+filename = instance-erp5-production.cfg
+md5sum = 1b458ff6a9b82f24f29f71b58f559186
+extra-context =
+    key local_bt5_repository local-bt5-repository:list
 
 [template-snippet-zeo]
 recipe = slapos.recipe.template
-- 
2.30.9