diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2023-02-23 14:32:30 +0100 |
|---|---|---|
| committer | Aleksandr Nogikh <wp32pw@gmail.com> | 2023-02-24 15:09:49 +0100 |
| commit | 2a9b3d2090e00fd8bc38104f8bcf758909abcf34 (patch) | |
| tree | ad7da6b3c7363898876d7dbcb050baf4e4b50ae7 /dashboard | |
| parent | ba831e54ddf50d7c407f9cfa1f48badf1066c1f7 (diff) | |
dashboard: report errors for outdated subsystem assignments
It might happen that the user-set subsystem no longer exists. It seems
not worth it to implement any automatic processing for that case. Let's
postpone it until it turns out to be really necessary.
For now let's just log an error.
Diffstat (limited to 'dashboard')
| -rw-r--r-- | dashboard/app/subsystem.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/dashboard/app/subsystem.go b/dashboard/app/subsystem.go index dfaa684ff..0b4300060 100644 --- a/dashboard/app/subsystem.go +++ b/dashboard/app/subsystem.go @@ -28,6 +28,9 @@ func reassignBugSubsystems(c context.Context, ns string, count int) error { rev := getSubsystemRevision(c, ns) for i, bugKey := range keys { if bugs[i].hasUserSubsystems() { + // It might be that the user-set subsystem no longer exists. + // For now let's just log an error in this case. + checkOutdatedSubsystems(c, service, bugs[i]) // If we don't set the latst revision, we'll have to update this // bug over and over again. err = updateBugSubsystems(c, bugKey, nil, updateRevision(rev)) @@ -84,6 +87,14 @@ func bugsToUpdateSubsystems(c context.Context, ns string, count int) ([]*Bug, [] return bugs, keys, nil } +func checkOutdatedSubsystems(c context.Context, service *subsystem.Service, bug *Bug) { + for _, item := range bug.Tags.Subsystems { + if service.ByName(item.Name) == nil { + log.Errorf(c, "ns=%s bug=%s subsystem %s no longer exists", bug.Namespace, bug.Title, item.Name) + } + } +} + type ( autoInference int userAssignment string |
