Fix event unpack

This commit is contained in:
Erik Johnson 2018-01-18 16:12:37 -06:00 committed by rallytime
parent 19cd97ed3b
commit 58ad558346
No known key found for this signature in database
GPG Key ID: E8F1A4B90D0DEA19
2 changed files with 12 additions and 12 deletions

View File

@ -127,4 +127,7 @@ class Engine(SignalHandlingMultiprocessingProcess):
try:
self.engine[self.fun](**kwargs)
except Exception as exc:
log.critical('Engine {0} could not be started! Error: {1}'.format(self.engine, exc))
log.critical(
'Engine \'%s\' could not be started!',
self.fun.split('.')[0], exc_info=True
)

View File

@ -91,8 +91,8 @@ SUB_EVENT = set([
'state.sls',
])
TAGEND = '\n\n' # long tag delimiter
TAGPARTER = '/' # name spaced tag delimiter
TAGEND = str('\n\n') # long tag delimiter
TAGPARTER = str('/') # name spaced tag delimiter
SALT = 'salt' # base prefix for all salt/ events
# dict map of namespaced base tag prefixes for salt events
TAGS = {
@ -725,15 +725,12 @@ class SaltEvent(object):
is_msgpacked=True,
use_bin_type=six.PY3
)
log.debug('Sending event: tag = {0}; data = {1}'.format(tag, data))
if six.PY2:
event = '{0}{1}{2}'.format(tag, tagend, serialized_data)
else:
event = b''.join([
salt.utils.to_bytes(tag),
salt.utils.to_bytes(tagend),
serialized_data])
msg = salt.utils.to_bytes(event, 'utf-8')
log.debug('Sending event: tag = %s; data = %s', tag, data)
event = b''.join([
salt.utils.stringutils.to_bytes(tag),
salt.utils.stringutils.to_bytes(tagend),
serialized_data])
msg = salt.utils.stringutils.to_bytes(event, 'utf-8')
if self._run_io_loop_sync:
with salt.utils.async.current_ioloop(self.io_loop):
try: