dns_hub: Rename variable to avoid naming collision in exception handler
authorTim Beale <timbeale@catalyst.net.nz>
Thu, 17 Jan 2019 04:36:50 +0000 (17:36 +1300)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 17 Jan 2019 14:23:23 +0000 (15:23 +0100)
commitb8c248e4d903b657c209b4faedcf6dc1ddacf2fe
tree6146023c48d2af60a44fa77409db565e8045a32d
parent48285a9c60a9156d465d1dc04e4a0289c043a5af
dns_hub: Rename variable to avoid naming collision in exception handler

In dns_hup.py, we are both importing the socket module and declaring a
variable called socket. When we try to catch a socket.error exception
(defined by the module), Python thinks we're referring to the variable.
As the variable has no attribute called 'error', Python throws an
exception, e.g.:

  File "./bin/python/samba/tests/dns_forwarder_helpers/dns_hub.py", line
123, in handle
    except socket.error as err:
AttributeError: 'socket' object has no attribute 'error'

We can avoid this problem by calling the variable 'sock' instead.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Jan 17 15:23:23 CET 2019 on sn-devel-144
python/samba/tests/dns_forwarder_helpers/dns_hub.py