From 3ede1281550afff73bd8fa1023aa658dc4b52d20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Courr=C3=A8ges-Anglas?= Date: Thu, 20 Nov 2014 15:48:29 +0100 Subject: [PATCH] Simplify url construct. --- libtisbackup/backup_xva.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libtisbackup/backup_xva.py b/libtisbackup/backup_xva.py index 78655f4..f9a8980 100755 --- a/libtisbackup/backup_xva.py +++ b/libtisbackup/backup_xva.py @@ -141,10 +141,12 @@ class backup_xva(backup_generic): filename_temp = filename+".tmp" self.logger.debug("[%s] Copy in progress",self.backup_name) socket.setdefaulttimeout(120) + + scheme = "http://" if self.str2bool(enable_https) == True: - url = "https://"+user_xen+":"+password_xen+"@"+self.xcphost+"/export?uuid="+session.xenapi.VM.get_uuid(vm) - else: - url = "http://"+user_xen+":"+password_xen+"@"+self.xcphost+"/export?uuid="+session.xenapi.VM.get_uuid(vm) + scheme = "https://" + url = scheme+user_xen+":"+password_xen+"@"+self.xcphost+"/export?uuid="+session.xenapi.VM.get_uuid(vm) + urllib.urlretrieve(url, filename_temp) urllib.urlcleanup()