Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(608)

Unified Diff: scheduler/appengine/apiservers/scheduler.go

Issue 2993933002: scheduler ACLs: improve ACL-related error handling in UI and API. (Closed)
Patch Set: rebase Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | scheduler/appengine/apiservers/scheduler_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scheduler/appengine/apiservers/scheduler.go
diff --git a/scheduler/appengine/apiservers/scheduler.go b/scheduler/appengine/apiservers/scheduler.go
index e0300ad23783af2f5b96eaddac1093e8b3899d3d..a5b36c5e08de24fc3063ce231840c31f285119bb 100644
--- a/scheduler/appengine/apiservers/scheduler.go
+++ b/scheduler/appengine/apiservers/scheduler.go
@@ -74,21 +74,16 @@ func (s SchedulerServer) GetJobs(ctx context.Context, in *scheduler.JobsRequest)
}
func (s SchedulerServer) GetInvocations(ctx context.Context, in *scheduler.InvocationsRequest) (*scheduler.InvocationsReply, error) {
- ejob, err := s.Engine.GetVisibleJob(ctx, getJobId(in.GetJobRef()))
- if err != nil {
- return nil, grpc.Errorf(codes.Internal, "internal error: %s", err)
- }
- if ejob == nil {
- return nil, grpc.Errorf(codes.NotFound, "Job does not exist or you have no access")
- }
-
pageSize := 50
if in.PageSize > 0 && int(in.PageSize) < pageSize {
pageSize = int(in.PageSize)
}
- einvs, cursor, err := s.Engine.ListVisibleInvocations(ctx, ejob.JobID, pageSize, in.GetCursor())
- if err != nil {
+ einvs, cursor, err := s.Engine.ListVisibleInvocations(ctx, getJobId(in.GetJobRef()), pageSize, in.GetCursor())
+ switch {
+ case err == engine.ErrNoSuchJob:
+ return nil, grpc.Errorf(codes.NotFound, "Job does not exist or no access")
+ case err != nil:
return nil, grpc.Errorf(codes.Internal, "internal error: %s", err)
}
invs := make([]*scheduler.Invocation, len(einvs))
@@ -96,8 +91,8 @@ func (s SchedulerServer) GetInvocations(ctx context.Context, in *scheduler.Invoc
invs[i] = &scheduler.Invocation{
InvocationRef: &scheduler.InvocationRef{
JobRef: &scheduler.JobRef{
- Project: ejob.ProjectID,
- Job: ejob.GetJobName(),
+ Project: in.GetJobRef().GetProject(),
+ Job: in.GetJobRef().GetJob(),
},
InvocationId: einv.ID,
},
« no previous file with comments | « no previous file | scheduler/appengine/apiservers/scheduler_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698