Fixed an issue with imaging status remaining in PMB 15/208415/1
authorYonghee Han <onstudy@samsung.com>
Mon, 24 Jun 2019 06:18:06 +0000 (15:18 +0900)
committerYonghee Han <onstudy@samsung.com>
Mon, 24 Jun 2019 06:18:06 +0000 (15:18 +0900)
Fix build_snapshot to get the last one when there are two id's.

Change-Id: I132fa9f73f3822721312f851dc6dfa9465546138

job_buildmonitor.py

index e9b7130..a1cd07d 100644 (file)
@@ -742,7 +742,7 @@ def end_create_image_for_sr_stage(bm_start_datetime, project, bm_snapshot_name):
         curr_build_project_id = buildmonitor_db.get_value_from_query_data(query, query_data)
 
         # get curr_build_snapshot_id
-        query = "SELECT id FROM build_snapshot WHERE build_project_id = %s"
+        query = "SELECT id FROM build_snapshot WHERE build_project_id = %s ORDER BY id DESC LIMIT 1"
         query_data = (curr_build_project_id,)
         curr_build_snapshot_id = buildmonitor_db.get_value_from_query_data(query, query_data)
         # get multi_build_image_status
@@ -773,7 +773,7 @@ def end_create_image_for_sr_stage(bm_start_datetime, project, bm_snapshot_name):
         print 'post_build_project_id(%s)\n' % (post_build_project_id)
 
         # get curr_build_snapshot_id
-        query = "SELECT id FROM build_snapshot WHERE build_project_id = %s"
+        query = "SELECT id FROM build_snapshot WHERE build_project_id = %s ORDER BY id DESC LIMIT 1"
         query_data = (post_build_project_id,)
         curr_build_snapshot_id = buildmonitor_db.get_value_from_query_data(query, query_data)
         # get multi_build_image_status