Skip to content

Commit 428abd8

Browse files
committed
diagnostics: correctly use cluster-context if specified
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.
1 parent 93e6d05 commit 428abd8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/oc/admin/diagnostics/cluster.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func (o DiagnosticsOptions) buildClusterDiagnostics(rawConfig *clientcmdapi.Conf
126126
// attempts to find which context in the config might be a cluster-admin for the server in the current context.
127127
func (o DiagnosticsOptions) findClusterClients(rawConfig *clientcmdapi.Config) (*rest.Config, kclientset.Interface, bool, string, error) {
128128
if o.ClientClusterContext != "" { // user has specified cluster context to use
129-
if context, exists := rawConfig.Contexts[o.ClientClusterContext]; exists {
129+
if context, exists := rawConfig.Contexts[o.ClientClusterContext]; !exists {
130130
configErr := fmt.Errorf("Specified '%s' as cluster-admin context, but it was not found in your client configuration.", o.ClientClusterContext)
131131
o.Logger.Error("CED1003", configErr.Error())
132132
return nil, nil, false, "", configErr

0 commit comments

Comments
 (0)