Skip to content

Commit 1dcdfab

Browse files
bborehamFilip Barl
and
Filip Barl
committed
fixup: from review feedback
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 <[email protected]>
1 parent 635cea0 commit 1dcdfab

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

probe/awsecs/reporter.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func (r Reporter) Tag(rpt report.Report) (report.Report, error) {
153153
activeControls := []string{ScaleUp}
154154
// Disable ScaleDown when only 1 task is desired, since
155155
// scaling down to 0 would cause the service to disappear (#2085)
156-
if service.DesiredCount < 1 {
156+
if service.DesiredCount > 1 {
157157
activeControls = append(activeControls, ScaleDown)
158158
}
159159
rpt.ECSService.AddNode(report.MakeNodeWith(serviceID, map[string]string{

probe/docker/container.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -391,13 +391,12 @@ func (c *container) getBaseNode() report.Node {
391391

392392
// Return a slice including all controls that should be shown on this container
393393
func (c *container) controls() []string {
394-
paused := c.container.State.Paused
395394
switch {
396-
case paused:
395+
case c.container.State.Paused:
397396
return []string{UnpauseContainer}
398397
case c.container.State.Running:
399398
return []string{RestartContainer, StopContainer, PauseContainer, AttachContainer, ExecContainer}
400-
case !c.container.State.Running:
399+
default:
401400
return []string{StartContainer, RemoveContainer}
402401
}
403402
return nil

report/node.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func (n Node) WithLatestActiveControls(cs ...string) Node {
124124
}
125125

126126
// ActiveControls returns a string slice with the names of active controls.
127-
func (n Node) ActiveControls(cs ...string) []string {
127+
func (n Node) ActiveControls() []string {
128128
activeControls, _ := n.Latest.Lookup(NodeActiveControls)
129129
return strings.Split(activeControls, ScopeDelim)
130130
}

0 commit comments

Comments
 (0)