Fix inconsistencies in clients

This commit is contained in:
Dmitry Shulyak 2015-11-11 14:58:26 +02:00
parent 9cf2b89e41
commit ba1c720285
4 changed files with 23 additions and 18 deletions

View File

@ -189,7 +189,7 @@ class DGroup(object):
('type', 'depends_on'),
('state', 'success'),
('parent_action', RoleData.name + '{{index}}.run'),
('child_action', t.name + '{{index}}.run')])
('depend_action', t.name + '{{index}}.run')])
for dep in set(inner):
if dep in self.filtered:
@ -199,7 +199,7 @@ class DGroup(object):
('type', 'depends_on'),
('state', 'success'),
('parent_action', dep + '{{index}}.run'),
('child_action', t.name + '{{index}}.run')])
('depend_action', t.name + '{{index}}.run')])
for dep in set(outer):
if dep in self.filtered:
continue
@ -316,6 +316,9 @@ def g2vr(groups, c):
inner_preds = []
outer_preds = []
for p in dg.predecessors(t):
if dg.node[p]['t'].type != 'puppet':
continue
if p in dsub:
inner_preds.append(p)
else:

View File

@ -20,10 +20,13 @@ class NailgunSource(object):
def roles(self, roles):
return []
def master(self):
return 'master', ''
class DumbSource(object):
def nodes(self, uids):
ip_mask = '10.0.0.%'
ip_mask = '10.0.0.%s'
return [(uid, ip_mask % uid, 1) for uid in uids]
def roles(self, uid):
@ -34,37 +37,36 @@ class DumbSource(object):
source = DumbSource()
@click.command()
@click.parameter('uids', nargs=-1)
@main.command()
@click.argument('uids', nargs=-1)
def nodes(uids):
master = source.master()
vr.create('master', 'f2s/vrs/fuel_node',
vr.create('master', 'f2s/vrs/fuel_node.yaml',
{'index': master[0], 'ip': master[1]})
for uid, ip, env in source.nodes(uids):
vr.create('fuel_node', 'f2s/vrs/fuel_node',
vr.create('fuel_node', 'f2s/vrs/fuel_node.yaml',
{'index': uid, 'ip': ip})
@click.command()
@click.parameter('uids', nargs=-1)
@main.command()
@click.argument('uids', nargs=-1)
def basic(uids):
master_index = source.master()[0]
other = nodes_data[1:]
vr.create('genkeys', 'f2s/vrs/genkeys', {
vr.create('genkeys', 'f2s/vrs/genkeys.yaml', {
'node': 'node'+master_index,
'index': master_index})
for uid, ip, env in source.nodes(uids):
vr.create('prep', 'f2s/vrs/prep',
vr.create('prep', 'f2s/vrs/prep.yaml',
{'index': uid, 'env': env, 'node': 'node'+uid})
@click.command()
@click.parameter('uids', nargs=-1)
@main.command()
@click.argument('uids', nargs=-1)
def roles(uids):
for uid, ip, env in source.nodes(uids):
role = source.roles(uid)
vr.create(role, 'f2s/vrs/'+role,
vr.create(role, 'f2s/vrs/'+role +'.yml',
{'index': uid, 'env': env, 'node': 'node'+uid})

View File

@ -37,8 +37,8 @@ events:
- type: depends_on
state: success
parent_action: sources{{index}}.run
child_action: role_data{{index}}.run
depend_action: role_data{{index}}.run
- type: depends_on
state: success
parent_action: managed_apt_{{index}}.run
child_action: role_data{{index}}.run
depend_action: role_data{{index}}.run

View File

@ -53,7 +53,7 @@ class InputsFieldWrp(IndexFieldWrp):
# XXX: it could be worth to precalculate it
if ':' in name:
name = name.split(":", 1)[0]
schema = resource.meta_inputs[name]['schema']
schema = resource.meta_inputs[name].get('schema', None)
if isinstance(schema, self._simple_types):
return InputTypes.simple
if isinstance(schema, list):