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

Make Channels DELETEable from the database #179

Open
oxzi opened this issue Apr 17, 2024 · 1 comment
Open

Make Channels DELETEable from the database #179

oxzi opened this issue Apr 17, 2024 · 1 comment

Comments

@oxzi
Copy link
Member

oxzi commented Apr 17, 2024

When switching on working between different Pull Requests, I once have not reset my database as there was no schema change in between. However, in the old state I configured a channel plugin which then was not available in the new state.

While icinga-notifications keeps complaining about the channel:

2024-04-17T14:46:07.260Z        ERROR   channel Failed to initialize channel plugin     {"id": 1, "name": "http-echo", "error": "failed to start cmd: fork/exec /usr/libexec/icinga-notifications/channel/webhook: no such file or directory"}
2024-04-17T14:46:31.477Z        ERROR   channel Failed to initialize channel plugin     {"id": 1, "name": "http-echo", "error": "failed to start cmd: fork/exec /usr/libexec/icinga-notifications/channel/webhook: no such file or directory"}
2024-04-17T14:46:31.477Z        ERROR   incident        Failed to send notification via channel plugin  {"object": "dummy-805!random fortune",
"incident": "#1193", "type": "webhook", "error": "plugin could not be started"}
2024-04-17T14:46:31.478Z        ERROR   channel Failed to initialize channel plugin     {"id": 1, "name": "http-echo", "error": "failed to start cmd: fork/exec /usr/libexec/icinga-notifications/channel/webhook: no such file or directory"}
2024-04-17T14:46:31.954Z        ERROR   channel Failed to initialize channel plugin     {"id": 1, "name": "http-echo", "error": "failed to start cmd: fork/exec /usr/libexec/icinga-notifications/channel/webhook: no such file or directory"}
2024-04-17T14:46:31.955Z        ERROR   incident        Failed to send notification via channel plugin  {"object": "dummy-320!random fortune",
"incident": "#1207", "type": "webhook", "error": "plugin could not be started"}
2024-04-17T14:46:31.955Z        ERROR   channel Failed to initialize channel plugin     {"id": 1, "name": "http-echo", "error": "failed to start cmd: fork/exec /usr/libexec/icinga-notifications/channel/webhook: no such file or directory"}
2024-04-17T14:46:48.885Z        ERROR   channel Failed to initialize channel plugin     {"id": 1, "name": "http-echo", "error": "failed to start cmd: fork/exec /usr/libexec/icinga-notifications/channel/webhook: no such file or directory"}
2024-04-17T14:46:48.885Z        ERROR   incident        Failed to send notification via channel plugin  {"object": "dummy-180!random fortune",
"incident": "#1196", "type": "webhook", "error": "plugin could not be started"}
2024-04-17T14:46:48.885Z        ERROR   channel Failed to initialize channel plugin     {"id": 1, "name": "http-echo", "error": "failed to start cmd: fork/exec /usr/libexec/icinga-notifications/channel/webhook: no such file or directory"}

I was unable to remove the channel from the database due to the constraints:

SQLSTATE[23503]: Foreign key violation: 7 ERROR: update or delete on table "channel" violates foreign key constraint "contact_default_channel_id_fkey" on table "contact" DETAIL: Key (id)=(1) is still referenced from table "contact".

Thus, I would suggest adding ON DELETE CASCADE to those foreign key constraints or changing the schema in a more clever way. Otherwise, a channel once configured for testing something cannot be removed anymore.

@julianbrost
Copy link
Collaborator

This not only affects channels but most of the config.

Thus, I would suggest adding ON DELETE CASCADE to those foreign key constraints

That would also delete history data. So it should at least be ON DELETE SET NULL in some places, that would still allow showing something like "was notified via a now deleted channel". But maybe we just want a disabled/deleted flag instead, so that more historically relevant information remains.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants