예제 #1
0
def nova_deps():
    for name in ['nova', 'nova_api', 'nova_sch']:
        r = Resource.from_dict(dict(key=name, name=name))
        r.inputs.add_new('location_id', '1')
        r.save()
    nova = [
        evapi.Dep('nova', 'run', 'success', 'nova_sch', 'run'),
        evapi.React('nova', 'run', 'success', 'nova_api', 'update')]
    nova_api = [
        evapi.React('nova_api', 'update', 'success', 'nova', 'reboot')]
    evapi.add_events('nova', nova)
    evapi.add_events('nova_api', nova_api)
    return {'nova': nova}
예제 #2
0
def test_mandatory_revisit():
    events = {
        'e1': [evapi.Dep('e1', 'run', 'success', 'e2', 'run'),
               evapi.React('e1', 'run', 'success', 'e2', 'start')],
        'e2': [evapi.React('e2', 'start', 'success', 'e2', 'run')]}
    for name in events:
        r = Resource.from_dict(dict(key=name, name=name))
        r.inputs.add_new('location_id', '1')
        r.save()
        evapi.add_events(name, events[name])
    changes_graph = nx.DiGraph()
    changes_graph.add_node('e1.run')
    evapi.build_edges(changes_graph, events)
    assert set(changes_graph.predecessors('e2.run')) == {'e1.run', 'e2.start'}
예제 #3
0
def nova_deps():
    rst = [
        evapi.Dep('nova', 'run', 'success', 'nova_api', 'run'),
        evapi.Dep('nova', 'update', 'success', 'nova_api', 'update'),
        evapi.React('nova', 'update', 'success', 'nova_api', 'update')
    ]
    return {'nova': rst}
예제 #4
0
파일: fsclient.py 프로젝트: Mirantis/f2s
def fuel_data(nobj):
    uid = str(nobj.data['id'])
    env_id = nobj.data['cluster']
    node = resource.load('node{}'.format(uid))
    res = resource.Resource('fuel_data{}'.format(uid),
                            'f2s/fuel_data', {
                                'uid': uid,
                                'env': env_id
                            },
                            tags=['node%s' % nobj.data['id']])
    events = [
        evapi.React(res.name, 'run', 'success', 'pre_deployment_start', 'run'),
        evapi.React(res.name, 'update', 'success', 'pre_deployment_start',
                    'run')
    ]
    evapi.add_events(res.name, events)
    node = resource.load('node{}'.format(uid))
    node.connect(res, {})
예제 #5
0
def test_riak():

    events = {
        'riak_service1': [
            evapi.React('riak_service1', 'run', 'success', 'riak_service2',
                        'run'),
            evapi.React('riak_service1', 'run', 'success',
                        'riak_service3', 'run')
        ],
        'riak_service3': [
            evapi.React('riak_service3', 'join', 'success', 'riak_service1',
                        'commit'),
            evapi.React('riak_service3', 'run', 'success', 'riak_service3',
                        'join')
        ],
        'riak_service2': [
            evapi.React('riak_service2', 'run', 'success', 'riak_service2',
                        'join'),
            evapi.React('riak_service2', 'join', 'success', 'riak_service1',
                        'commit')
        ],
    }
    for name in events:
        res = Resource.from_dict({'key': name, 'name': name})
        res.save()
        res.inputs.add_new('location_id', '1')
        evapi.add_events(name, events[name])

    changes_graph = nx.MultiDiGraph()
    changes_graph.add_node('riak_service1.run')
    evapi.build_edges(changes_graph, events)
    assert set(changes_graph.predecessors('riak_service1.commit')) == {
        'riak_service2.join', 'riak_service3.join'
    }
예제 #6
0
def test_riak():

    events = {
        'riak_service1': [
            evapi.React('riak_service1', 'run', 'success', 'riak_service2',
                        'run'),
            evapi.React('riak_service1', 'run', 'success', 'riak_service3',
                        'run')
        ],
        'riak_service3': [
            evapi.React('riak_service3', 'join', 'success', 'riak_service1',
                        'commit'),
            evapi.React('riak_service3', 'run', 'success', 'riak_service3',
                        'join')
        ],
        'riak_service2': [
            evapi.React('riak_service2', 'run', 'success', 'riak_service2',
                        'join'),
            evapi.React('riak_service2', 'join', 'success', 'riak_service1',
                        'commit')
        ],
    }

    changes_graph = nx.MultiDiGraph()
    changes_graph.add_node('riak_service1.run')
    evapi.build_edges(changes_graph, events)
    assert set(changes_graph.predecessors('riak_service1.commit')) == {
        'riak_service2.join', 'riak_service3.join'
    }