#NEWLINE# def open_connection( self , parameters ) : #NEWLINE# #INDENT# "\n    Initialize a connection to the back-end OpenStack APIs.\n\n    Args:\n      parameters: A dictionary containing the 'credentials' parameter\n        EC2_URL usually has the format: \n        http://<nova_controller>:8773/services/Cloud\n\n    Returns:\n      An instance of Boto EC2Connection\n    " #NEWLINE# credentials = parameters [ self . PARAM_CREDENTIALS ] #NEWLINE# region_str = self . DEFAULT_REGION #NEWLINE# access_key = str ( credentials [ 'EC2_ACCESS_KEY' ] ) #NEWLINE# secret_key = str ( credentials [ 'EC2_SECRET_KEY' ] ) #NEWLINE# ec2_url = str ( credentials [ 'EC2_URL' ] ) #NEWLINE# result = urlparse ( ec2_url ) #NEWLINE# if ( ( result . port is None ) or ( result . hostname is None ) or ( result . path is None ) ) : #NEWLINE# #INDENT# self . handle_failure ( ( 'Unknown scheme in Openstack_URL: {0}' + ' : expected like http://<controller>:8773/services/Cloud' . format ( result . geturl ( ) ) ) ) #NEWLINE# return None #NEWLINE# #UNINDENT# region = boto . ec2 . regioninfo . RegionInfo ( name = region_str , endpoint = result . hostname ) #NEWLINE# return boto . connect_ec2 ( aws_access_key_id = access_key , aws_secret_access_key = secret_key , is_secure = ( result . scheme == 'https' ) , region = region , port = result . port , path = result . path , debug = 2 )