You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classSerial(object):
''' Create a serialization object, this object manages all message serialization in Salt '''def__init__(self, opts):
ifisinstance(opts, dict):
self.serial=opts.get('serial', 'msgpack')
elifisinstance(opts, str):
self.serial=optselse:
self.serial='msgpack'defloads(self, msg):
''' Run the correct loads serialization format '''try:
gc.disable() # performance optimization for msgpackreturnmsgpack.loads(msg, use_list=True)
exceptExceptionasexc:
log.critical('Could not deserialize msgpack message: {0}''This often happens when trying to read a file not in binary mode.''Please open an issue and include the following error: {1}'.format(msg, exc))
raisefinally:
gc.enable()
defload(self, fn_):
''' Run the correct serialization to load a file '''data=fn_.read()
fn_.close()
ifdata:
returnself.loads(data)
defdumps(self, msg):
''' Run the correct dumps serialization format '''try:
returnmsgpack.dumps(msg)
except (OverflowError, msgpack.exceptions.PackValueError):
Could you please tell me why only use msgpack? (optimization?)
In old version the serial way is set by config (opts.get('serial', 'msgpack'))
msgpack and pickle
bug msgpack way cause code error on windows: #16751
Could I use the pickle way to serial, or may be other problem that only use msgpack ?
The text was updated successfully, but these errors were encountered:
@derek0377, the choice of msgpack for serializing was made before I began working on salt, but I understand it is because msgpack offers many features that are needed by salt that pickle does not have.
Since #23740 and #24089 (2015.5.1), reading and writing of files on windows is done in binary mode. Do you encounter that error on 2015.5.1 or later?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.
Here is the Serial Class in payload.py
Could you please tell me why only use msgpack? (optimization?)
In old version the serial way is set by config (
opts.get('serial', 'msgpack')
)msgpack and pickle
bug msgpack way cause code error on windows:
#16751
Could I use the pickle way to serial, or may be other problem that only use msgpack ?
The text was updated successfully, but these errors were encountered: