move db deletion from main to graph_init

Change-Id: I9df3b8b7a9fbecb5e112e36af7bbcdce9f35c293
This commit is contained in:
Idan Hefetz 2018-06-12 10:14:32 +00:00
parent 12113b1907
commit ad35fd527f
2 changed files with 3 additions and 11 deletions

View File

@ -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())

View File

@ -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,