mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #26871 from rallytime/bp-26852
Back-port #26852 to 2015.5
This commit is contained in:
commit
de9350466e
1 changed files with 5 additions and 2 deletions
|
@ -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…
Add table
Reference in a new issue