From ad35fd527f12af650bb8c7f325fa15720cb6cb51 Mon Sep 17 00:00:00 2001 From: Idan Hefetz Date: Tue, 12 Jun 2018 10:14:32 +0000 Subject: [PATCH] move db deletion from main to graph_init Change-Id: I9df3b8b7a9fbecb5e112e36af7bbcdce9f35c293 --- vitrage/cli/graph.py | 11 ----------- vitrage/entity_graph/graph_init.py | 3 +++ 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/vitrage/cli/graph.py b/vitrage/cli/graph.py index 0557312c7..95cd6ddd5 100644 --- a/vitrage/cli/graph.py +++ b/vitrage/cli/graph.py @@ -29,19 +29,8 @@ def main(): conf = service.prepare_service() e_graph = get_graph_driver(conf)('Entity Graph') db_connection = storage.get_connection_from_config(conf) - clear_active_actions_table(db_connection) - VitrageGraphInit(conf, e_graph, db_connection).run() -def clear_active_actions_table(db_connection): - """Delete all data from active_actions table - - The following deletes the entire vitrage database - It should be removed once graph is persistent - """ - db_connection.active_actions.delete() - - if __name__ == "__main__": sys.exit(main()) diff --git a/vitrage/entity_graph/graph_init.py b/vitrage/entity_graph/graph_init.py index 9ec1adbde..cc6f44c4d 100644 --- a/vitrage/entity_graph/graph_init.py +++ b/vitrage/entity_graph/graph_init.py @@ -33,6 +33,7 @@ class VitrageGraphInit(object): def __init__(self, conf, graph, db_connection): self.conf = conf self.graph = graph + self.db = db_connection self.workers = GraphWorkersManager(conf, graph, db_connection) self.events_coordination = EventsCoordination( conf, @@ -44,6 +45,8 @@ class VitrageGraphInit(object): def run(self): LOG.info('Init Started') + LOG.info('clearing database active_actions') + self.db.active_actions.delete() ds_rpc.get_all( ds_rpc.create_rpc_client_instance(self.conf), self.events_coordination,