From 702e9cf66cbd3ca39bf26201b565269b8a27d9a9 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 18 Nov 2020 12:27:56 -0500 Subject: [PATCH] fix: zero out entries that don't exist in the scale file --- plugins/ps/functions.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/ps/functions.go b/plugins/ps/functions.go index 2041b806a..d224e0810 100644 --- a/plugins/ps/functions.go +++ b/plugins/ps/functions.go @@ -407,6 +407,14 @@ func updateScalefile(appName string, scaleUpdates map[string]int) error { scale[processType] = count } + for processType := range validProcessTypes { + count, ok := scale[processType] + if !ok { + count = 0 + } + scale[processType] = count + } + content := []string{} for processType, count := range scale { content = append(content, fmt.Sprintf("%s=%d", processType, count))