#NEWLINE# def validate_ssl_options( ssl_options ) : #NEWLINE# #INDENT# tries = 0 #NEWLINE# while True : #NEWLINE# #INDENT# if ( tries > 5 ) : #NEWLINE# #INDENT# raise RuntimeError ( 'Failed to connect to SSL cluster after 5 attempts' ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# cluster = Cluster ( protocol_version = PROTOCOL_VERSION , ssl_options = ex_type ) #NEWLINE# session = cluster . connect ( ) #NEWLINE# break #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# ( ex_type , ex , tb ) = sys . exc_info ( ) #NEWLINE# log . warn ( '{0}: {1} Backtrace: {2}' . format ( ex_type . __name__ , ex , traceback . extract_tb ( tb ) ) ) #NEWLINE# del tb #NEWLINE# tries += 1 #NEWLINE# #UNINDENT# #UNINDENT# insert_keyspace = "CREATE KEYSPACE ssltest\n            WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '3'}\n            " #NEWLINE# statement = SimpleStatement ( insert_keyspace ) #NEWLINE# statement . consistency_level = 3 #NEWLINE# session . execute ( statement ) #NEWLINE# drop_keyspace = 'DROP KEYSPACE ssltest' #NEWLINE# statement = SimpleStatement ( drop_keyspace ) #NEWLINE# statement . consistency_level = ConsistencyLevel . ANY #NEWLINE# session . execute ( statement ) #NEWLINE# cluster . shutdown ( )