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

Side by Side Diff: milo/appengine/settings/config.go

Issue 2275123002: Milo: pRPC endpoint for getting Buildbot master data (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: Renamed stuff Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « milo/appengine/settings/acl_test.go ('k') | milo/appengine/settings/config_test.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The LUCI Authors. All rights reserved. 1 // Copyright 2016 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package settings 5 package settings
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "strings" 9 "strings"
10 10
(...skipping 12 matching lines...) Expand all
23 // name. 23 // name.
24 ID string `gae:"$id"` 24 ID string `gae:"$id"`
25 // The luci-cfg name of the project. 25 // The luci-cfg name of the project.
26 Name string 26 Name string
27 // The Project data in protobuf binary format. 27 // The Project data in protobuf binary format.
28 Data []byte `gae:",noindex"` 28 Data []byte `gae:",noindex"`
29 } 29 }
30 30
31 func UpdateHandler(ctx *router.Context) { 31 func UpdateHandler(ctx *router.Context) {
32 c, h := ctx.Context, ctx.Writer 32 c, h := ctx.Context, ctx.Writer
33 » err := update(c) 33 » err := Update(c)
34 if err != nil { 34 if err != nil {
35 logging.WithError(err).Errorf(c, "Update Handler encountered err or") 35 logging.WithError(err).Errorf(c, "Update Handler encountered err or")
36 h.WriteHeader(500) 36 h.WriteHeader(500)
37 } 37 }
38 logging.Infof(c, "Successfully completed") 38 logging.Infof(c, "Successfully completed")
39 h.WriteHeader(200) 39 h.WriteHeader(200)
40 } 40 }
41 41
42 // Update internal configuration based off luci-cfg. 42 // Update internal configuration based off luci-cfg.
43 // update updates Milo's configuration based off luci config. This includes 43 // update updates Milo's configuration based off luci config. This includes
44 // scanning through all project and extract all console configs. 44 // scanning through all project and extract all console configs.
45 func update(c context.Context) error { 45 func Update(c context.Context) error {
46 cfgName := info.Get(c).AppID() + ".cfg" 46 cfgName := info.Get(c).AppID() + ".cfg"
47 cfgs, err := config.GetProjectConfigs(c, cfgName, false) 47 cfgs, err := config.GetProjectConfigs(c, cfgName, false)
48 if err != nil { 48 if err != nil {
49 logging.WithError(err).Errorf(c, "Encountered error while gettin g project config for %s", cfgName) 49 logging.WithError(err).Errorf(c, "Encountered error while gettin g project config for %s", cfgName)
50 return err 50 return err
51 } 51 }
52 // A map of project ID to project. 52 // A map of project ID to project.
53 projects := map[string]*Project{} 53 projects := map[string]*Project{}
54 for _, cfg := range cfgs { 54 for _, cfg := range cfgs {
55 pathParts := strings.SplitN(cfg.ConfigSet, "/", 2) 55 pathParts := strings.SplitN(cfg.ConfigSet, "/", 2)
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 if err != nil { 144 if err != nil {
145 return nil, err 145 return nil, err
146 } 146 }
147 for _, cs := range p.Consoles { 147 for _, cs := range p.Consoles {
148 if cs.Name == consoleName { 148 if cs.Name == consoleName {
149 return cs, nil 149 return cs, nil
150 } 150 }
151 } 151 }
152 return nil, fmt.Errorf("Console %s not found in project %s", consoleName , projName) 152 return nil, fmt.Errorf("Console %s not found in project %s", consoleName , projName)
153 } 153 }
OLDNEW
« no previous file with comments | « milo/appengine/settings/acl_test.go ('k') | milo/appengine/settings/config_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698