@@ -328,16 +328,18 @@ def download_with_http(source, destination, debug):
328328 # Try 2 nearest caches
329329 success = False
330330 start = end = 0
331+ tried_cache = ""
331332 for cache in nearest_cache_list [:2 ]:
333+ tried_cache = cache
332334 # Parse the nearest_cache url, make sure it uses http
333335 # Should really use urlparse, but python3 and python2 urlparse imports are
334336 # very different
335- if nearest_cache .startswith ('root://' ):
336- nearest_cache = nearest_cache .replace ('root://' , 'http://' )
337+ if cache .startswith ('root://' ):
338+ cache = cache .replace ('root://' , 'http://' )
337339
338340 # Append port 8000, which is just a convention for now, not set in stone
339- nearest_cache += ":8000"
340- curl_command = "cd %s; curl %s -L --connect-timeout 30 --speed-limit 1024 %s --fail %s%s" % (dest_dir , output_mode , download_output , nearest_cache , source )
341+ cache += ":8000"
342+ curl_command = "cd %s; curl %s -L --connect-timeout 30 --speed-limit 1024 %s --fail %s%s" % (dest_dir , output_mode , download_output , cache , source )
341343 logging .debug ("About to run curl command: %s" , curl_command )
342344 start = int (time .time ()* 1000 )
343345 command_object = subprocess .Popen ([curl_command ], shell = True )
@@ -359,14 +361,14 @@ def download_with_http(source, destination, debug):
359361 dltime = end - start
360362 destSpace = 1
361363 payload ['timestamp' ]= end
362- payload ['host' ]= nearest_cache
364+ payload ['host' ]= tried_cache
363365 payload ['download_time' ]= dltime
364366 payload ['destination_space' ]= destSpace
365367 payload ['status' ]= status
366368 payload ['tries' ]= 1
367369 payload ['start1' ]= start
368370 payload ['end1' ]= end
369- payload ['cache' ]= nearest_cache
371+ payload ['cache' ]= tried_cache
370372 es_send (payload )
371373 if success :
372374 return 0
0 commit comments