Skip to content

Commit fff8db0

Browse files
Devel (#59)
* Implement #56 * Implement #58 * Update gopkg.in/yaml.v2 * Update version for new release * Update doc * Restore go.sum
1 parent 7d148be commit fff8db0

File tree

6 files changed

+59
-27
lines changed

6 files changed

+59
-27
lines changed

CHANGELOG.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
## v1.2.9
22

3-
3+
### Added
4+
5+
- command `depreset` to reset the status of a given deployment
6+
47
### Changed
58

69
- command `depshow` and `depcreate` now support option `--ojson` that formats the command output in json

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@ Commands:
9797
depdel <uuid>
9898
delete a given deployment
9999
100-
resls <depployment uuid>
100+
depreset [<flags>] <uuid>
101+
reset the state of a given deployment
102+
103+
resls <deployment uuid>
101104
list the resources of a given deployment
102105
103106
resshow <deployment uuid> <resource uuid>

gitbook/user.md

+12
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,18 @@ Example:
306306
$ orchent depdel 12345678-1234-1234-1234-123456789abc
307307
deletion of deployment 12345678-1234-1234-1234-123456789abc successfully triggered
308308
```
309+
#### Reset The State Of A Given Deployment - depreset
310+
The command `depreset` can be used to reset the deployment state given the deployment id.
311+
Usage tips: If a deployment remains stuck in DELETE_IN_PROGRESS, you can use this command to manually reset the state of the deployment to DELETE_FAILED. You can then try to delete the deployment again.
312+
313+
```
314+
$ orchent depreset [--status=DELETE_FAILED] <uuid>
315+
```
316+
Example:
317+
```
318+
$ orchent depreset 11ed3ce7-ba36-5c2e-9808-02424e495bee
319+
reset of deployment 11ed3ce7-ba36-5c2e-9808-02424e495bee successfully triggered
320+
```
309321
#### Get The Resources Of A Deployment - resls
310322
Listing all the resources of a deployment is very similar to listing all deployments,
311323
only that a deployment uuid must be passed:

go.mod

+1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ require (
2424
gopkg.in/alecthomas/kingpin.v2 v2.2.3
2525
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
2626
gopkg.in/ini.v1 v1.62.0
27+
gopkg.in/yaml.v2 v2.2.8
2728
)

go.sum

+2-23
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
22
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
3-
github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38 h1:smF2tmSOzy2Mm+0dGI2AIUHY+w0BUc+4tn40djz7+6U=
43
github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38/go.mod h1:r7bzyVFMNntcxPZXK3/+KdruV1H5KSlyVY0gc+NgInI=
5-
github.com/alecthomas/colour v0.1.0 h1:nOE9rJm6dsZ66RGWYSFrXw461ZIt9A6+nHgL7FRrDUk=
64
github.com/alecthomas/colour v0.1.0/go.mod h1:QO9JBoKquHd+jz9nshCh40fOfO+JzsoXy8qTHF68zU0=
7-
github.com/alecthomas/repr v0.0.0-20210801044451-80ca428c5142 h1:8Uy0oSf5co/NZXje7U1z8Mpep++QJOldL2hs/sBQf48=
85
github.com/alecthomas/repr v0.0.0-20210801044451-80ca428c5142/go.mod h1:2kn6fqh/zIyPLmm3ugklbEi5hg5wS435eygvNfaDQL8=
96
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc h1:cAKDfWh5VpdgMhJosfJnn5/FoN2SRZ4p7fJNX58YPaU=
107
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
118
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf h1:qet1QNfXsQxTZqLG4oE62mJzwPIB8+Tee4RNCL9ulrY=
129
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
1310
github.com/codegangsta/cli v1.19.2-0.20170706194625-4b90d79a682b h1:jdaVzhgBSmuyj7++RPxjNf/fgDT9+5VqfxpFzjXkv38=
1411
github.com/codegangsta/cli v1.19.2-0.20170706194625-4b90d79a682b/go.mod h1:/qJNoX69yVSKu5o4jLyXAENLRyk1uhi7zkbQ3slBdOA=
15-
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=
1612
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
1713
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
18-
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
1914
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
2015
github.com/dghubble/sling v1.1.0 h1:DLu20Bq2qsB9cI5Hldaxj+TMPEaPpPE8IR2kvD22Atg=
2116
github.com/dghubble/sling v1.1.0/go.mod h1:ZcPRuLm0qrcULW2gOrjXrAWgf76sahqSyxXyVOvkunE=
@@ -25,57 +20,41 @@ github.com/go-ini/ini v1.28.1 h1:31infb1d2q1XtBq7msGogTnG0vODN/5poMiHg+cpXQw=
2520
github.com/go-ini/ini v1.28.1/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
2621
github.com/google/go-querystring v0.0.0-20160401233042-9235644dd9e5 h1:oERTZ1buOUYlpmKaqlO5fYmz8cZ1rYu5DieJzF4ZVmU=
2722
github.com/google/go-querystring v0.0.0-20160401233042-9235644dd9e5/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
28-
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
2923
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
3024
github.com/indigo-dc/liboidcagent-go v0.0.0-20190403081110-5a786cab8df1 h1:eyi3Cgh6GTNrBp56ml40TVyNrGGGpIJu682lmjCRv4A=
3125
github.com/indigo-dc/liboidcagent-go v0.0.0-20190403081110-5a786cab8df1/go.mod h1:G3U0gH8up4cWD5qhUwYndL6ZTdjpiiJXhguC2BEWj28=
32-
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
3326
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
3427
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
35-
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
3628
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
3729
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
38-
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
3930
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
40-
github.com/mattn/go-isatty v0.0.13 h1:qdl+GuBjcsKKDco5BsxPJlId98mSWNKqYA+Co0SC1yA=
4131
github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
42-
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
4332
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
44-
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
4533
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
46-
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
4734
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
48-
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
4935
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
50-
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
5136
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
52-
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
5337
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
5438
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
5539
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
56-
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
5740
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
58-
github.com/urfave/cli v1.22.5 h1:lNq9sAHXK2qfdI8W+GRItjCEkI+2oR4d+MEHy1CKXoU=
5941
github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
6042
github.com/zpatrick/go-config v0.0.0-20161118202931-710646a45582 h1:BRcrJZ7F4D3CO/LIoSJHqNl1QF9lNoRWKv94ootMiLA=
6143
github.com/zpatrick/go-config v0.0.0-20161118202931-710646a45582/go.mod h1:N7O1arBXMtrvgkF3kTwZdytK4gsAf13kfqv9Z6vk47Q=
6244
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
6345
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
6446
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
65-
golang.org/x/sys v0.0.0-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg=
6647
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
6748
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
6849
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
6950
gopkg.in/alecthomas/kingpin.v2 v2.2.3 h1:/L3oK40poPRwke0Ipa6qqf8n+awu60Vl3DMe+3jLDt4=
7051
gopkg.in/alecthomas/kingpin.v2 v2.2.3/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
7152
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
7253
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
73-
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
7454
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
75-
gopkg.in/ini.v1 v1.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU=
7655
gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
7756
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
78-
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
7957
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
80-
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
58+
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
59+
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
8160
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

orchent.go

+36-2
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ var (
6161
delDep = app.Command("depdel", "delete a given deployment")
6262
delDepUuid = delDep.Arg("uuid", "the uuid of the deployment to delete").Required().String()
6363

64+
resetDep = app.Command("depreset", "reset the state of a given deployment")
65+
resetDepUuid = resetDep.Arg("uuid", "the uuid of the deployment to reset").Required().String()
66+
resetDepStatus = resetDep.Flag("status", "the state of the deployment to be set forcefully (allowed values: DELETE_FAILED)").Default("DELETE_FAILED").Enum("DELETE_FAILED")
67+
6468
logDep = app.Command("deplog", "get the log for given deployment")
6569
logDepUuid = logDep.Arg("uuid", "the uuid of the deployment").Required().String()
6670

@@ -217,7 +221,7 @@ func (depList OrchentDeploymentList) String() string {
217221
for _, link := range depList.Links {
218222
output = output + fmt.Sprintf(" %s\n", link)
219223
}
220-
output = output + fmt.Sprintln("\n")
224+
output = output + fmt.Sprintf("\n")
221225
for _, dep := range depList.Deployments {
222226
output = output + deployment_to_string(dep, 0)
223227
}
@@ -522,7 +526,7 @@ func get_deployment_extra_info(uuid string) {
522526

523527
} else {
524528
json.NewDecoder(resp.Body).Decode(orchentError)
525-
fmt.Printf("error processing extra info of %s:\n %s\n", uuid, resp.StatusCode)
529+
fmt.Printf("error processing extra info of %s:\n %d\n", uuid, resp.StatusCode)
526530
}
527531
}
528532

@@ -596,6 +600,30 @@ func deployment_delete(uuid string, base *sling.Sling) {
596600
}
597601
}
598602

603+
type StatusReset struct {
604+
Status string `json:"status,omitempty"`
605+
}
606+
607+
func deployment_reset(uuid string, status string, base *sling.Sling) {
608+
orchentError := new(OrchentError)
609+
610+
body := &StatusReset {
611+
Status: status,
612+
}
613+
base = base.BodyJSON(body).Patch("./deployments/" + uuid)
614+
_, err := base.Receive(nil, orchentError)
615+
if err != nil {
616+
fmt.Printf("error resetting state for deployment %s:\n %s\n", uuid, err)
617+
return
618+
}
619+
if is_error(orchentError) {
620+
fmt.Printf("error resetting state for deployment %s:\n %s\n", uuid, orchentError)
621+
} else {
622+
fmt.Printf("reset of deployment %s successfully triggered\n", uuid)
623+
}
624+
625+
}
626+
599627
func deployment_log(uuid string, base *sling.Sling) {
600628
orchentError := new(OrchentError)
601629
req, err := base.Get("./deployments/" + uuid + "/log").Request()
@@ -850,6 +878,12 @@ func main() {
850878
uuid := try_alias_uuid(*delDepUuid, aliases)
851879
deployment_delete(uuid, base)
852880

881+
case resetDep.FullCommand():
882+
baseUrl := get_base_url()
883+
base := base_connection(baseUrl)
884+
uuid := try_alias_uuid(*resetDepUuid, aliases)
885+
deployment_reset(uuid, *resetDepStatus, base)
886+
853887
case logDep.FullCommand():
854888
baseUrl := get_base_url()
855889
base := base_connection(baseUrl)

0 commit comments

Comments
 (0)