mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #17685 from ioito/hotfix/qx-cloudmon-account-update
fix(cloudmon): cloudaccout update
This commit is contained in:
@@ -305,6 +305,9 @@ func (self ServerDetails) GetMetricTags() map[string]string {
|
||||
}
|
||||
for k, v := range self.Metadata {
|
||||
if strings.HasPrefix(k, db.USER_TAG_PREFIX) {
|
||||
if strings.Contains(k, "login_key") || strings.Contains(v, "=") {
|
||||
continue
|
||||
}
|
||||
ret[k] = v
|
||||
}
|
||||
}
|
||||
|
||||
@@ -447,7 +447,7 @@ func (job *SCronJob) runJobInWorker(isStart bool, startTime time.Time) {
|
||||
}
|
||||
}()
|
||||
|
||||
log.Debugf("Cron job: %s started, startTime: %s", job.Name, startTime)
|
||||
log.Debugf("Cron job: %s started, startTime: %s", job.Name, startTime.Format(time.RFC3339))
|
||||
ctx := context.Background()
|
||||
ctx = context.WithValue(ctx, appctx.APP_CONTEXT_KEY_APPNAME, fmt.Sprintf("%s/cron-service", consts.GetServiceName()))
|
||||
ctx = context.WithValue(ctx, appctx.APP_CONTEXT_KEY_TASKNAME, fmt.Sprintf("%s-%d", job.Name, time.Now().Unix()))
|
||||
|
||||
@@ -171,9 +171,9 @@ func (self *SBaseResources) init(ctx context.Context) error {
|
||||
|
||||
func (self *SBaseResources) increment(ctx context.Context) error {
|
||||
s := auth.GetAdminSession(ctx, options.Options.Region)
|
||||
timeFilter := fmt.Sprintf("imported_at.gt('%s')", self.importedAt)
|
||||
timeFilter := fmt.Sprintf("imported_at.gt('%s')", self.importedAt.Format(time.RFC3339))
|
||||
if self.importedAt.IsZero() {
|
||||
timeFilter = fmt.Sprintf("created_at.gt('%s')", self.createdAt)
|
||||
timeFilter = fmt.Sprintf("created_at.gt('%s')", self.createdAt.Format(time.RFC3339))
|
||||
}
|
||||
query := map[string]interface{}{
|
||||
"limit": 20,
|
||||
@@ -239,7 +239,7 @@ func (self *SBaseResources) increment(ctx context.Context) error {
|
||||
|
||||
func (self *SBaseResources) decrement(ctx context.Context) error {
|
||||
s := auth.GetAdminSession(ctx, options.Options.Region)
|
||||
timeFilter := fmt.Sprintf("deleted_at.gt('%s')", self.deletedAt)
|
||||
timeFilter := fmt.Sprintf("deleted_at.gt('%s')", self.deletedAt.Format(time.RFC3339))
|
||||
query := map[string]interface{}{
|
||||
"limit": 20,
|
||||
"scope": "system",
|
||||
@@ -271,6 +271,7 @@ func (self *SBaseResources) decrement(ctx context.Context) error {
|
||||
baseInfo := sBaseInfo{}
|
||||
ret[i].Unmarshal(&baseInfo)
|
||||
if len(baseInfo.ExternalId) == 0 && self.manager.GetKeyword() != compute.Cloudproviders.GetKeyword() &&
|
||||
self.manager.GetKeyword() != compute.Cloudaccounts.GetKeyword() &&
|
||||
self.manager.GetKeyword() != identity.Projects.GetKeyword() {
|
||||
continue
|
||||
}
|
||||
@@ -301,7 +302,7 @@ func (self *SBaseResources) decrement(ctx context.Context) error {
|
||||
|
||||
func (self *SBaseResources) update(ctx context.Context) error {
|
||||
s := auth.GetAdminSession(ctx, options.Options.Region)
|
||||
timeFilter := fmt.Sprintf("updated_at.gt('%s')", self.updatedAt)
|
||||
timeFilter := fmt.Sprintf("updated_at.gt('%s')", self.updatedAt.Format(time.RFC3339))
|
||||
query := map[string]interface{}{
|
||||
"limit": 20,
|
||||
"scope": "system",
|
||||
@@ -334,10 +335,10 @@ func (self *SBaseResources) update(ctx context.Context) error {
|
||||
if self.manager.GetKeyword() == identity.Projects.GetKeyword() {
|
||||
projectTags.SetTags(baseInfo.Id, baseInfo.Metadata)
|
||||
}
|
||||
if len(baseInfo.ExternalId) == 0 {
|
||||
continue
|
||||
}
|
||||
key := baseInfo.ExternalId
|
||||
if len(key) == 0 {
|
||||
key = baseInfo.Id
|
||||
}
|
||||
self.resourceLock.Lock()
|
||||
self.Resources[key] = ret[i]
|
||||
self.resourceLock.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user