#NEWLINE# def zmq_version( ) : #NEWLINE# #INDENT# '\n    ZeroMQ python bindings >= 2.1.9 are required\n    ' #NEWLINE# try : #NEWLINE# #INDENT# import zmq #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# ver = zmq . __version__ #NEWLINE# match = re . match ( '^(\\d+)\\.(\\d+)(?:\\.(\\d+))?' , ver ) #NEWLINE# if ( not match ) : #NEWLINE# #INDENT# msg = "Using untested zmq python bindings version: '{0}'" . format ( ver ) #NEWLINE# if is_console_configured ( ) : #NEWLINE# #INDENT# log . warning ( msg ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# sys . stderr . write ( 'WARNING {0}\n' . format ( msg ) ) #NEWLINE# #UNINDENT# return True #NEWLINE# #UNINDENT# ( major , minor , point ) = match . groups ( ) #NEWLINE# if major . isdigit ( ) : #NEWLINE# #INDENT# major = int ( major ) #NEWLINE# #UNINDENT# if minor . isdigit ( ) : #NEWLINE# #INDENT# minor = int ( minor ) #NEWLINE# #UNINDENT# if ( point and point . isdigit ( ) ) : #NEWLINE# #INDENT# point = int ( point ) #NEWLINE# #UNINDENT# if ( ( major == 2 ) and ( minor == 1 ) ) : #NEWLINE# #INDENT# if ( ( 'dev' in ver ) and ( not point ) ) : #NEWLINE# #INDENT# msg = 'Using dev zmq module, please report unexpected results' #NEWLINE# if is_console_configured ( ) : #NEWLINE# #INDENT# log . warning ( msg ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# sys . stderr . write ( 'WARNING: {0}\n' . format ( msg ) ) #NEWLINE# #UNINDENT# return True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( point and ( point >= 9 ) ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( major > 2 ) or ( ( major == 2 ) and ( minor > 1 ) ) ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# #UNINDENT# log . critical ( 'ZeroMQ python bindings >= 2.1.9 are required' ) #NEWLINE# if ( 'salt-master' in sys . argv [ 0 ] ) : #NEWLINE# #INDENT# msg = 'The Salt Master is unstable using a ZeroMQ version lower than 2.1.11 and requires this fix: http://lists.zeromq.org/pipermail/zeromq-dev/2011-June/012094.html' #NEWLINE# if is_console_configured ( ) : #NEWLINE# #INDENT# log . critical ( msg ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# sys . stderr . write ( 'CRITICAL {0}\n' . format ( msg ) ) #NEWLINE# #UNINDENT# #UNINDENT# return False