BUGFIX: transform data string from gerrit
authorJunghyun Kim <jh0822.kim@samsung.com>
Thu, 26 Jan 2017 03:32:45 +0000 (12:32 +0900)
committerSoonKyu Park <sk7.park@samsung.com>
Sat, 4 Feb 2017 06:16:25 +0000 (15:16 +0900)
MySQL cannot recognize datetime pattern "2017-01-26 11:29:53 +0900\n",
so we just take first two part "2017-01-26 11:29:53" by split(' ')

Change-Id: I7fcf2d1bc6272fbb7ea67e5000f4233dda26561b
Signed-off-by: Junghyun Kim <jh0822.kim@samsung.com>
job_buildmonitor.py

index 492d0c4..647c67b 100644 (file)
@@ -82,9 +82,16 @@ def bm_connect_db():
 def bm_disconnect_db():
     buildmonitor_db.disconnect_db()
 
+
 #===============================================================================
 # [job_submit.py]
 
+def transform_date(date):
+    # Currently, we just remove timezone part (e.g., '+0900')
+    # Should we consider timezone in the future??
+    dd = date.split(' ')
+    return dd[0]+' '+dd[1]
+
 def sr_submit_for_sr_status(bm_git_tag):
     print '[%s] enter sr_submit_for_sr_status\n' % (__file__)
 
@@ -1737,9 +1744,9 @@ def main():
         print '[%s][Submit]\n' % (__file__)
 
         # get vars
-        commit_date = content.get("commit_date")
+        commit_date = transform_date(content.get("commit_date"))
         commit_msg = content.get("commit_msg")
-        submit_date = content.get("submit_date")
+        submit_date = transform_date(content.get("submit_date"))
         submit_msg = content.get("submit_msg")
         submitter = content.get("submitter")
         git_tag = content.get("git_tag")