From b6a8de2fed0a7a0a2bcb11a95551fda1fa463fa8 Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Wed, 26 Mar 2014 16:36:26 +0100
Subject: [PATCH] erp5: Increase parameter validation.

---
 stack/erp5/buildout.cfg         | 2 +-
 stack/erp5/instance-erp5.cfg.in | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/stack/erp5/buildout.cfg b/stack/erp5/buildout.cfg
index de924c600..c7ef35398 100644
--- a/stack/erp5/buildout.cfg
+++ b/stack/erp5/buildout.cfg
@@ -296,7 +296,7 @@ extra-context =
 [template-erp5]
 < = download-base
 filename = instance-erp5.cfg.in
-md5sum = 345f90dcdd74eba01b22c6dd3a5719e1
+md5sum = dcfc083916510848eabd73660397d741
 
 [template-neo]
 < = download-base
diff --git a/stack/erp5/instance-erp5.cfg.in b/stack/erp5/instance-erp5.cfg.in
index 019284f32..0bab0c5ee 100644
--- a/stack/erp5/instance-erp5.cfg.in
+++ b/stack/erp5/instance-erp5.cfg.in
@@ -32,7 +32,7 @@ return = {{ ret.keys() | join(' ') }}
 {%     do publish_dict.__setitem__(name ~ '-' ~ ret, '${' ~ section ~ ':connection-' ~ ret ~ '}')%}
 {%   endif -%}
 {% endfor -%}
-sla-computer_guid = {{ slapparameter_dict.get(config_key + '-computer-guid', computer_id) }}
+sla-computer_guid = {{ dumps(slapparameter_dict.get(config_key + '-computer-guid', computer_id)) }}
 extra-config = {{ ' '.join(config) }}
 {% for option, value in config.items() -%}
 config-{{ option }} = {{ dumps(value) }}
@@ -43,7 +43,9 @@ config-{{ option }} = {{ dumps(value) }}
 {{ request('memcached-volatile', 'kumofs', 'memcached', {'tcpv4-port': 2010, 'ram-storage-size': 64}) }}
 {{ request('cloudooo', 'cloudooo', 'cloudooo', {'tcpv4-port': 2020}) }}
 {{ request('mariadb', 'mariadb', 'mariadb', {'tcpv4-port': 2099}, {'database-list': True, 'test-database-list': True}) }}
-{{ request('zodb', 'zodb-' ~ slapparameter_dict.get('zodb-software-type', 'zeo'), 'zodb', {'tcpv4-port': 2100, 'zodb-dict': {'root': {}}}, {'zodb-storage-type': False, 'zodb-dict': False, 'tidstorage-ip': False, 'tidstorage-port': False}) }}
+{# Fail early if an unexpected value is provided -#}
+{% set possible_software_type_dict = {'zeo': 'zeo', 'neo': 'neo'} -%}
+{{ request('zodb', 'zodb-' ~ possible_software_type_dict[slapparameter_dict.get('zodb-software-type', 'zeo')], 'zodb', {'tcpv4-port': 2100, 'zodb-dict': {'root': {}}}, {'zodb-storage-type': False, 'zodb-dict': False, 'tidstorage-ip': False, 'tidstorage-port': False}) }}
 
 [inituser-password]
 {% set inituser_password = slapparameter_dict.get('inituser-password') -%}
-- 
2.30.9