Fix server action request generation

Server action request paths were not interpolating server_id. This
change marks server_id for interpolation in the ServerAction base_path,
and uses request_id as the identifier for server actions.

Change-Id: I0da8ec51ab94a094dc0e7d89aedf1830a08fd150
This commit is contained in:
Daniel Wilson
2022-11-09 23:16:50 -05:00
parent 57153379b2
commit 0bf4d86e5a
4 changed files with 6 additions and 6 deletions

View File

@@ -2174,7 +2174,7 @@ class Proxy(proxy.Proxy):
return self._get(
_server_action.ServerAction,
server_id=server_id,
action_id=server_action,
request_id=server_action,
ignore_missing=ignore_missing,
)

View File

@@ -49,7 +49,7 @@ class ServerActionEvent(resource.Resource):
class ServerAction(resource.Resource):
resource_key = 'instanceAction'
resources_key = 'instanceActions'
base_path = '/servers/{server_id}/os-instance-actions'
base_path = '/servers/%(server_id)s/os-instance-actions'
# capabilities
allow_fetch = True
@@ -68,7 +68,7 @@ class ServerAction(resource.Resource):
# #: The ID of the server that this action relates to.
# server_id = resource.Body('instance_uuid')
#: The ID of the request that this action related to.
request_id = resource.Body('request_id')
request_id = resource.Body('request_id', alternate_id=True)
#: The ID of the user which initiated the server action.
user_id = resource.Body('user_id')
#: The ID of the project that this server belongs to.

View File

@@ -1453,11 +1453,11 @@ class TestServerAction(TestComputeProxy):
self._verify(
'openstack.proxy.Proxy._get',
self.proxy.get_server_action,
method_args=['action_id'],
method_args=['request_id'],
method_kwargs={'server': 'server_id'},
expected_args=[server_action.ServerAction],
expected_kwargs={
'action_id': 'action_id', 'server_id': 'server_id',
'request_id': 'request_id', 'server_id': 'server_id',
},
)

View File

@@ -55,7 +55,7 @@ class TestServerAction(base.TestCase):
self.assertEqual('instanceAction', sot.resource_key)
self.assertEqual('instanceActions', sot.resources_key)
self.assertEqual(
'/servers/{server_id}/os-instance-actions',
'/servers/%(server_id)s/os-instance-actions',
sot.base_path,
)
self.assertTrue(sot.allow_fetch)