From f14ec60a763d88a2ca096329f170cb4906981949 Mon Sep 17 00:00:00 2001 From: Zexi Li Date: Fri, 16 Oct 2020 11:59:23 +0800 Subject: [PATCH] fix: get images distinct field --- pkg/mcclient/modules/mod_images.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/mcclient/modules/mod_images.go b/pkg/mcclient/modules/mod_images.go index c4fdd2278f..a8bdbc4276 100644 --- a/pkg/mcclient/modules/mod_images.go +++ b/pkg/mcclient/modules/mod_images.go @@ -93,6 +93,12 @@ func (this *ImageManager) GetByName(session *mcclient.ClientSession, id string, } func (this *ImageManager) Get(session *mcclient.ClientSession, id string, params jsonutils.JSONObject) (jsonutils.JSONObject, error) { + // hack: some GetPropertiesMethod must use HTTP GET action like: + // - GET /images/distinct-field + // hard code this id currently, should found a better solution + if ok, _ := utils.InStringArray(id, []string{"distinct-field"}); ok { + return this.ResourceManager.Get(session, id, params) + } r, e := this.GetById(session, id, params) if e == nil { return r, e