Re: Fw: [PATCH] support username and password in prepareLocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/01/2018 09:36 AM, Mark Hamzy wrote:
> 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..
> ---
> virtinst/urlfetcher.py | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/virtinst/urlfetcher.py b/virtinst/urlfetcher.py
> index da59a476..b87279bb 100644
> --- a/virtinst/urlfetcher.py
> +++ b/virtinst/urlfetcher.py
> @@ -209,8 +209,14 @@ class _FTPURLFetcher(_URLFetcher):
>         try:
>             parsed = urllib.parse.urlparse(self.location)
>             self._ftp = ftplib.FTP()
> +            from urllib import unquote
> +            username = parsed.username or ''
> +            username = unquote(username).decode('utf8')
> +            password = parsed.password or ''
> +            password = unquote(password).decode('utf8')
> +            self._ftp = ftplib.FTP(parsed.hostname, username, 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:

Thanks for the patch, but did you test on virt-manager git? It fails for
me, like Radostin said on python3 unquote has moved so the import fails.
Please make sure you are testing with latest virt-manager which is
python3 only

Thanks,
Cole

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux