Skip to content

Commit

Permalink
Included type validation in update environment command (#284)
Browse files Browse the repository at this point in the history
Co-authored-by: Ben Jackson <[email protected]>
  • Loading branch information
CGoodwin90 and shreddedbacon authored Sep 7, 2023
1 parent 38cfffe commit 31c24bc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
8 changes: 7 additions & 1 deletion cmd/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cmd
import (
"context"
"fmt"
s "github.com/uselagoon/machinery/api/schema"
"os"
"strings"

Expand All @@ -13,7 +14,6 @@ import (
"github.com/uselagoon/lagoon-cli/pkg/output"
l "github.com/uselagoon/machinery/api/lagoon"
lclient "github.com/uselagoon/machinery/api/lagoon/client"
s "github.com/uselagoon/machinery/api/schema"
)

// @TODO re-enable this at some point if more environment based commands are made available
Expand Down Expand Up @@ -131,10 +131,16 @@ var updateEnvironmentCmd = &cobra.Command{
}
if environmentType != "" {
envType := s.EnvType(strings.ToUpper(environmentType))
if validationErr := s.ValidateType(envType); validationErr != nil {
handleError(validationErr)
}
environmentFlags.EnvironmentType = &envType
}
if deployT != "" {
deployType := s.DeployType(strings.ToUpper(deployT))
if validationErr := s.ValidateType(deployType); validationErr != nil {
handleError(validationErr)
}
environmentFlags.DeployType = &deployType
}

Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ require (
github.com/guregu/null v4.0.0+incompatible
// workaround for https://github.com/manifoldco/promptui/issues/98
github.com/nicksnyder/go-i18n v1.10.1 // indirect
github.com/uselagoon/machinery v0.0.10
github.com/uselagoon/machinery v0.0.11
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 // indirect
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect
gopkg.in/alecthomas/kingpin.v3-unstable v3.0.0-20191105091915-95d230a53780 // indirect
Expand All @@ -41,4 +41,4 @@ replace github.com/olekukonko/tablewriter => github.com/shreddedbacon/tablewrite

// replace github.com/machinebox/graphql => ../../shreddedbacon/graphql

// replace github.com/olekukonko/tablewriter => ../../shreddedbacon/tablewriter
// replace github.com/olekukonko/tablewriter => ../../shreddedbacon/tablewriter
8 changes: 2 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
github.com/tsenart/deadcode v0.0.0-20160724212837-210d2dc333e9 h1:vY5WqiEon0ZSTGM3ayVVi+twaHKHDFUVloaQ/wug9/c=
github.com/tsenart/deadcode v0.0.0-20160724212837-210d2dc333e9/go.mod h1:q+QjxYvZ+fpjMXqs+XEriussHjSYqeXVnAdSV1tkMYk=
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
github.com/uselagoon/machinery v0.0.8 h1:PDPjBOoQGcmDDFsdibVN/iNkvWo3LJd1Yj+jOuw2bBg=
github.com/uselagoon/machinery v0.0.8/go.mod h1:dGAvkxWQkRu/eLQeWLrTl5HvNoFsiXlXInCptHUxzUw=
github.com/uselagoon/machinery v0.0.9-0.20230710124508-ef420b365811 h1:OUujMdzHe71+7l/GlS4VRyvehatO/jTT9+EIfbr+gwc=
github.com/uselagoon/machinery v0.0.9-0.20230710124508-ef420b365811/go.mod h1:IXLxlkahEAEgpCmu9Xa/Wmjo6ja4Aoq7tf8G7VrileE=
github.com/uselagoon/machinery v0.0.10 h1:pR+2iwXod0XnnyeZsJMlmkSU5BV8cYI65JNoaLwUVbQ=
github.com/uselagoon/machinery v0.0.10/go.mod h1:IXLxlkahEAEgpCmu9Xa/Wmjo6ja4Aoq7tf8G7VrileE=
github.com/uselagoon/machinery v0.0.11 h1:s6EhyU/pj1+C4FdS0EqmR6C0dLsoeCd9n+5xHL1YDag=
github.com/uselagoon/machinery v0.0.11/go.mod h1:IXLxlkahEAEgpCmu9Xa/Wmjo6ja4Aoq7tf8G7VrileE=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
Expand Down

0 comments on commit 31c24bc

Please sign in to comment.