From 3e4b8fed08e1011db9993e03ec7d63b12852031d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=88=E8=BD=A9?= Date: Tue, 22 Jan 2019 13:53:37 +0800 Subject: [PATCH] =?UTF-8?q?=E9=81=BF=E5=85=8Dproject=E6=9C=AA=E6=89=BE?= =?UTF-8?q?=E5=88=B0=E7=9B=B4=E6=8E=A5=E8=BF=94=E5=9B=9Eerr?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/cloudcommon/db/tenantcache.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/cloudcommon/db/tenantcache.go b/pkg/cloudcommon/db/tenantcache.go index 6b8f4c3f69..53d8951919 100644 --- a/pkg/cloudcommon/db/tenantcache.go +++ b/pkg/cloudcommon/db/tenantcache.go @@ -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(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 }