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'])
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."
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)