[virt-tools-list] [virt-manager] [PATCH] urlfetcher: Add support for FTP authentication

Radostin Stoyanov rstoyanov1 at gmail.com
Wed Apr 18 07:53:12 UTC 2018


From: Mark Hamzy <hamzy at us.ibm.com>

If --location is an ftp url with a username and password
then virt-install fails to install with an error:
ERROR Error validating install location: Opening URL u failed: 530 Login
incorrect..
---
This is a tweaked version of Mark Hamzy
https://www.redhat.com/archives/virt-tools-list/2018-April/msg00000.html

 virtinst/urlfetcher.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/virtinst/urlfetcher.py b/virtinst/urlfetcher.py
index fe410805..bc178240 100644
--- a/virtinst/urlfetcher.py
+++ b/virtinst/urlfetcher.py
@@ -224,8 +224,10 @@ class _FTPURLFetcher(_URLFetcher):
         try:
             parsed = urllib.parse.urlparse(self.location)
             self._ftp = ftplib.FTP()
+            username = urllib.parse.unquote(parsed.username)
+            password = urllib.parse.unquote(parsed.password)
             self._ftp.connect(parsed.hostname, parsed.port or 0)
-            self._ftp.login()
+            self._ftp.login(username, password)
             # Force binary mode
             self._ftp.voidcmd("TYPE I")
         except Exception as e:
-- 
2.14.3




More information about the virt-tools-list mailing list