Skip to content

Commit

Permalink
Address CRs
Browse files Browse the repository at this point in the history
- Add lock before setting
- Remove print statements
  • Loading branch information
kimlisa committed Apr 26, 2021
1 parent 5d58a63 commit c341b6b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/service/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (process *TeleportProcess) reconnectToAuthService(role teleport.Role) (*Con
if connector.Client != nil {
pingResponse, err := connector.Client.Ping(context.TODO())
if err == nil {
process.Config.AuthServerFeatures = *pingResponse.GetServerFeatures()
process.setAuthServerFeatures(*pingResponse.GetServerFeatures())
return connector, nil
}
process.log.Debugf("Connected client %v failed to execute test call: %v. Node or proxy credentials are out of sync.", role, err)
Expand Down
8 changes: 8 additions & 0 deletions lib/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import (
"github.com/gravitational/trace"

"github.com/gravitational/teleport"
"github.com/gravitational/teleport/api/client/proto"
"github.com/gravitational/teleport/api/client/webclient"
"github.com/gravitational/teleport/lib/auth"
"github.com/gravitational/teleport/lib/auth/native"
Expand Down Expand Up @@ -355,6 +356,13 @@ func (process *TeleportProcess) addConnector(connector *Connector) {
process.connectors[connector.ClientIdentity.ID.Role] = connector
}

func (process *TeleportProcess) setAuthServerFeatures(features proto.Features) {
process.Lock()
defer process.Unlock()

process.Config.AuthServerFeatures = features
}

// GetIdentity returns the process identity (credentials to the auth server) for a given
// teleport Role. A teleport process can have any combination of 3 roles: auth, node, proxy
// and they have their own identities
Expand Down
2 changes: 0 additions & 2 deletions lib/web/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -506,8 +506,6 @@ func (h *Handler) getUserContext(w http.ResponseWriter, r *http.Request, p httpr
return nil, trace.Wrap(err)
}

fmt.Println("--------------------- >>>> : ", h.authServerFeatures)

userContext, err := ui.NewUserContext(user, roleset, h.authServerFeatures)
if err != nil {
return nil, trace.Wrap(err)
Expand Down

0 comments on commit c341b6b

Please sign in to comment.