OLD | NEW |
---|---|
1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 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 tsmon | 5 package tsmon |
6 | 6 |
7 import ( | 7 import ( |
8 "fmt" | 8 "fmt" |
9 "net/http" | 9 "net/http" |
10 "net/url" | 10 "net/url" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
92 return err | 92 return err |
93 case mon == nil: | 93 case mon == nil: |
94 return nil // tsmon is disabled | 94 return nil // tsmon is disabled |
95 } | 95 } |
96 | 96 |
97 // Monitoring is enabled, so get the expensive default values for hostna me, | 97 // Monitoring is enabled, so get the expensive default values for hostna me, |
98 // etc. | 98 // etc. |
99 if config.AutoGenHostname { | 99 if config.AutoGenHostname { |
100 fl.Target.AutoGenHostname = true | 100 fl.Target.AutoGenHostname = true |
101 } | 101 } |
102 if config.Hostname != "" { | |
103 fl.Target.DeviceHostname = config.Hostname | |
dsansome
2016/08/09 03:28:22
I would expect flags to override values from a con
Sergey Berezin
2016/08/10 01:49:16
Good catch, thanks! Done.
| |
104 fl.Target.TaskHostname = config.Hostname | |
105 } | |
106 if config.Region != "" { | |
107 fl.Target.DeviceRegion = config.Region | |
108 fl.Target.TaskRegion = config.Region | |
109 } | |
102 fl.Target.SetDefaultsFromHostname() | 110 fl.Target.SetDefaultsFromHostname() |
103 t, err := target.NewFromFlags(&fl.Target) | 111 t, err := target.NewFromFlags(&fl.Target) |
104 if err != nil { | 112 if err != nil { |
105 return err | 113 return err |
106 } | 114 } |
107 | 115 |
108 Initialize(c, mon, store.NewInMemory(t)) | 116 Initialize(c, mon, store.NewInMemory(t)) |
109 | 117 |
110 state := GetState(c) | 118 state := GetState(c) |
111 if state.Flusher != nil { | 119 if state.Flusher != nil { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
205 case "": | 213 case "": |
206 // Let the Authenticator choose. | 214 // Let the Authenticator choose. |
207 break | 215 break |
208 | 216 |
209 default: | 217 default: |
210 authOpts.Method = auth.ServiceAccountMethod | 218 authOpts.Method = auth.ServiceAccountMethod |
211 authOpts.ServiceAccountJSONPath = credentials | 219 authOpts.ServiceAccountJSONPath = credentials |
212 } | 220 } |
213 return auth.NewAuthenticator(ctx, auth.SilentLogin, authOpts).Client() | 221 return auth.NewAuthenticator(ctx, auth.SilentLogin, authOpts).Client() |
214 } | 222 } |
OLD | NEW |