-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pager/og: safer teamID
retrieval
#39
Conversation
Seems like Opsgenie doesn't guarantee OwnerTeam to be present.
for _, u := range unmatched[i:] { | ||
for _, u := range toImport[i:] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this bug caused us to provision everyone regardless of the people who were selected 🙃 i'm going to follow up with a refactor + test. this is a quick fix for now.
@@ -211,6 +212,8 @@ func (c *Client) CreateUser(ctx context.Context, u SCIMUser) (*store.FhUser, err | |||
return nil, fmt.Errorf("creating user: %w", err) | |||
} | |||
if resp.StatusCode != http.StatusCreated { | |||
body, _ := io.ReadAll(resp.Body) | |||
console.Errorf("unexpected status code %d: %s\n", resp.StatusCode, body) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log more information when response code isn't expected — this should help users get better information and can help us figure out where to look.
if policy.Repeat != nil { | ||
repeatLimit = int64(policy.Repeat.Count) | ||
repeatInterval.Valid = true | ||
repeatInterval.String = fmt.Sprintf("PT%dM", policy.Repeat.WaitInterval) | ||
} | ||
teamID := sql.NullString{} | ||
if policy.OwnerTeam != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is apparently nil-able, which would cause panic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? And how? But these are things we're not meant to know I guess and we just accept them so here we are.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good. Let's do it.
Received a user report error on this:
Seems like Opsgenie doesn't guarantee OwnerTeam to be present.