mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 02:37:24 +08:00
* fix(host): host register return wrong error value * fix(host): host handlers use gotypes check ret value is nil
This commit is contained in:
@@ -22,6 +22,7 @@ import (
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/pkg/gotypes"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
computeapi "yunion.io/x/onecloud/pkg/apis/compute"
|
||||
@@ -138,7 +139,7 @@ func guestActions(f actionFunc) appsrv.FilterHandler {
|
||||
res, err := f(ctx, userCred, sid, body)
|
||||
if err != nil {
|
||||
hostutils.Response(ctx, w, err)
|
||||
} else if res != nil {
|
||||
} else if !gotypes.IsNil(res) {
|
||||
hostutils.Response(ctx, w, res)
|
||||
} else {
|
||||
hostutils.ResponseOk(ctx, w)
|
||||
|
||||
@@ -23,6 +23,7 @@ import (
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/gotypes"
|
||||
"yunion.io/x/pkg/utils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/appsrv"
|
||||
@@ -79,7 +80,7 @@ func hostActions(f actionFunc) appsrv.FilterHandler {
|
||||
res, err := f(ctx, sid, body)
|
||||
if err != nil {
|
||||
hostutils.Response(ctx, w, err)
|
||||
} else if res != nil {
|
||||
} else if !gotypes.IsNil(res) {
|
||||
hostutils.Response(ctx, w, res)
|
||||
} else {
|
||||
hostutils.ResponseOk(ctx, w)
|
||||
|
||||
@@ -1225,25 +1225,25 @@ func (h *SHostInfo) register() {
|
||||
eg := errgroup.Group{}
|
||||
eg.Go(func() error {
|
||||
if e := h.initCgroup(); e != nil {
|
||||
return errors.Wrap(err, "initCgroup")
|
||||
return errors.Wrap(e, "initCgroup")
|
||||
}
|
||||
return nil
|
||||
})
|
||||
eg.Go(func() error {
|
||||
if e := h.initHostNetworks(hostInfo); e != nil {
|
||||
return errors.Wrap(err, "initHostNetworks")
|
||||
return errors.Wrap(e, "initHostNetworks")
|
||||
}
|
||||
return nil
|
||||
})
|
||||
eg.Go(func() error {
|
||||
if e := h.initIsolatedDevices(); e != nil {
|
||||
return errors.Wrap(err, "initIsolatedDevices")
|
||||
return errors.Wrap(e, "initIsolatedDevices")
|
||||
}
|
||||
return nil
|
||||
})
|
||||
eg.Go(func() error {
|
||||
if e := h.initStorages(); e != nil {
|
||||
return errors.Wrap(err, "initStorages")
|
||||
return errors.Wrap(e, "initStorages")
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user