Ensure we pass hexid as bytes when zmq_filtering enabled

When using hashlib and running `.hexdigest()`, a `str` type is returned.
It needs to be converted to a bytes type for the setsockopt a few lines
below, if zmq_filtering is enabled and the master is running Python 3.
This commit is contained in:
Erik Johnson 2018-04-23 08:47:59 -05:00
parent bf3a67d11b
commit a7accc0548
No known key found for this signature in database
GPG key ID: 5E5583C437808F3F

View file

@ -351,7 +351,10 @@ class AsyncZeroMQPubChannel(salt.transport.mixins.auth.AESPubClientMixin, salt.t
if self.opts['zmq_filtering']:
# TODO: constants file for "broadcast"
self._socket.setsockopt(zmq.SUBSCRIBE, b'broadcast')
self._socket.setsockopt(zmq.SUBSCRIBE, self.hexid)
self._socket.setsockopt(
zmq.SUBSCRIBE,
salt.utils.stringutils.to_bytes(self.hexid)
)
else:
self._socket.setsockopt(zmq.SUBSCRIBE, b'')