From 6bcee5cbed705b5b570d6b3b4fe866f639f85cfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=88=E8=BD=A9?= Date: Wed, 4 Dec 2024 09:42:41 +0800 Subject: [PATCH] fix(cloudmon): sync cloudproviders (#21733) --- pkg/cloudmon/resources/resources.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pkg/cloudmon/resources/resources.go b/pkg/cloudmon/resources/resources.go index fe3d068679..a5434a0f35 100644 --- a/pkg/cloudmon/resources/resources.go +++ b/pkg/cloudmon/resources/resources.go @@ -157,7 +157,9 @@ func (self *SBaseResources) increment(ctx context.Context) error { "order_by.1": "imported_at", "order": "asc", "filter.0": timeFilter, - "filter.1": "external_id.isnotempty()", + } + if self.manager.GetKeyword() != compute.Cloudproviders.GetKeyword() { + query["filter.1"] = "external_id.isnotempty()" } if self.manager.GetKeyword() == compute.Hosts.GetKeyword() { query["cloud_env"] = "private_or_onpremise" @@ -220,8 +222,11 @@ func (self *SBaseResources) decrement(ctx context.Context) error { "delete": "all", "@deleted": "true", "filter.0": timeFilter, - "filter.1": "external_id.isnotempty()", } + if self.manager.GetKeyword() != compute.Cloudproviders.GetKeyword() { + query["filter.1"] = "external_id.isnotempty()" + } + if self.manager.GetKeyword() == compute.Hosts.GetKeyword() { query["cloud_env"] = "private_or_onpremise" } @@ -279,8 +284,11 @@ func (self *SBaseResources) update(ctx context.Context) error { "order": "asc", "pending_delete": "all", "filter.0": timeFilter, - "filter.1": "external_id.isnotempty()", } + if self.manager.GetKeyword() != compute.Cloudproviders.GetKeyword() { + query["filter.1"] = "external_id.isnotempty()" + } + if self.manager.GetKeyword() == compute.Hosts.GetKeyword() { query["cloud_env"] = "private_or_onpremise" }