Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Commit

Permalink
Add flag to have openstack client re-auth when token expires
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Sloka <steves@heptio.com>
  • Loading branch information
stevesloka committed Aug 23, 2018
1 parent 2ff1fc6 commit 0d5b4cb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions discovery/cmd/openstack-discoverer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ func main() {
Password: password,
DomainName: userDomainName,
TenantName: tenantName,
AllowReauth: true,
}

if err := gopheropenstack.Authenticate(osClient, osAuthOptions); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions discovery/pkg/openstack/httplogger.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
package openstack

import (
"fmt"
"log"
"math"
"net/http"
"net/http/httptrace"
Expand Down Expand Up @@ -56,7 +56,7 @@ func (lrt *LogRoundTripper) RoundTrip(request *http.Request) (*http.Response, er

if response.StatusCode == http.StatusUnauthorized {
if lrt.numReauthAttempts == 3 {
return response, fmt.Errorf("tried to re-authenticate 3 times with no success")
log.Fatal("tried to re-authenticate 3 times with no success")
}
lrt.numReauthAttempts++
}
Expand Down

0 comments on commit 0d5b4cb

Please sign in to comment.