mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
parent
a563af29d3
commit
5a4c8dd2f5
@ -26,6 +26,7 @@ except ImportError:
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
HAS_MSGPACK = False
|
||||
try:
|
||||
# Attempt to import msgpack
|
||||
import msgpack
|
||||
@ -33,10 +34,12 @@ try:
|
||||
# for some msgpack bindings, check for it
|
||||
if msgpack.loads(msgpack.dumps([1, 2, 3]), use_list=True) is None:
|
||||
raise ImportError
|
||||
HAS_MSGPACK = True
|
||||
except ImportError:
|
||||
# Fall back to msgpack_pure
|
||||
try:
|
||||
import msgpack_pure as msgpack
|
||||
import msgpack_pure as msgpack # pylint: disable=import-error
|
||||
HAS_MSGPACK = True
|
||||
except ImportError:
|
||||
# TODO: Come up with a sane way to get a configured logfile
|
||||
# and write to the logfile when this error is hit also
|
||||
@ -48,7 +51,7 @@ except ImportError:
|
||||
#sys.exit(salt.defaults.exitcodes.EX_GENERIC)
|
||||
|
||||
|
||||
if not hasattr(msgpack, 'exceptions'):
|
||||
if HAS_MSGPACK and not hasattr(msgpack, 'exceptions'):
|
||||
class PackValueError(Exception):
|
||||
'''
|
||||
older versions of msgpack do not have PackValueError
|
||||
|
Loading…
Reference in New Issue
Block a user