-
Notifications
You must be signed in to change notification settings - Fork 24
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
🐛 azure: fail gracefully if unable to get security contacts #5183
Conversation
Failing because of #5184 |
b3bce03
to
fb4477f
Compare
Closes #4997 Signed-off-by: Salim Afiune Maya <[email protected]>
fb4477f
to
04f80ca
Compare
Test
|
list, err := getSecurityContacts(ctx, armConn) | ||
if err != nil { | ||
return nil, err | ||
// https: //github.com/mondoohq/cnquery/issues/4997 | ||
log.Warn().Err(err).Msg("fail gracefully") |
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 is that a warn?
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.
I was debating between this an a simple debug log message, I fee that is a better option, would you agree?
} | ||
res := []interface{}{} | ||
for _, contact := range list { | ||
alertNotifications, err := convert.JsonToDict(contact.Properties.AlertNotifications) |
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.
do we need to check if contact or contact.Properties are set?
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.
yeah, we probably should have done that, I'll add the check.
for _, contact := range list { | ||
alertNotifications, err := convert.JsonToDict(contact.Properties.AlertNotifications) | ||
if err != nil { | ||
return nil, err | ||
log.Debug().Err(err).Msg("unable to convert armsecurity.Contact.Properties.AlertNotifications to dict") | ||
} | ||
notificationsByRole, err := convert.JsonToDict(contact.Properties.NotificationsByRole) |
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.
do we need to check if contact or contact.Properties are set?
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.
yeah, we probably should have done that, I'll add the check.
for _, contact := range list { | ||
alertNotifications, err := convert.JsonToDict(contact.Properties.AlertNotifications) | ||
if err != nil { | ||
return nil, err | ||
log.Debug().Err(err).Msg("unable to convert armsecurity.Contact.Properties.AlertNotifications to dict") |
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.
in which cases can this happen? We should continue to error out and handle the case properly
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.
We haven't seen this but, the issue says that, any error trying to get the security contacts should fail gracefully. So I checked other places that we could end up in an undesirable error.
Signed-off-by: Salim Afiune Maya <[email protected]>
@chris-rock updated with your comments, thank you! Also, I much rather go this way #5185 - Thoughts? |
Closing in favor of #5185 |
Closes #4997