Fix sr sync code 52/168952/1
authorhyokeun <hyokeun.jeon@samsung.com>
Thu, 1 Feb 2018 10:16:12 +0000 (19:16 +0900)
committerhyokeun <hyokeun.jeon@samsung.com>
Thu, 1 Feb 2018 10:16:12 +0000 (19:16 +0900)
Change-Id: I25173109f3a4536d348bc8f6e46f85a05fa69bac

job_ref_create_prj_obs.py

index 3740470..332f350 100644 (file)
@@ -58,9 +58,15 @@ def get_snapshot_sr_increment(src, target):
                             'snapshot.code?start=%s&end=%s&profile_filter=%s'
                              % (start_date, end_date, target.split(':ref:')[0]))
 
+
+        sys.stdout.flush()
+
         snapshot_history = []
         board_data = requests.get(path).text
+
         for line in board_data.replace('\\n', '').replace('\\', '').replace('null','""').split('\n'):
+            if line is None or line == '' or len(line) <= 0:
+                continue
             full_list = ast.literal_eval(line)
             # Make sure ordering
             full_list = sorted(full_list, key=lambda k:k['start_time'], reverse=False)
@@ -79,6 +85,8 @@ def get_snapshot_sr_increment(src, target):
                                                   'snapshot.code?snapshot=%s' % (sn.get('snapshot_name')))
                     srs_in_snapshot = requests.get(path).text
                     for line2 in srs_in_snapshot.replace('\\n', '').replace('\\', '').replace('null','""').split('\n'):
+                        if line2 is None or line2 == '' or line2 == '\n' or len(line2) <= 0:
+                            continue
                         sr_list = ast.literal_eval(line2)
                         for sr in sr_list:
                             sr_count += 1
@@ -702,8 +710,11 @@ class ref_create_project_obs(object):
             # Select matching SR info
             todo_dict_repos = [ todo_dict_latest[x].get('git') for x in todo_dict_latest ]
             tgt = src.split(':%s:' % target.split(':ref:')[0])[0]
+            #FIXME:
+            #request_info = {'source': target.split(':ref:')[0],
+            #                'target': tgt,
             request_info = {'source': target.split(':ref:')[0],
-                            'target': tgt,
+                            'target': os.getenv('SYNC_TARGET_PROJECT'),
                             'project_to_create_timestamp': datetime.utcnow().strftime("%Y%m%d.%H%M%S"),
                             'sr': []}
             request_sr_list = []
@@ -783,7 +794,7 @@ class ref_create_project_obs(object):
             remote_jenkins_build_job(os.getenv('JENKINS_URL_INTERNAL'),
                                      os.getenv('JENKINS_USER'),
                                      os.getenv('JENKINS_PW'),
-                                     'submit-request-sync',
+                                     os.getenv('SR_SYNC_TRIGGER_JOB_NAME'),
                                      None, None, [(fname, fname)])
 
             print '\n\nFinal data to be sync...'