TPE-464 Multiple backend selection support 85/160985/1
authorhyokeun <hyokeun.jeon@samsung.com>
Tue, 21 Nov 2017 04:39:22 +0000 (13:39 +0900)
committerhyokeun <hyokeun.jeon@samsung.com>
Tue, 21 Nov 2017 04:39:22 +0000 (13:39 +0900)
Change-Id: I706e0792339f25c9e757a4dbbd1a5228a65ff97c

job_create_snapshot.py
job_pre_release_obs.py
trbs/job_trbs_obs.py

index 0ccfca4..a8b4659 100755 (executable)
@@ -363,10 +363,10 @@ def main():
     # remove unused item
     data.pop('imagedata')
     parm_backend = {}
-    for bknd in ['BACKEND_02', 'BACKEND_01']:
-        if os.getenv('%s_REGEX' % bknd) and \
-            re.search(r'%s' % os.getenv('%s_REGEX' % bknd), data['project']) is not None:
-            parm_backend['BACKEND_SELECTION'] = bknd
+    for bknd in list(reversed(range(1,99))):
+        if os.getenv('BACKEND_%02d_REGEX' % bknd) and \
+            re.search(r'%s' % os.getenv('BACKEND_%02d_REGEX' % bknd), data['project']) is not None:
+            parm_backend['BACKEND_SELECTION'] = 'BACKEND_%02d' % bknd
             break
     trigger_next("post-snapshot", data, extra_params=parm_backend)
 
index 58521a9..25fff70 100755 (executable)
@@ -618,10 +618,10 @@ def main(action):
         # remove unused item
         data.pop('imagedata')
         parm_backend = {}
-        for bknd in ['BACKEND_02', 'BACKEND_01']:
-            if os.getenv('%s_REGEX' % bknd) and \
-                re.search(r'%s' % os.getenv('%s_REGEX' % bknd), data['project']) is not None:
-                parm_backend['BACKEND_SELECTION'] = bknd
+        for bknd in list(reversed(range(1,99))):
+            if os.getenv('BACKEND_%02d_REGEX' % bknd) and \
+                re.search(r'%s' % os.getenv('BACKEND_%02d_REGEX' % bknd), data['project']) is not None:
+                parm_backend['BACKEND_SELECTION'] = 'BACKEND_%02d' % bknd
                 break
         trigger_next("post-snapshot", data, extra_params=parm_backend)
     elif action == 'cleanup':
index 30facf7..15e6b96 100755 (executable)
@@ -388,10 +388,10 @@ def make_repo(project, repo, backenddb, base_url, base_path, live_repo_base, bui
         'build_id': trbs.build_id
     }
     parm_backend = {}
-    for bknd in ['BACKEND_02', 'BACKEND_01']:
-        if os.getenv('%s_REGEX' % bknd) and \
-            re.search(r'%s' % os.getenv('%s_REGEX' % bknd), data['project']) is not None:
-            parm_backend['BACKEND_SELECTION'] = bknd
+    for bknd in list(reversed(range(1,99))):
+        if os.getenv('BACKEND_%02d_REGEX' % bknd) and \
+            re.search(r'%s' % os.getenv('BACKEND_%02d_REGEX' % bknd), data['project']) is not None:
+            parm_backend['BACKEND_SELECTION'] = 'BACKEND_%02d' % bknd
             break
     trigger_next("post-buildlogs", data, extra_params=parm_backend)