fix(plugin): create fallback ticket in case Jira fails #5415
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This pull request introduces a fallback mechanism to handle scenarios where Jira ticket creation fails. The changes ensure that incidents and cases can still proceed with a ticket, even if the Jira integration encounters an error.
Key Changes
Fallback Ticket Creation:
create_fallback_ticket
insrc/dispatch/plugins/dispatch_jira/plugin.py
to generate a fallback ticket with a specific resource type (jira-error-ticket
) when Jira ticket creation fails.Incident and Case Ticket Creation:
create
andcreate_case_ticket
methods inJiraTicketPlugin
to handle exceptions during Jira ticket creation. If an error occurs, the system now creates a fallback ticket using the core plugin.Incident Resource Flow:
incident_create_resources
insrc/dispatch/incident/flows.py
to check for thejira-error-ticket
resource type, ensuring that the incident process continues even if the Jira ticket is not created.User Interface Enhancements:
ResourcesTab.vue
to display an error message when a Jira ticket is not created, guiding users to use the "Recreate Missing Resources" option.Logging and Error Handling:
Files Changed
src/dispatch/incident/flows.py
: Adjusted logic to handle fallback tickets.src/dispatch/plugins/dispatch_jira/plugin.py
: Implemented fallback ticket creation and error handling.src/dispatch/static/dispatch/src/incident/ResourcesTab.vue
: Updated UI to reflect ticket creation errors.src/dispatch/ticket/flows.py
: Ensured resource type is updated correctly.