From 01938ada2fda538c50d1a3ebb729b9ebf1ac304c Mon Sep 17 00:00:00 2001 From: Junghyun Kim Date: Thu, 26 Jan 2017 12:32:45 +0900 Subject: [PATCH] BUGFIX: transform data string from gerrit 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 --- job_buildmonitor.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/job_buildmonitor.py b/job_buildmonitor.py index 492d0c4..647c67b 100644 --- a/job_buildmonitor.py +++ b/job_buildmonitor.py @@ -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") -- 2.7.4