Skip to content

Commit

Permalink
diagnostics: correctly use cluster-context if specified
Browse files Browse the repository at this point in the history
If --cluster-context is specified and the context is present, use it as
the cluster-admin. The logic was backward and this gave an error before.
  • Loading branch information
sosiouxme committed Dec 14, 2017
1 parent 93e6d05 commit 428abd8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/oc/admin/diagnostics/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func (o DiagnosticsOptions) buildClusterDiagnostics(rawConfig *clientcmdapi.Conf
// attempts to find which context in the config might be a cluster-admin for the server in the current context.
func (o DiagnosticsOptions) findClusterClients(rawConfig *clientcmdapi.Config) (*rest.Config, kclientset.Interface, bool, string, error) {
if o.ClientClusterContext != "" { // user has specified cluster context to use
if context, exists := rawConfig.Contexts[o.ClientClusterContext]; exists {
if context, exists := rawConfig.Contexts[o.ClientClusterContext]; !exists {
configErr := fmt.Errorf("Specified '%s' as cluster-admin context, but it was not found in your client configuration.", o.ClientClusterContext)
o.Logger.Error("CED1003", configErr.Error())
return nil, nil, false, "", configErr
Expand Down

0 comments on commit 428abd8

Please sign in to comment.