From 5fa2abf6fc1a9aadae114e8fe752a046a0a7003b Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Fri, 13 Apr 2012 11:37:24 +0200
Subject: [PATCH] Stop using slap-network-information section.

---
 software/erp5/instance-tidstorage.cfg.in | 18 ++++++++++++------
 software/erp5/instance.cfg.in            |  2 ++
 software/erp5/software.cfg               |  4 ++--
 3 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/software/erp5/instance-tidstorage.cfg.in b/software/erp5/instance-tidstorage.cfg.in
index a8433b803..4dc200800 100644
--- a/software/erp5/instance-tidstorage.cfg.in
+++ b/software/erp5/instance-tidstorage.cfg.in
@@ -10,6 +10,12 @@ Note: all port counters are pre-incremented. No idea why base port is skipped.
 {% set json = json_module.loads(slapparameter_dict['json']) -%}
 {% set bin_directory = parameter_dict['buildout-bin-directory'] -%}
 {#
+XXX: This template only supports exactly one IPv4 and one IPv6 per
+partition. No more (undefined result), no less (IndexError).
+-#}
+{% set ipv4 = (ipv4_set | list)[0] -%}
+{% set ipv6 = (ipv6_set | list)[0] -%}
+{#
 BBB: erp5-ca['state'] has been configured as string by mistake. Keep this for
 backward compatibility with existing automatically setup CAs.
 -#}
@@ -251,7 +257,7 @@ bt5-repository-url = ${slap-parameter:bt5-repository-url}
 #############################
 [zeo-instance-entry-common]
 recipe = slapos.cookbook:zeo
-ip = ${slap-network-information:local-ipv4}
+ip = {{ ipv4 }}
 binary-path = {{ bin_directory }}/runzeo
 
 {% for zeo_id, zeo_configuration_list in json['zeo'].iteritems() -%}
@@ -300,7 +306,7 @@ recipe = slapos.cookbook:generic.zope.zeo.client
 # availability in software's eggs
 products = {{ parameter_dict['products'] }}
 user = zope
-ip = ${slap-network-information:local-ipv4}
+ip = {{ ipv4 }}
 deadlock-path = /manage_debug_threads
 timezone = {{ json['timezone'] }}
 zeo-connection-string =
@@ -369,7 +375,7 @@ site-id = {{ site_id }}
 [{{ section(section_name) }}]
 recipe = slapos.cookbook:apache.zope.backend
 backend = http://${haproxy-{{ backend_name }}:ip}:${haproxy-{{ backend_name }}:port}
-ip = ${slap-network-information:global-ipv6}
+ip = {{ ipv6 }}
 port = {{ current_apache_port }}
 scheme = http
 wrapper = ${basedirectory:services}/apache-public-{{ backend_name }}
@@ -398,7 +404,7 @@ post = {{ bin_directory }}/killpidfromfile ${apache-public-{{ backend_name }}:pi
 [{{ section(section_name) }}]
 recipe = slapos.cookbook:apache.zope.backend
 backend = http://${haproxy-{{ backend_name }}:ip}:${haproxy-{{ backend_name }}:port}
-ip = ${slap-network-information:global-ipv6}
+ip = {{ ipv6 }}
 port = {{ current_apache_port - 1 }}
 wrapper = ${rootdirectory:bin}/apache-{{ backend_name }}
 scheme = https
@@ -437,7 +443,7 @@ post = {{ bin_directory }}/killpidfromfile ${apache-{{ backend_name }}:pid-file}
 recipe = slapos.cookbook:haproxy
 name = {{ backend_name }}
 conf-path = ${rootdirectory:etc}/haproxy-{{ backend_name }}.cfg
-ip = ${slap-network-information:local-ipv4}
+ip = {{ ipv4 }}
 port = {{ current_haproxy_port }}
 maxconn = {{ backend_configuration['maxconn'] }}
 server-check-path = /{{ site_id }}/getId
@@ -459,7 +465,7 @@ recipe = slapos.cookbook:tidstorage
 known-tid-storage-identifier-dict = {{ known_tid_storage_identifier_dict }}
 base-url = http://${zope-admin:ip}:${zope-admin:port}/%s/serialize
 configuration-path = ${rootdirectory:etc}/tidstorage.py
-ip = ${slap-network-information:local-ipv4}
+ip = {{ ipv4 }}
 port = 6001
 timestamp-file-path = ${directory:tidstorage}/repozo_tidstorage_timestamp.log
 logfile-name = ${basedirectory:log}/tidstorage.log
diff --git a/software/erp5/instance.cfg.in b/software/erp5/instance.cfg.in
index 24f2b8fad..41b7511b6 100644
--- a/software/erp5/instance.cfg.in
+++ b/software/erp5/instance.cfg.in
@@ -61,6 +61,8 @@ extra-context =
     raw zeo_port_base 15000
     raw haproxy_port_base 11000
     raw apache_port_base 10000
+    key ipv4_set slap-parameters:ipv4
+    key ipv6_set slap-parameters:ipv6
 # Must match the key id in [switch-softwaretype] which uses this section.
     raw software_type tidstorage
 
diff --git a/software/erp5/software.cfg b/software/erp5/software.cfg
index cf2f252ec..ac99def23 100644
--- a/software/erp5/software.cfg
+++ b/software/erp5/software.cfg
@@ -132,7 +132,7 @@ extra-context =
 [template-tidstorage]
 recipe = slapos.recipe.build:download
 url = ${:_profile_base_location_}/instance-tidstorage.cfg.in
-md5sum = eeea27e691d80c1dd605ad99cfbba3c3
+md5sum = 520cf89a9b495a474519ac3402fed170
 mode = 640
 
 [template-cloudooo]
@@ -149,7 +149,7 @@ configurator_bt5_list = erp5_core_proxy_field_legacy erp5_full_text_myisam_catal
 # XXX: "template.cfg" is hardcoded in instanciation recipe
 filename = template.cfg
 template = ${:_profile_base_location_}/instance.cfg.in
-md5sum = 19a9d18674848128bb358eceff728a1d
+md5sum = f776aaa2c1b686841acf4c8b8192a782
 extra-context =
     key apache_location apache:location
     key aspell_location aspell:location
-- 
2.30.9