Delete data after check the duplicated manifest 24/169224/1
authorYonghee Han <onstudy@samsung.com>
Mon, 5 Feb 2018 05:22:35 +0000 (14:22 +0900)
committerYonghee Han <onstudy@samsung.com>
Mon, 5 Feb 2018 05:22:35 +0000 (14:22 +0900)
Need to delete a data when Trigger rebuild.

Change-Id: I5793c0c2813ea1b0aef813965a91110c7a40e9fb

common/buildmonitor_extention.py

index 45f6599..bbcc2ff 100644 (file)
@@ -482,6 +482,15 @@ class BuildMonitorExtention(object):
         query_data = ( sr_tag, profile, repa_user, comment, repa_decision_db)
         do_query(query, query_data)
 
+    def purge_snapshot_manifest_exist(self, build_project_id):
+
+        if not self.is_connect():
+            return
+
+        query = "DELETE FROM snapshot_manifest WHERE build_project_id = %s"
+        query_data = (build_project_id,)
+        do_query(query, query_data)
+
     def update_project_mgr_log(self, id, error_string):
 
         if not self.is_connect():
@@ -606,6 +615,8 @@ def put_snapshot_manifest(bm_ext, snapshot_name, manifest_items, start_datetime)
     build_project_id = bm_ext.get_build_project_id_for_buildsnapshot(snapshot_name)
     if build_project_id == 0:
         return False
+    #Delete data after check
+    bm_ext.purge_snapshot_manifest_exist(build_project_id)
 
     manifest_data = []
     # getid from git_repository