From 8b4c9affe87c1140943082d6760ef99f1fdb9f5a Mon Sep 17 00:00:00 2001 From: Qiu Jian Date: Thu, 14 Nov 2019 10:54:42 +0800 Subject: [PATCH] fix: send full reason body for *_fail_reason --- pkg/cloudcommon/db/db_dispatcher.go | 4 ++-- pkg/compute/models/hosts.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/cloudcommon/db/db_dispatcher.go b/pkg/cloudcommon/db/db_dispatcher.go index 486dc9dad3..7ef5922d6f 100644 --- a/pkg/cloudcommon/db/db_dispatcher.go +++ b/pkg/cloudcommon/db/db_dispatcher.go @@ -670,14 +670,14 @@ func getModelExtraDetails(item IModel, ctx context.Context, extra *jsonutils.JSO err := item.ValidateDeleteCondition(ctx) if err != nil { extra.Add(jsonutils.JSONFalse, "can_delete") - extra.Add(jsonutils.NewString(httputils.ErrorMsg(err)), "delete_fail_reason") + extra.Add(jsonutils.NewString(err.Error()), "delete_fail_reason") } else { extra.Add(jsonutils.JSONTrue, "can_delete") } err = item.ValidateUpdateCondition(ctx) if err != nil { extra.Add(jsonutils.JSONFalse, "can_update") - extra.Add(jsonutils.NewString(httputils.ErrorMsg(err)), "update_fail_reason") + extra.Add(jsonutils.NewString(err.Error()), "update_fail_reason") } else { extra.Add(jsonutils.JSONTrue, "can_update") } diff --git a/pkg/compute/models/hosts.go b/pkg/compute/models/hosts.go index c781f37394..2ea5197db5 100644 --- a/pkg/compute/models/hosts.go +++ b/pkg/compute/models/hosts.go @@ -2338,7 +2338,7 @@ func (self *SHost) getMoreDetails(ctx context.Context, extra *jsonutils.JSONDict extra.Add(jsonutils.JSONTrue, "can_prepare") } else { extra.Add(jsonutils.JSONFalse, "can_prepare") - extra.Add(jsonutils.NewString(httputils.ErrorMsg(err)), "prepare_fail_reason") + extra.Add(jsonutils.NewString(err.Error()), "prepare_fail_reason") } }