searching for panic
This commit is contained in:
@@ -83,7 +83,20 @@ func (v *Vcenter) Login(vUrl string) error {
|
||||
|
||||
func (v *Vcenter) Logout() error {
|
||||
v.Logger.Debug("vcenter logging out")
|
||||
return v.client.Logout(v.ctx)
|
||||
|
||||
if v.ctx == nil {
|
||||
v.Logger.Warn("Nil context, unable to logout")
|
||||
return nil
|
||||
}
|
||||
|
||||
if v.client.Valid() {
|
||||
v.Logger.Debug("vcenter client is valid. Logging out")
|
||||
return v.client.Logout(v.ctx)
|
||||
} else {
|
||||
v.Logger.Debug("vcenter client is not valid")
|
||||
return nil
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (v *Vcenter) FindVMByName(vmName string) ([]mo.VirtualMachine, error) {
|
||||
|
Reference in New Issue
Block a user