From b0d387e68501ad32233bb2009483d6d98d002d5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=88=E8=BD=A9?= Date: Wed, 4 Dec 2024 09:42:49 +0800 Subject: [PATCH] fix(cloudmon): sync cloudproviders (#21734) --- 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 3977627776..d902fff6f3 100644 --- a/pkg/cloudmon/resources/resources.go +++ b/pkg/cloudmon/resources/resources.go @@ -153,7 +153,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" @@ -216,8 +218,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" } @@ -275,8 +280,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" }