Commit a50c91ef authored by Vincent Pelletier's avatar Vincent Pelletier

publish: Access "-extends"-referenced sections during __init__

Buildout expects all needed sections to have been accessed during the
sectoin initialisation pass. It does not like having them accessed during
the "install" pass, and emits a very cryptic error:
  While:
    Installing publish.
  Error: Missing option: publish-early:__buildout_signature__
parent db9c68f9
...@@ -31,19 +31,22 @@ from slapos.recipe.librecipe import GenericSlapRecipe ...@@ -31,19 +31,22 @@ from slapos.recipe.librecipe import GenericSlapRecipe
CONNECTION_PARAMETER_STRING = 'connection-' CONNECTION_PARAMETER_STRING = 'connection-'
class Recipe(GenericSlapRecipe): class Recipe(GenericSlapRecipe):
def _install(self): def __init__(self, buildout, name, options):
publish_dict = {} super(Recipe, self).__init__(buildout, name, options)
done = set() # Tell buildout about the sections we will access during install.
self._extend_set = done = set()
extends = [self.name] extends = [self.name]
while extends: while extends:
name = extends.pop() name = extends.pop()
done.add(name) done.add(name)
for k, v in self.buildout[name].iteritems(): extends += set(self.buildout[name].get('-extends', '').split()) - done
if k[:1] == '-':
if k == '-extends': def _install(self):
extends += set(v.split()) - done publish_dict = {}
elif k != 'recipe': for name in self._extend_set:
publish_dict[k] = v for k, v in self.buildout[name].iteritems():
if k != 'recipe' and not k.startswith('-'):
publish_dict[k] = v
self._setConnectionDict(publish_dict, self.options.get('-slave-reference')) self._setConnectionDict(publish_dict, self.options.get('-slave-reference'))
return [] return []
......
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