Re: [virt-manager] [PATCHv2] urlfetcher: Add support for FTP authentication

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

 



On 04/18/2018 09:23 AM, Radostin Stoyanov wrote:
> From: Mark Hamzy <hamzy@xxxxxxxxxx>
> 
> 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's patch
> https://www.redhat.com/archives/virt-tools-list/2018-April/msg00000.html
> Changes from v1: Set username and password to empty string by default.
> This avoids the error: 'NoneType' is not iterable
> 
>  virtinst/urlfetcher.py | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/virtinst/urlfetcher.py b/virtinst/urlfetcher.py
> index fe410805..afc461b0 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 or '')
> +            password = urllib.parse.unquote(parsed.password or '')
>              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! pushed now

- 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