# There is a serialization issue on ARM and potentially other platforms # 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 # 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 LOG_FORMAT = '[%(levelname)-8s] %(message)s' salt.log.setup_console_logger(log_format=LOG_FORMAT) log.fatal('Unable to import msgpack or msgpack_pure python modules') # Don't exit if msgpack is not available, this is to make local mode # work without msgpack #sys.exit(salt.defaults.exitcodes.EX_GENERIC) if HAS_MSGPACK and not hasattr(msgpack, 'exceptions'): class PackValueError(Exception): ''' older versions of msgpack do not have PackValueError ''' class exceptions(object): ''' older versions of msgpack do not have an exceptions module '''
# Attempt to import msgpack import msgpack # There is a serialization issue on ARM and potentially other platforms # for some msgpack bindings, check for it if msgpack.loads(msgpack.dumps([1, 2, 3]), use_list=True) is None: raise ImportError except ImportError: # Fall back to msgpack_pure try: import msgpack_pure as msgpack 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 LOG_FORMAT = '[%(levelname)-8s] %(message)s' salt.log.setup_console_logger(log_format=LOG_FORMAT) log.fatal('Unable to import msgpack or msgpack_pure python modules') # Don't exit if msgpack is not available, this is to make local mode # work without msgpack #sys.exit(salt.exitcodes.EX_GENERIC) def package(payload): ''' This method for now just wraps msgpack.dumps, but it is here so that we can make the serialization a custom option in the future with ease. ''' return msgpack.dumps(payload) def unpackage(package_): '''
# There is a serialization issue on ARM and potentially other platforms # 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 # 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 LOG_FORMAT = '[%(levelname)-8s] %(message)s' salt.log.setup_console_logger(log_format=LOG_FORMAT) log.fatal('Unable to import msgpack or msgpack_pure python core') # Don't exit if msgpack is not available, this is to make local mode # work without msgpack #sys.exit(salt.defaults.exitcodes.EX_GENERIC) if HAS_MSGPACK and not hasattr(msgpack, 'exceptions'): class PackValueError(Exception): ''' older versions of msgpack do not have PackValueError ''' class exceptions(object): ''' older versions of msgpack do not have an exceptions module '''