Skip to content

Commit

Permalink
Added force parameter in deletion request (#62)
Browse files Browse the repository at this point in the history
* Added force parameter in deletion request

* Fixed description of force parameter

* Modified descritpion of force parameter

---------

Co-authored-by: Luca Giommi <[email protected]>
  • Loading branch information
lgiommi and lgiommi authored Mar 18, 2024
1 parent fff8db0 commit 8060ab5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions orchent.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ var (
templateDepUuid = depTemplate.Arg("uuid", "the uuid of the deployment to get the template").Required().String()

delDep = app.Command("depdel", "delete a given deployment")
delForce = delDep.Flag("force", "force the deletion of a deployment. Some of the resources created may not be removed").Default("false").Bool()
delDepUuid = delDep.Arg("uuid", "the uuid of the deployment to delete").Required().String()

resetDep = app.Command("depreset", "reset the state of a given deployment")
Expand Down Expand Up @@ -586,9 +587,10 @@ func deployment_get_template(uuid string, base *sling.Sling) {
}
}

func deployment_delete(uuid string, base *sling.Sling) {
func deployment_delete(uuid string, delForce bool, base *sling.Sling) {
orchentError := new(OrchentError)
_, err := base.Delete("./deployments/"+uuid).Receive(nil, orchentError)

_, err := base.Delete("./deployments/"+uuid+"?force="+strconv.FormatBool(delForce)).Receive(nil, orchentError)
if err != nil {
fmt.Printf("error deleting deployment %s:\n %s\n", uuid, err)
return
Expand Down Expand Up @@ -876,7 +878,7 @@ func main() {
baseUrl := get_base_url()
base := base_connection(baseUrl)
uuid := try_alias_uuid(*delDepUuid, aliases)
deployment_delete(uuid, base)
deployment_delete(uuid, *delForce, base)

case resetDep.FullCommand():
baseUrl := get_base_url()
Expand Down

0 comments on commit 8060ab5

Please sign in to comment.