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,18 +31,21 @@ from slapos.recipe.librecipe import GenericSlapRecipe ...@@ -31,18 +31,21 @@ 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)
extends += set(self.buildout[name].get('-extends', '').split()) - done
def _install(self):
publish_dict = {}
for name in self._extend_set:
for k, v in self.buildout[name].iteritems(): for k, v in self.buildout[name].iteritems():
if k[:1] == '-': if k != 'recipe' and not k.startswith('-'):
if k == '-extends':
extends += set(v.split()) - done
elif k != 'recipe':
publish_dict[k] = v 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