Commit 8410e09b authored by Julien Muchembled's avatar Julien Muchembled

ERP5: fix autogeneration of internal NEO cluster name

parent dc0a41dc
......@@ -25,7 +25,7 @@
#
##############################################################################
from collections import defaultdict
from collections import OrderedDict
from .librecipe import unwrap, wrap, GenericSlapRecipe
import six
......@@ -66,6 +66,9 @@ class Recipe(GenericSlapRecipe):
the published value 'foo' if it exists. If its __init__ modifies 'x', the new
value is published. To prevent [gen-foo] from being accessed too early, 'x'
is then removed and the value can only be accessed with ${publish-early:foo}.
Init sections are processed in the order of first appearance in the '-init'
section, so that a init section can access a value that is generated by a
previous one (above, [gen-bar] can access ${publish-early:foo}).
Generated values don't end up in the buildout installed file, which is good
if they're secret. Note however that buildout won't detect if values change
......@@ -76,13 +79,16 @@ class Recipe(GenericSlapRecipe):
"""
def __init__(self, buildout, name, options):
GenericSlapRecipe.__init__(self, buildout, name, options)
init = defaultdict(dict)
init = OrderedDict()
for line in options['-init'].splitlines():
if line:
k, v = line.split()
if k not in options:
section, v = v.split(':')
try:
init[section][k] = v
except KeyError:
init[section] = {k: v}
if init:
self.slap.initializeConnection(self.server_url, self.key_file,
self.cert_file)
......@@ -123,7 +129,7 @@ class Recipe(GenericSlapRecipe):
new = {}
for k, v in six.iteritems(init):
try:
publish_dict[k] = new[v] = init_section.pop(v)
options[k] = publish_dict[k] = new[v] = init_section.pop(v)
except KeyError:
pass
if new != override:
......@@ -139,6 +145,5 @@ class Recipe(GenericSlapRecipe):
publish += publish_dict
publish_dict['-publish'] = ' '.join(publish)
volatileOptions(options, list(publish_dict))
options.update(publish_dict)
install = update = lambda self: None
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment