Skip to content

Commit

Permalink
fix release-eip and delete-cloud-disk false disable bug (#74)
Browse files Browse the repository at this point in the history
fix failing to specify release-eip and delete-cloud-disk to false
  • Loading branch information
wangrzneu authored Aug 15, 2023
1 parent 4fe794f commit 97f820c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cmd/uhost.go
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,8 @@ func NewCmdUHostDelete() *cobra.Command {
var uhostIDs *[]string
var isDestroy = sdk.Bool(false)
var yes *bool

var releaseEIP bool
var releaseUDisk bool
req := base.BizClient.NewTerminateUHostInstanceRequest()
cmd := &cobra.Command{
Use: "delete",
Expand All @@ -683,7 +684,8 @@ func NewCmdUHostDelete() *cobra.Command {
} else {
req.Destroy = sdk.Int(0)
}

req.ReleaseEIP = &releaseEIP
req.ReleaseUDisk = &releaseUDisk
reqs := make([]request.Common, len(*uhostIDs))
for idx, id := range *uhostIDs {
_req := *req
Expand All @@ -703,8 +705,8 @@ func NewCmdUHostDelete() *cobra.Command {
bindProjectID(req, flags)
req.Zone = cmd.Flags().String("zone", "", "Optional. availability zone")
isDestroy = cmd.Flags().Bool("destroy", false, "Optional. false,the uhost instance will be thrown to UHost recycle if you have permission; true,the uhost instance will be deleted directly")
req.ReleaseEIP = cmd.Flags().Bool("release-eip", true, "Optional. false,Unbind EIP only; true, Unbind EIP and release it")
req.ReleaseUDisk = cmd.Flags().Bool("delete-cloud-disk", true, "Optional. false, detach cloud disk only; true, detach cloud disk and delete it")
cmd.Flags().BoolVar(&releaseEIP, "release-eip", true, "Optional. false,Unbind EIP only; true, Unbind EIP and release it")
cmd.Flags().BoolVar(&releaseUDisk, "delete-cloud-disk", true, "Optional. false, detach cloud disk only; true, detach cloud disk and delete it")
yes = cmd.Flags().BoolP("yes", "y", false, "Optional. Do not prompt for confirmation.")
cmd.Flags().SetFlagValues("destroy", "true", "false")
cmd.Flags().SetFlagValues("release-eip", "true", "false")
Expand Down

0 comments on commit 97f820c

Please sign in to comment.