Simplify url construct.

This commit is contained in:
Jérémie Courrèges-Anglas 2014-11-20 15:48:29 +01:00
parent 059c94797a
commit 3ede128155

View File

@ -141,10 +141,12 @@ class backup_xva(backup_generic):
filename_temp = filename+".tmp" filename_temp = filename+".tmp"
self.logger.debug("[%s] Copy in progress",self.backup_name) self.logger.debug("[%s] Copy in progress",self.backup_name)
socket.setdefaulttimeout(120) socket.setdefaulttimeout(120)
scheme = "http://"
if self.str2bool(enable_https) == True: if self.str2bool(enable_https) == True:
url = "https://"+user_xen+":"+password_xen+"@"+self.xcphost+"/export?uuid="+session.xenapi.VM.get_uuid(vm) scheme = "https://"
else: url = scheme+user_xen+":"+password_xen+"@"+self.xcphost+"/export?uuid="+session.xenapi.VM.get_uuid(vm)
url = "http://"+user_xen+":"+password_xen+"@"+self.xcphost+"/export?uuid="+session.xenapi.VM.get_uuid(vm)
urllib.urlretrieve(url, filename_temp) urllib.urlretrieve(url, filename_temp)
urllib.urlcleanup() urllib.urlcleanup()