Commit a4f4fc3a authored by Julien Muchembled's avatar Julien Muchembled

NEO: new recipe to fix/optimize propagation of the 'masters' parameter

parent ba6c3331
......@@ -134,6 +134,7 @@ setup(name=name,
'mydumper = slapos.recipe.mydumper:Recipe',
'mysql = slapos.recipe.mysql:Recipe',
'nbdserver = slapos.recipe.nbdserver:Recipe',
'neoppod.cluster = slapos.recipe.neoppod:Cluster',
'neoppod.admin = slapos.recipe.neoppod:Admin',
'neoppod.master = slapos.recipe.neoppod:Master',
'neoppod.storage = slapos.recipe.neoppod:Storage',
......
......@@ -26,8 +26,38 @@
##############################################################################
import os
import shlex
from slapos.recipe.librecipe import GenericBaseRecipe
from zc.buildout import UserError
from .librecipe import GenericBaseRecipe
class Cluster(object):
def __init__(self, buildout, name, options):
self.buildout = buildout
self.options = options
def publish_early(self, publish_dict):
masters = publish_dict.setdefault('masters', '')
result_dict = {
'connection-admin': [],
'connection-master': [],
}
node_list = []
for node in sorted(self.options['nodes'].split()):
node = self.buildout[node]
node_list.append(node)
for k, v in result_dict.iteritems():
x = node[k]
if x:
v.append(x)
publish_dict['admins'] = ' '.join(result_dict.pop('connection-admin'))
x = ' '.join(result_dict.pop('connection-master'))
if masters != x:
publish_dict['masters'] = x
for node in node_list:
node['config-masters'] = x
node.recipe.__init__(self.buildout, node.name, node)
install = update = lambda self: None
class NeoBaseRecipe(GenericBaseRecipe):
......
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