From ba1c7202852cad2ec90c2655f8b46ce345e23ebd Mon Sep 17 00:00:00 2001 From: Dmitry Shulyak Date: Wed, 11 Nov 2015 14:58:26 +0200 Subject: [PATCH] Fix inconsistencies in clients --- f2s/f2s.py | 7 +++++-- f2s/fsclient.py | 28 +++++++++++++++------------- f2s/vrs/prep.yaml | 4 ++-- solar/dblayer/solar_models.py | 2 +- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/f2s/f2s.py b/f2s/f2s.py index 007e7867..331af492 100755 --- a/f2s/f2s.py +++ b/f2s/f2s.py @@ -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: diff --git a/f2s/fsclient.py b/f2s/fsclient.py index e9422a8e..a59658be 100755 --- a/f2s/fsclient.py +++ b/f2s/fsclient.py @@ -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}) diff --git a/f2s/vrs/prep.yaml b/f2s/vrs/prep.yaml index abb8d3ea..09614ea4 100644 --- a/f2s/vrs/prep.yaml +++ b/f2s/vrs/prep.yaml @@ -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 diff --git a/solar/dblayer/solar_models.py b/solar/dblayer/solar_models.py index c6ef5c0f..724c940b 100644 --- a/solar/dblayer/solar_models.py +++ b/solar/dblayer/solar_models.py @@ -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):