Skip to content

Commit

Permalink
Merge "api: Keep track of action controllers"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and openstack-gerrit committed May 3, 2024
2 parents ca5be99 + 233fe18 commit 07f05ad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion nova/api/openstack/compute/routes.py
Expand Up @@ -94,7 +94,7 @@ def _create_controller(main_controller, action_controller_list):

controller = wsgi.Resource(main_controller())
for ctl in action_controller_list:
controller.register_actions(ctl())
controller.register_subcontroller_actions(ctl())
return controller


Expand Down
9 changes: 8 additions & 1 deletion nova/api/openstack/wsgi.py
Expand Up @@ -396,8 +396,8 @@ def __init__(self, controller):
""":param controller: object that implement methods created by routes
lib
"""

self.controller = controller
self.sub_controllers = []

self.default_serializers = dict(json=JSONDictSerializer)

Expand All @@ -413,6 +413,13 @@ def register_actions(self, controller):
for key, method_name in actions.items():
self.wsgi_actions[key] = getattr(controller, method_name)

def register_subcontroller_actions(self, sub_controller):
"""Registers sub-controller actions with this resource."""
self.sub_controllers.append(sub_controller)
actions = getattr(sub_controller, 'wsgi_actions', {})
for key, method_name in actions.items():
self.wsgi_actions[key] = getattr(sub_controller, method_name)

def get_action_args(self, request_environment):
"""Parse dictionary created by routes library."""

Expand Down

0 comments on commit 07f05ad

Please sign in to comment.