Automatic merge from release/2.3.0 -> release/2.4.0

* commit '0aafe01ee8d8934f54b75b1c2366c5dd72857101':
  避免project未找到直接返回err
This commit is contained in:
邱剑
2019-01-22 16:18:37 +08:00
+5
View File
@@ -10,6 +10,8 @@ import (
"yunion.io/x/onecloud/pkg/cloudcommon/consts"
"yunion.io/x/onecloud/pkg/cloudcommon/db/lockman"
"yunion.io/x/onecloud/pkg/util/httputils"
)
type STenantCacheManager struct {
@@ -81,6 +83,9 @@ func (manager *STenantCacheManager) fetchTenantFromKeystone(ctx context.Context,
s := auth.GetAdminSession(ctx, consts.GetRegion(), "v1")
tenant, err := modules.Projects.Get(s, idStr, nil)
if err != nil {
if je, ok := err.(*httputils.JSONClientError); ok && je.Code == 404 {
return nil, sql.ErrNoRows
}
log.Errorf("fetch project fail %s", err)
return nil, err
}