Move eventlet-using class out of endpoint/__init__.py into its own submodule, so that twisted-related code using endpoint.[other stuff] wouldn't run eventlet and make unit tests throw crazy errors about eventlet 0.9.10 not playing nicely with twisted.
This commit is contained in:
		| @@ -21,15 +21,14 @@ | ||||
|   Daemon for the Rackspace API endpoint. | ||||
| """ | ||||
|  | ||||
| import nova.endpoint | ||||
|  | ||||
| from nova import flags | ||||
| from nova import utils | ||||
| from nova import wsgi | ||||
| from nova.endpoint import newapi | ||||
|  | ||||
| FLAGS = flags.FLAGS | ||||
| flags.DEFINE_integer('cc_port', 8773, 'cloud controller port') | ||||
|  | ||||
| if __name__ == '__main__': | ||||
|     utils.default_flagfile() | ||||
|     wsgi.run_server(nova.endpoint.APIVersionRouter(), FLAGS.cc_port) | ||||
|     wsgi.run_server(newapi.APIVersionRouter(), FLAGS.cc_port) | ||||
|   | ||||
| @@ -1,51 +0,0 @@ | ||||
| # vim: tabstop=4 shiftwidth=4 softtabstop=4 | ||||
|  | ||||
| # Copyright 2010 United States Government as represented by the | ||||
| # Administrator of the National Aeronautics and Space Administration. | ||||
| # All Rights Reserved. | ||||
| # | ||||
| #    Licensed under the Apache License, Version 2.0 (the "License"); you may | ||||
| #    not use this file except in compliance with the License. You may obtain | ||||
| #    a copy of the License at | ||||
| # | ||||
| #         http://www.apache.org/licenses/LICENSE-2.0 | ||||
| # | ||||
| #    Unless required by applicable law or agreed to in writing, software | ||||
| #    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
| #    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
| #    License for the specific language governing permissions and limitations | ||||
| #    under the License. | ||||
|  | ||||
| """ | ||||
| :mod:`nova.endpoint` -- Main NOVA Api endpoints | ||||
| ===================================================== | ||||
|  | ||||
| .. automodule:: nova.endpoint | ||||
|    :platform: Unix | ||||
|    :synopsis: REST APIs for all nova functions | ||||
| .. moduleauthor:: Jesse Andrews <jesse@ansolabs.com> | ||||
| .. moduleauthor:: Devin Carlen <devin.carlen@gmail.com> | ||||
| .. moduleauthor:: Vishvananda Ishaya <vishvananda@yahoo.com> | ||||
| .. moduleauthor:: Joshua McKenty <joshua@cognition.ca> | ||||
| .. moduleauthor:: Manish Singh <yosh@gimp.org> | ||||
| .. moduleauthor:: Andy Smith <andy@anarkystic.com> | ||||
| """ | ||||
|  | ||||
| from nova import wsgi | ||||
| import routes | ||||
| from nova.endpoint import rackspace | ||||
| from nova.endpoint import aws | ||||
|  | ||||
| class APIVersionRouter(wsgi.Router): | ||||
|     """Routes top-level requests to the appropriate API.""" | ||||
|  | ||||
|     def __init__(self): | ||||
|         mapper = routes.Mapper() | ||||
|  | ||||
|         rsapi = rackspace.API() | ||||
|         mapper.connect(None, "/v1.0/{path_info:.*}", controller=rsapi) | ||||
|  | ||||
|         mapper.connect(None, "/ec2/{path_info:.*}", controller=aws.API()) | ||||
|  | ||||
|         super(APIVersionRouter, self).__init__(mapper) | ||||
|  | ||||
|   | ||||
							
								
								
									
										51
									
								
								nova/endpoint/newapi.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								nova/endpoint/newapi.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,51 @@ | ||||
| # vim: tabstop=4 shiftwidth=4 softtabstop=4 | ||||
|  | ||||
| # Copyright 2010 United States Government as represented by the | ||||
| # Administrator of the National Aeronautics and Space Administration. | ||||
| # All Rights Reserved. | ||||
| # | ||||
| #    Licensed under the Apache License, Version 2.0 (the "License"); you may | ||||
| #    not use this file except in compliance with the License. You may obtain | ||||
| #    a copy of the License at | ||||
| # | ||||
| #         http://www.apache.org/licenses/LICENSE-2.0 | ||||
| # | ||||
| #    Unless required by applicable law or agreed to in writing, software | ||||
| #    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
| #    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
| #    License for the specific language governing permissions and limitations | ||||
| #    under the License. | ||||
|  | ||||
| """ | ||||
| :mod:`nova.endpoint` -- Main NOVA Api endpoints | ||||
| ===================================================== | ||||
|  | ||||
| .. automodule:: nova.endpoint | ||||
|    :platform: Unix | ||||
|    :synopsis: REST APIs for all nova functions | ||||
| .. moduleauthor:: Jesse Andrews <jesse@ansolabs.com> | ||||
| .. moduleauthor:: Devin Carlen <devin.carlen@gmail.com> | ||||
| .. moduleauthor:: Vishvananda Ishaya <vishvananda@yahoo.com> | ||||
| .. moduleauthor:: Joshua McKenty <joshua@cognition.ca> | ||||
| .. moduleauthor:: Manish Singh <yosh@gimp.org> | ||||
| .. moduleauthor:: Andy Smith <andy@anarkystic.com> | ||||
| """ | ||||
|  | ||||
| from nova import wsgi | ||||
| import routes | ||||
| from nova.endpoint import rackspace | ||||
| from nova.endpoint import aws | ||||
|  | ||||
| class APIVersionRouter(wsgi.Router): | ||||
|     """Routes top-level requests to the appropriate API.""" | ||||
|  | ||||
|     def __init__(self): | ||||
|         mapper = routes.Mapper() | ||||
|  | ||||
|         rsapi = rackspace.API() | ||||
|         mapper.connect(None, "/v1.0/{path_info:.*}", controller=rsapi) | ||||
|  | ||||
|         mapper.connect(None, "/ec2/{path_info:.*}", controller=aws.API()) | ||||
|  | ||||
|         super(APIVersionRouter, self).__init__(mapper) | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Michael Gundlach
					Michael Gundlach