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}
def rmq_deps(): """Example of a case when defaults are not good enough. For example we need to run some stuff on first node before two others. """ # NOTE(dshulyak) is it possible to put this create/join logic into # puppet manifest? So that rmq_cluster.2 before joining will check if # cluster already exists? return { 'rmq.1': [evapi.Dep('rmq.1', 'run', 'success', 'rmq_cluster.1', 'create')], 'rmq.2': [evapi.Dep('rmq.2', 'run', 'success', 'rmq_cluster.2', 'join')], 'rmq.3': [evapi.Dep('rmq.3', 'run', 'success', 'rmq_cluster.3', 'join')], 'rmq_cluster.1': [ evapi.Dep('rmq_cluster.1', 'create', 'success', 'rmq_cluster.2', 'join'), evapi.Dep('rmq_cluster.1', 'create', 'success', 'rmq_cluster.3', 'join') ] }
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}
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'}
def events_example(): return [ evapi.Dep('e1', 'run', 'success', 'e2', 'run'), evapi.Dep('e1', 'run', 'success', 'e3', 'run'), evapi.Dep('e1', 'run', 'success', 'e4', 'run'), ]