Skip to content

Commit

Permalink
Treat container remove success only in the frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
davkal committed Apr 22, 2016
1 parent eda2a20 commit 50df0d4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
3 changes: 2 additions & 1 deletion client/app/scripts/utils/web-api-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ export function doControlRequest(nodeId, control) {
clearTimeout(controlErrorTimer);
const url = `api/control/${encodeURIComponent(control.probeId)}/`
+ `${encodeURIComponent(control.nodeId)}/${control.id}`;
const action = control.id;
reqwest({
method: 'POST',
url,
Expand All @@ -188,7 +189,7 @@ export function doControlRequest(nodeId, control) {
if (res.pipe) {
receiveControlPipe(res.pipe, nodeId, res.raw_tty, true);
}
if (res.removedNode) {
if (action === 'docker_remove_container') {
receiveControlNodeRemoved(nodeId);
}
}
Expand Down
3 changes: 0 additions & 3 deletions common/xfer/controls.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ type Response struct {
// Pipe specific fields
Pipe string `json:"pipe,omitempty"`
RawTTY bool `json:"raw_tty,omitempty"`

// Remove specific fields
RemovedNode string `json:"removedNode,omitempty"` // Set if node was removed
}

// Message is the unions of Request, Response and arbitrary Value.
Expand Down
9 changes: 2 additions & 7 deletions probe/docker/controls.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,9 @@ func (r *registry) unpauseContainer(containerID string, _ xfer.Request) xfer.Res

func (r *registry) removeContainer(containerID string, _ xfer.Request) xfer.Response {
log.Infof("Removing container %s", containerID)
if err := r.client.RemoveContainer(docker_client.RemoveContainerOptions{
return xfer.ResponseError(r.client.RemoveContainer(docker_client.RemoveContainerOptions{
ID: containerID,
}); err != nil {
return xfer.ResponseError(err)
}
return xfer.Response{
RemovedNode: containerID,
}
}))
}

func (r *registry) attachContainer(containerID string, req xfer.Request) xfer.Response {
Expand Down

0 comments on commit 50df0d4

Please sign in to comment.