| OLD | NEW |
| 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 common | 5 package common |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "fmt" | 8 "fmt" |
| 9 "time" | 9 "time" |
| 10 | 10 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 logging.Infof(c, "revisions differ (old %s, new %s), updating", | 157 logging.Infof(c, "revisions differ (old %s, new %s), updating", |
| 158 oldConfig.Revision, newConfig.Revision) | 158 oldConfig.Revision, newConfig.Revision) |
| 159 return datastore.Put(c, &newConfig) | 159 return datastore.Put(c, &newConfig) |
| 160 }, nil) | 160 }, nil) |
| 161 | 161 |
| 162 if err != nil { | 162 if err != nil { |
| 163 return fmt.Errorf("failed to update config entry in transaction"
, err) | 163 return fmt.Errorf("failed to update config entry in transaction"
, err) |
| 164 } | 164 } |
| 165 logging.Infof(c, "successfully updated to new config") | 165 logging.Infof(c, "successfully updated to new config") |
| 166 | 166 |
| 167 if err := ensurePubSubSubscribed(c, settings); err != nil { |
| 168 return fmt.Errorf("count not ensure pubsub subscriptions: %s", e
rr) |
| 169 } |
| 170 |
| 167 return nil | 171 return nil |
| 168 } | 172 } |
| 169 | 173 |
| 170 // UpdateProjectConfigs internal project configuration based off luci-config. | 174 // UpdateProjectConfigs internal project configuration based off luci-config. |
| 171 // update updates Milo's configuration based off luci config. This includes | 175 // update updates Milo's configuration based off luci config. This includes |
| 172 // scanning through all project and extract all console configs. | 176 // scanning through all project and extract all console configs. |
| 173 func UpdateProjectConfigs(c context.Context) error { | 177 func UpdateProjectConfigs(c context.Context) error { |
| 174 cfgName := info.AppID(c) + ".cfg" | 178 cfgName := info.AppID(c) + ".cfg" |
| 175 | 179 |
| 176 var ( | 180 var ( |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 if err != nil { | 275 if err != nil { |
| 272 return nil, err | 276 return nil, err |
| 273 } | 277 } |
| 274 for _, cs := range p.Consoles { | 278 for _, cs := range p.Consoles { |
| 275 if cs.Name == consoleName { | 279 if cs.Name == consoleName { |
| 276 return cs, nil | 280 return cs, nil |
| 277 } | 281 } |
| 278 } | 282 } |
| 279 return nil, fmt.Errorf("Console %s not found in project %s", consoleName
, projName) | 283 return nil, fmt.Errorf("Console %s not found in project %s", consoleName
, projName) |
| 280 } | 284 } |
| OLD | NEW |