@@ -125,26 +125,21 @@ func (o LogoutOptions) RunLogout() error {
125
125
return err
126
126
}
127
127
128
- errs := []error {}
129
128
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." )
129
+ if serverErr != nil {
130
+ glog .V (1 ).Infof ("%v\n " , serverErr )
138
131
}
139
132
140
- err = kutilerrors .Flatten (kutilerrors .NewAggregate (errs ))
141
- if err != nil {
142
- glog .V (1 ).Infof ("%v\n " , err )
143
- }
133
+ configErr := deleteTokenFromConfig (* o .StartingKubeConfig , o .PathOptions , token )
134
+ if configErr == nil {
135
+ glog .V (1 ).Infof ("Removed token from your local configuration.\n \n " )
144
136
145
- fmt .Fprintf (o .Out , "Logged %q out on %q\n " , userInfo .Name , o .Config .Host )
137
+ // return successful message to user, even if serverErr != nil, as long as removing
138
+ // the token from the client config did not result in an error
139
+ fmt .Fprintf (o .Out , "Logged %q out on %q\n " , userInfo .Name , o .Config .Host )
140
+ }
146
141
147
- return nil
142
+ return configErr
148
143
}
149
144
150
145
func deleteTokenFromConfig (config kclientcmdapi.Config , pathOptions * kclientcmd.PathOptions , bearerToken string ) error {
0 commit comments