[virt-tools-list] [virt-manager PATCH] sshtunnels: resolve the name if host is specified
Cole Robinson
crobinso at redhat.com
Wed May 6 17:01:07 UTC 2015
On 05/06/2015 08:29 AM, Giuseppe Scrivano wrote:
> bug introduced with commit a2d453f3e20d103a4767394300c5183fde9a6bb4
>
> Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1218958
>
> Signed-off-by: Giuseppe Scrivano <gscrivan at redhat.com>
> ---
> virtManager/sshtunnels.py | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/virtManager/sshtunnels.py b/virtManager/sshtunnels.py
> index 53f43be..263a6ed 100644
> --- a/virtManager/sshtunnels.py
> +++ b/virtManager/sshtunnels.py
> @@ -48,6 +48,8 @@ class ConnectionInfo(object):
> self._connhost = "127.0.0.1"
>
> def _is_listen_localhost(self, host=None):
> + if host:
> + host = socket.gethostbyname(host)
> return ipaddr.IPNetwork(host or self.gaddr).is_loopback
>
> def _is_listen_any(self):
>
gethostbyname will throw an exception if the host name isn't resolvable.
I think we should just wrap the IPNetwork check in try:/except, and if it
errors we return True. This is really just meant to be a best effort check
- Cole
More information about the virt-tools-list
mailing list