mirror of
https://github.com/ultravioletrs/cocos.git
synced 2026-06-23 04:10:25 +00:00
NOISSUE - Fix error handling in NewRemoveVMCmd to ensure proper connection checks before removing a VM (#488)
CI / ci (push) Has been cancelled
CI / ci (push) Has been cancelled
* Fix error handling in NewRemoveVMCmd to ensure proper connection checks before removing a VM Signed-off-by: Sammy Oina <sammyoina@gmail.com> * Update cli/manager.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Signed-off-by: Sammy Oina <sammyoina@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
38c2abb294
commit
4b657e5313
+4
-7
@@ -95,15 +95,12 @@ func (c *CLI) NewRemoveVMCmd() *cobra.Command {
|
||||
Args: cobra.ExactArgs(1),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
if c.managerClient == nil || c.connectErr != nil {
|
||||
if err := c.InitializeManagerClient(cmd); err == nil {
|
||||
defer c.Close()
|
||||
if err := c.InitializeManagerClient(cmd); err != nil {
|
||||
printError(cmd, "Failed to connect to manager: %v ❌ ", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if c.connectErr != nil {
|
||||
printError(cmd, "Failed to connect to manager: %v ❌ ", c.connectErr)
|
||||
return
|
||||
}
|
||||
defer c.Close()
|
||||
|
||||
cmd.Println("🔗 Removing virtual machine")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user