mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
allow node update api receive node name and id prefix
Signed-off-by: allencloud <allen.sun@daocloud.io>
This commit is contained in:
parent
ff2de8dace
commit
d075b83dd6
4 changed files with 17 additions and 11 deletions
|
@ -1369,7 +1369,7 @@ func (c *Cluster) GetNode(input string) (types.Node, error) {
|
|||
}
|
||||
|
||||
// UpdateNode updates existing nodes properties.
|
||||
func (c *Cluster) UpdateNode(nodeID string, version uint64, spec types.NodeSpec) error {
|
||||
func (c *Cluster) UpdateNode(input string, version uint64, spec types.NodeSpec) error {
|
||||
c.RLock()
|
||||
defer c.RUnlock()
|
||||
|
||||
|
@ -1385,10 +1385,15 @@ func (c *Cluster) UpdateNode(nodeID string, version uint64, spec types.NodeSpec)
|
|||
ctx, cancel := c.getRequestContext()
|
||||
defer cancel()
|
||||
|
||||
currentNode, err := getNode(ctx, c.client, input)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = c.client.UpdateNode(
|
||||
ctx,
|
||||
&swarmapi.UpdateNodeRequest{
|
||||
NodeID: nodeID,
|
||||
NodeID: currentNode.ID,
|
||||
Spec: &nodeSpec,
|
||||
NodeVersion: &swarmapi.Version{
|
||||
Index: version,
|
||||
|
|
|
@ -193,6 +193,7 @@ This section lists each version from latest to oldest. Each listing includes a
|
|||
* `POST /plugins/(plugin name)/push` push a plugin.
|
||||
* `POST /plugins/create?name=(plugin name)` create a plugin.
|
||||
* `DELETE /plugins/(plugin name)` delete a plugin.
|
||||
* `POST /node/(id or name)/update` now accepts both `id` or `name` to identify the node to update.
|
||||
|
||||
|
||||
### v1.24 API changes
|
||||
|
|
|
@ -3965,7 +3965,7 @@ List nodes
|
|||
### Inspect a node
|
||||
|
||||
|
||||
`GET /nodes/<id>`
|
||||
`GET /nodes/(id or name)`
|
||||
|
||||
Return low-level information on the node `id`
|
||||
|
||||
|
@ -4047,9 +4047,9 @@ Return low-level information on the node `id`
|
|||
### Remove a node
|
||||
|
||||
|
||||
`DELETE /nodes/(id)`
|
||||
`DELETE /nodes/(id or name)`
|
||||
|
||||
Remove a node [`id`] from the swarm.
|
||||
Remove a node from the swarm.
|
||||
|
||||
**Example request**:
|
||||
|
||||
|
@ -4077,7 +4077,7 @@ Remove a node [`id`] from the swarm.
|
|||
|
||||
`POST /nodes/(id)/update`
|
||||
|
||||
Update the node `id`.
|
||||
Update a node.
|
||||
|
||||
The payload of the `POST` request is the new `NodeSpec` and
|
||||
overrides the current `NodeSpec` for the specified node.
|
||||
|
|
|
@ -4564,7 +4564,7 @@ List nodes
|
|||
### Inspect a node
|
||||
|
||||
|
||||
`GET /nodes/<id>`
|
||||
`GET /nodes/(id or name)`
|
||||
|
||||
Return low-level information on the node `id`
|
||||
|
||||
|
@ -4647,9 +4647,9 @@ Return low-level information on the node `id`
|
|||
### Remove a node
|
||||
|
||||
|
||||
`DELETE /nodes/(id)`
|
||||
`DELETE /nodes/(id or name)`
|
||||
|
||||
Remove a node [`id`] from the swarm.
|
||||
Remove a node from the swarm.
|
||||
|
||||
**Example request**:
|
||||
|
||||
|
@ -4675,9 +4675,9 @@ Remove a node [`id`] from the swarm.
|
|||
### Update a node
|
||||
|
||||
|
||||
`POST /nodes/(id)/update`
|
||||
`POST /nodes/(id or name)/update`
|
||||
|
||||
Update the node `id`.
|
||||
Update a node.
|
||||
|
||||
The payload of the `POST` request is the new `NodeSpec` and
|
||||
overrides the current `NodeSpec` for the specified node.
|
||||
|
|
Loading…
Reference in a new issue