Skip to content

Commit

Permalink
Merge pull request #904 from gravitational/rjones/get-roles-fix
Browse files Browse the repository at this point in the history
Skip over expired Roles
  • Loading branch information
russjones authored Apr 6, 2017
2 parents e05a5c3 + d330d68 commit bfd76f1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/services/local/access.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,16 @@ func (s *AccessService) GetRoles() ([]services.Role, error) {
if err != nil {
return nil, trace.Wrap(err)
}
out := make([]services.Role, len(keys))
for i, name := range keys {
var out []services.Role
for _, name := range keys {
u, err := s.GetRole(name)
if err != nil {
if trace.IsNotFound(err) {
continue
}
return nil, trace.Wrap(err)
}
out[i] = u
out = append(out, u)
}
sort.Sort(services.SortedRoles(out))
return out, nil
Expand Down

0 comments on commit bfd76f1

Please sign in to comment.