Fix action request method and URI

Senlin API was exposing the actions API in a sub-optimal way. This patch
fixes the URIs used for cluster actions and node actions. We are also
changing the request method from 'PUT' to 'POST'.

Change-Id: Ifa5d57a8d1a6f96f535f95a376726b1a8c066630
Closes-Bug: #1521074
This commit is contained in:
tengqm
2015-11-30 01:49:49 -05:00
parent 7125431081
commit ec590658ea
3 changed files with 12 additions and 12 deletions

View File

@@ -90,7 +90,7 @@
<method href="#cluster_get"/>
<method href="#cluster_update"/>
<method href="#cluster_delete"/>
<resource id="cluster_actions" path="action">
<resource id="cluster_actions" path="actions">
<method href="#cluster_action"/>
</resource>
<resource id="cluster_policies" path="policies">
@@ -118,7 +118,7 @@
<method href="#node_get"/>
<method href="#node_update"/>
<method href="#node_delete"/>
<resource id="node_actions" path="action">
<resource id="node_actions" path="actions">
<method href="#node_action"/>
</resource>
</resource>
@@ -411,7 +411,7 @@
</request>
<response status="202"/>
</method>
<method name="PUT" id="cluster_action">
<method name="POST" id="cluster_action">
<wadl:doc xml:lang="EN" title="Cluster Action" xmlns="http://docbook.org/ns/docbook">
<para role="shortdesc">Trigger an action on the specified cluster.</para>
</wadl:doc>
@@ -1334,7 +1334,7 @@
</request>
<response status="202"/>
</method>
<method name="PUT" id="node_action">
<method name="POST" id="node_action">
<wadl:doc xml:lang="EN" title="Node Action" xmlns="http://docbook.org/ns/docbook">
<para role="shortdesc">Trigger an action on the specified node.</para>
</wadl:doc>

View File

@@ -136,9 +136,9 @@ class API(wsgi.Router):
action="update",
conditions={'method': 'PATCH'})
sub_mapper.connect("cluster_action",
"/clusters/{cluster_id}/action",
"/clusters/{cluster_id}/actions",
action="action",
conditions={'method': 'PUT'})
conditions={'method': 'POST'})
sub_mapper.connect("cluster_delete",
"/clusters/{cluster_id}",
action="delete",
@@ -166,9 +166,9 @@ class API(wsgi.Router):
action="update",
conditions={'method': 'PATCH'})
sub_mapper.connect("node_action",
"/nodes/{node_id}/action",
"/nodes/{node_id}/actions",
action="action",
conditions={'method': 'PUT'})
conditions={'method': 'POST'})
sub_mapper.connect("node_delete",
"/nodes/{node_id}",
action="delete",

View File

@@ -230,8 +230,8 @@ class RoutesTest(base.SenlinTestCase):
self.assertRoute(
self.m,
'/aaaa/clusters/bbbb/action',
'PUT',
'/aaaa/clusters/bbbb/actions',
'POST',
'action',
'ClusterController',
{
@@ -295,8 +295,8 @@ class RoutesTest(base.SenlinTestCase):
self.assertRoute(
self.m,
'/aaaa/nodes/bbbb/action',
'PUT',
'/aaaa/nodes/bbbb/actions',
'POST',
'action',
'NodeController',
{