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 cli | 5 package cli |
6 | 6 |
7 import ( | 7 import ( |
8 "flag" | 8 "flag" |
9 "fmt" | 9 "fmt" |
10 "net/http" | 10 "net/http" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 default: | 116 default: |
117 return "", errors.New("a Coordinator host must be specified (-ho
st)") | 117 return "", errors.New("a Coordinator host must be specified (-ho
st)") |
118 } | 118 } |
119 } | 119 } |
120 | 120 |
121 // coordinatorClient returns a Coordinator client for the specified host. If | 121 // coordinatorClient returns a Coordinator client for the specified host. If |
122 // no host is provided, the command-line host will be used. | 122 // no host is provided, the command-line host will be used. |
123 func (a *application) coordinatorClient(host string) (*coordinator.Client, error
) { | 123 func (a *application) coordinatorClient(host string) (*coordinator.Client, error
) { |
124 host, err := a.resolveHost(host) | 124 host, err := a.resolveHost(host) |
125 if err != nil { | 125 if err != nil { |
126 » » return nil, errors.Annotate(err).Err() | 126 » » return nil, errors.Annotate(err, "").Err() |
127 } | 127 } |
128 | 128 |
129 // Get our Coordinator client instance. | 129 // Get our Coordinator client instance. |
130 prpcClient := prpc.Client{ | 130 prpcClient := prpc.Client{ |
131 C: a.httpClient, | 131 C: a.httpClient, |
132 Host: host, | 132 Host: host, |
133 Options: prpc.DefaultOptions(), | 133 Options: prpc.DefaultOptions(), |
134 } | 134 } |
135 prpcClient.Options.Insecure = a.insecure | 135 prpcClient.Options.Insecure = a.insecure |
136 return coordinator.NewClient(&prpcClient), nil | 136 return coordinator.NewClient(&prpcClient), nil |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 } | 219 } |
220 | 220 |
221 if a.httpClient, err = auth.NewAuthenticator(ctx, auth.OptionalLogin, au
thOpts).Client(); err != nil { | 221 if a.httpClient, err = auth.NewAuthenticator(ctx, auth.OptionalLogin, au
thOpts).Client(); err != nil { |
222 log.Errorf(log.SetError(ctx, err), "Failed to create authenticat
ed client.") | 222 log.Errorf(log.SetError(ctx, err), "Failed to create authenticat
ed client.") |
223 return 1 | 223 return 1 |
224 } | 224 } |
225 | 225 |
226 a.Context = ctx | 226 a.Context = ctx |
227 return subcommands.Run(&a, flags.Args()) | 227 return subcommands.Run(&a, flags.Args()) |
228 } | 228 } |
OLD | NEW |