@@ -12,7 +12,6 @@ import (
12
12
kclientcmd "k8s.io/kubernetes/pkg/client/unversioned/clientcmd"
13
13
kclientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api"
14
14
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
15
- kutilerrors "k8s.io/kubernetes/pkg/util/errors"
16
15
17
16
"github.com/openshift/origin/pkg/client"
18
17
"github.com/openshift/origin/pkg/cmd/cli/config"
@@ -125,26 +124,21 @@ func (o LogoutOptions) RunLogout() error {
125
124
return err
126
125
}
127
126
128
- errs := []error {}
129
127
serverErr := client .OAuthAccessTokens ().Delete (token )
130
- errs = append (errs , serverErr )
131
-
132
- if configErr := deleteTokenFromConfig (* o .StartingKubeConfig , o .PathOptions , token ); configErr != nil {
133
- errs = append (errs , configErr )
134
- } else if serverErr != nil {
135
- // if token was not able to be deleted using api but was successfully removed
136
- // from client config, log brief explanation that token was still removed locally
137
- glog .V (1 ).Infof ("%s\n \n " , "An error ocurred deleting the token on the server. The token has been removed from your local configuration." )
128
+ if serverErr != nil {
129
+ glog .V (1 ).Infof ("%v\n " , serverErr )
138
130
}
139
131
140
- err = kutilerrors .Flatten (kutilerrors .NewAggregate (errs ))
141
- if err != nil {
142
- glog .V (1 ).Infof ("%v\n " , err )
143
- }
132
+ configErr := deleteTokenFromConfig (* o .StartingKubeConfig , o .PathOptions , token )
133
+ if configErr == nil {
134
+ glog .V (1 ).Infof ("Removed token from your local configuration.\n \n " )
144
135
145
- fmt .Fprintf (o .Out , "Logged %q out on %q\n " , userInfo .Name , o .Config .Host )
136
+ // return successful message to user, even if serverErr != nil, as long as
137
+ // removing the token from the client config did not result in an error
138
+ fmt .Fprintf (o .Out , "Logged %q out on %q\n " , userInfo .Name , o .Config .Host )
139
+ }
146
140
147
- return nil
141
+ return configErr
148
142
}
149
143
150
144
func deleteTokenFromConfig (config kclientcmdapi.Config , pathOptions * kclientcmd.PathOptions , bearerToken string ) error {
0 commit comments