Skip to content
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

bug: pagerduty_plugin - Updates method for accessing current on-call email #4645

Merged
merged 2 commits into from
Apr 22, 2024

Conversation

Meandmybadself
Copy link
Contributor

Issue

The existing get_oncall_email method assumes that there is only one associated schedule with an on-call escalation policy. In the event that more than one schedule exists (say, if there is a US and India team) and the second schedule is active, the method will attempt to find the on-call engineer in the first schedule & fail.

Resolution

This fix updates the method to iterate over all escalation_rules in an attempt to find the on-call engineer. Only after it has iterated over all schedules and not found an engineer will it throw an Exception.

Example of multi-schedule API response

{
        "description": "",
        "escalation_rules": [
                {
                        "escalation_delay_in_minutes": 30,
                        "id": "IDREDACTED",
                        "targets": [
                                {
                                        "html_url": "https://company.pagerduty.com/schedules/IDREDACTED",
                                        "id": "IDREDACTED",
                                        "self": "https://api.pagerduty.com/schedules/IDREDACTED",
                                        "summary": "Data Team - India On Call",
                                        "type": "schedule_reference"
                                },
                                {
                                        "html_url": "https://company.pagerduty.com/schedules/IDREDACTED",
                                        "id": "IDREDACTED",
                                        "self": "https://api.pagerduty.com/schedules/IDREDACTED",
                                        "summary": "Data Team - US On Call",
                                        "type": "schedule_reference"
                                }
                        ]
                }
        ]
}

@metroid-samus metroid-samus self-requested a review April 22, 2024 20:28
@Meandmybadself Meandmybadself changed the title fix: pagerduty_plugin - Updates method for accessing current on-call email bug: pagerduty_plugin - Updates method for accessing current on-call email Apr 22, 2024
@metroid-samus metroid-samus added the bug Something isn't working label Apr 22, 2024
@metroid-samus metroid-samus merged commit a862b4f into Netflix:master Apr 22, 2024
8 of 10 checks passed
@Meandmybadself Meandmybadself deleted the pagerduty-scheduling branch April 30, 2024 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants