Fixed mismatch base url 26/135326/2
authorYonghee Han <onstudy@samsung.com>
Thu, 22 Jun 2017 01:45:27 +0000 (10:45 +0900)
committerYonghee Han <onstudy@samsung.com>
Fri, 23 Jun 2017 00:07:00 +0000 (09:07 +0900)
problem: download_trbs
solve : download

Add define : RSYNC_DOWNLOAD_BASE_URL
replace from URL_PUBLIC_REPO_BASE to RSYNC_DOWNLOAD_BASE_URL

Change-Id: I4635ff83d187451ff86f274c229e10c7ed85e386

job_rsync_download.py

index 532a384..1905d92 100755 (executable)
@@ -82,10 +82,11 @@ def main():
             content['repo_path'] = content['repo_path'].replace(os.getenv("PATH_REPO_BASE"),"")
  
     rsync_url = os.path.join(os.getenv('RSYNC_SNAPSHOT'), content['repo_path'])
-    #origin_IP = os.getenv('URL_PUBLIC_REPO_BASE').replace("http://", "")
-    origin_IP = re.match(r'.*:\/\/([0-9.:]{1,}).*', os.getenv('URL_PUBLIC_REPO_BASE')).group(1)
-    copy_IP = re.match(r'.*:\/\/([0-9.]{1,}).*', rsync_url).group(1)
-    
+    origin_BASE_URL = os.getenv('URL_PUBLIC_REPO_BASE')
+    copy_BASE_URL = os.getenv('RSYNC_DOWNLOAD_BASE_URL')
+    print 'origin_BASE_URL:%s' %( origin_BASE_URL)
+    print 'copy_BASE_URL:%s' %( copy_BASE_URL)
+
     copy_repo_path = os.path.join(os.getenv('PATH_REPO_COPY'), content['repo_path'])
     origin_repo_path = os.path.join(os.getenv('PATH_REPO_BASE'), content['repo_path'])
 
@@ -103,7 +104,7 @@ def main():
 
     for target_dir in ('builddata/images', 'builddata/reports', 'images'):
         have_regex_file = execute_shell("find %s -name '*' ! -name '*.log' | xargs grep -l '%s' 2>/dev/null" % \
-                                         (os.path.join(copy_repo_path, target_dir), origin_IP) )
+                                         (os.path.join(copy_repo_path, target_dir), origin_BASE_URL) )
         
         if not have_regex_file :
             print "[WARING] Cann't find some files. It's not formal snapshot."
@@ -114,7 +115,7 @@ def main():
             file_info = get_file_info(target_file)
             with open(target_file, 'r') as f:
                 c = f.read()
-                copy_c = c.replace(origin_IP, copy_IP)
+                copy_c = c.replace(origin_BASE_URL, copy_BASE_URL)
 
             if os.path.isfile(target_file):
                 os.unlink(target_file)