Skip to content

Commit

Permalink
fixup: from review feedback
Browse files Browse the repository at this point in the history
Fix a logic error in ECS scale-down button, bad copy/paste in
ActiveControls() and neaten the switch cases in container controls.

Co-Authored-By: Filip Barl <filip@weave.works>
  • Loading branch information
bboreham and Filip Barl committed Jan 13, 2020
1 parent 635cea0 commit 1dcdfab
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion probe/awsecs/reporter.go
Expand Up @@ -153,7 +153,7 @@ func (r Reporter) Tag(rpt report.Report) (report.Report, error) {
activeControls := []string{ScaleUp}
// Disable ScaleDown when only 1 task is desired, since
// scaling down to 0 would cause the service to disappear (#2085)
if service.DesiredCount < 1 {
if service.DesiredCount > 1 {
activeControls = append(activeControls, ScaleDown)
}
rpt.ECSService.AddNode(report.MakeNodeWith(serviceID, map[string]string{
Expand Down
5 changes: 2 additions & 3 deletions probe/docker/container.go
Expand Up @@ -391,13 +391,12 @@ func (c *container) getBaseNode() report.Node {

// Return a slice including all controls that should be shown on this container
func (c *container) controls() []string {
paused := c.container.State.Paused
switch {
case paused:
case c.container.State.Paused:
return []string{UnpauseContainer}
case c.container.State.Running:
return []string{RestartContainer, StopContainer, PauseContainer, AttachContainer, ExecContainer}
case !c.container.State.Running:
default:
return []string{StartContainer, RemoveContainer}
}
return nil
Expand Down
2 changes: 1 addition & 1 deletion report/node.go
Expand Up @@ -124,7 +124,7 @@ func (n Node) WithLatestActiveControls(cs ...string) Node {
}

// ActiveControls returns a string slice with the names of active controls.
func (n Node) ActiveControls(cs ...string) []string {
func (n Node) ActiveControls() []string {
activeControls, _ := n.Latest.Lookup(NodeActiveControls)
return strings.Split(activeControls, ScopeDelim)
}
Expand Down

0 comments on commit 1dcdfab

Please sign in to comment.