Fix TCP Transport to work with Tornado 4.5

TCP transport's `TCPClientKeepAlive` derives from
`tornado.tcpclient.TCPClient` and overrides `_create_stream`.
Tornado 4.5 added the kwargs `source_ip` and `source_port` to
`_create_stream`. This new functionality is not needed by Salt.
To be backwards and forwards compatible, add `**kwargs` to swallow
these and any future kwargs that are added.

Signed-off-by: Sergey Kizunov <sergey.kizunov@ni.com>
This commit is contained in:
Sergey Kizunov 2017-04-24 11:35:59 -05:00
parent 7861f12df8
commit 958ecdace8

View File

@ -745,7 +745,14 @@ class TCPClientKeepAlive(tornado.tcpclient.TCPClient):
super(TCPClientKeepAlive, self).__init__( super(TCPClientKeepAlive, self).__init__(
resolver=resolver, io_loop=io_loop) resolver=resolver, io_loop=io_loop)
def _create_stream(self, max_buffer_size, af, addr): def _create_stream(self, max_buffer_size, af, addr, **kwargs): # pylint: disable=unused-argument
'''
Override _create_stream() in TCPClient.
Tornado 4.5 added the kwargs 'source_ip' and 'source_port'.
Due to this, use **kwargs to swallow these and any future
kwargs to maintain compatibility.
'''
# Always connect in plaintext; we'll convert to ssl if necessary # Always connect in plaintext; we'll convert to ssl if necessary
# after one connection has completed. # after one connection has completed.
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)