From 9d96ba89194134c2288ddde728d553737a82ed55 Mon Sep 17 00:00:00 2001 From: Mohammed Diaa Date: Wed, 20 Dec 2023 19:54:30 +0200 Subject: [PATCH] Omit machine types unless they are > 0 --- cmd/execute/execute.go | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/cmd/execute/execute.go b/cmd/execute/execute.go index 3ab75b8..f6da571 100644 --- a/cmd/execute/execute.go +++ b/cmd/execute/execute.go @@ -153,12 +153,21 @@ func parseMachineConfiguration(config string) (types.Machines, error) { } } - return types.Machines{ - // sizes = [small, medium, large] - Small: &sizes[0], - Medium: &sizes[1], - Large: &sizes[2], - }, nil + var machines types.Machines + + if sizes[0] != 0 { + machines.Small = &sizes[0] + } + + if sizes[1] != 0 { + machines.Medium = &sizes[1] + } + + if sizes[2] != 0 { + machines.Large = &sizes[2] + } + + return machines, nil } // One type of machine