mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-28 11:37:42 +01:00
Merge pull request #13591 from heww/fix-issue-13387
fix(quota): ignore the fail when getting reference of quota
This commit is contained in:
commit
90c5505430
@ -5,6 +5,13 @@ Fixes issue https://github.com/goharbor/harbor/issues/13317
|
|||||||
UPDATE role SET role_id=4 WHERE name='maintainer' AND role_id!=4;
|
UPDATE role SET role_id=4 WHERE name='maintainer' AND role_id!=4;
|
||||||
UPDATE role SET role_id=5 WHERE name='limitedGuest' AND role_id!=5;
|
UPDATE role SET role_id=5 WHERE name='limitedGuest' AND role_id!=5;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Clean the dirty data in quota/quota_usage
|
||||||
|
Remove quota/quota_usage when the referenced project not exists
|
||||||
|
*/
|
||||||
|
DELETE FROM quota WHERE reference='project' AND reference_id::integer NOT IN (SELECT project_id FROM project WHERE deleted=FALSE);
|
||||||
|
DELETE FROM quota_usage WHERE reference='project' AND reference_id::integer NOT IN (SELECT project_id FROM project WHERE deleted=FALSE);
|
||||||
|
|
||||||
ALTER TABLE schedule ADD COLUMN IF NOT EXISTS cron_type varchar(64);
|
ALTER TABLE schedule ADD COLUMN IF NOT EXISTS cron_type varchar(64);
|
||||||
ALTER TABLE robot ADD COLUMN IF NOT EXISTS secret varchar(2048);
|
ALTER TABLE robot ADD COLUMN IF NOT EXISTS secret varchar(2048);
|
||||||
|
|
||||||
|
@ -132,10 +132,11 @@ func (c *controller) assembleQuota(ctx context.Context, q *quota.Quota, opts *Op
|
|||||||
|
|
||||||
ref, err := driver.Load(ctx, q.ReferenceID)
|
ref, err := driver.Load(ctx, q.ReferenceID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
log.G(ctx).Warningf("failed to load referenced %s object %s for quota %d, error %v",
|
||||||
|
q.Reference, q.ReferenceID, q.ID, err)
|
||||||
|
} else {
|
||||||
|
q.Ref = ref
|
||||||
}
|
}
|
||||||
|
|
||||||
q.Ref = ref
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return q, nil
|
return q, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user