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

Cancel maintenance task when all its components have been deleted #2243

Closed
2 tasks done
ingeborgoh opened this issue Jan 4, 2021 · 4 comments · Fixed by #3235
Closed
2 tasks done

Cancel maintenance task when all its components have been deleted #2243

ingeborgoh opened this issue Jan 4, 2021 · 4 comments · Fixed by #3235
Assignees
Labels
enhancement maintenance maintengine nav-ref Fronted by the NAV user reference committee

Comments

@ingeborgoh
Copy link
Contributor

ingeborgoh commented Jan 4, 2021

Original description

NAV 5.1.1

Netbox is on maintenance. Netbox is deleted.The Maintenance-task still exists with State Active and
Components IP Device: ID 4430 (Component was deleted)

Expectation: The deleted netbox should also be deleted from the Components list of matching Active Maintenance Tasks.

If this is the last component, the whole Task should be Canceled.

Feature breakdown

After discussions in the NAV reference committee, we've agreed on an implementation that doesn't change history after-the-fact. This feature can be broken down to:

@lunkwill42
Copy link
Member

lunkwill42 commented Mar 24, 2022

Expectation: The deleted netbox should also be deleted from the Components list of matching Active Maintenance Tasks.

I disagree with this expectation. I don't want to get back to a maintenance task and wonder why components I added to it are suddenly removed. I think it's better to list them as having been removed, as it is now.

If this is the last component, the whole Task should be Canceled.

This I can agree with. If all the components of a task have been removed from NAV, the task no longer serves a purpose, and it could be canceled.

There could be two ways of going about this. Either:

  1. Add database triggers when modules, netboxes rooms or locations are deleted. These triggers will check any dependent maintenance tasks and close them if all components are deleted. However, maintaining a trigger like this could be tedious.

or

  1. The maintengine is a cronjob (every 5 minutes) that is already responsible for switching task states and posting maintenanceState events for components as tasks change states. It is likely easier to have maintengine check the deletion status of components on all planned or active tasks, and cancel those tasks if all components are missing.

@lunkwill42
Copy link
Member

Note from nav-ref: Verify whether maintenance logs errors when it encounters maintenance tasks where one or more devices have been deleted (read: lots of cron mail, potentially)

@lunkwill42
Copy link
Member

I disagree with this expectation. I don't want to get back to a maintenance task and wonder why components I added to it are suddenly removed. I think it's better to list them as having been removed, as it is now.

Comment from UiO: Could this be made configurable in maintengine?

@lunkwill42 lunkwill42 added the nav-ref Fronted by the NAV user reference committee label Jan 10, 2023
@lunkwill42
Copy link
Member

Might be interesting to expand the component attribute to include a name or description of a component that may have been deleted later.

@lunkwill42 lunkwill42 changed the title Deleted netboxes should be deleted from Maintenance tasks Cancel maintenance tasks when all its components have been deleted Nov 21, 2024
@lunkwill42 lunkwill42 changed the title Cancel maintenance tasks when all its components have been deleted Cancel maintenance task when all its components have been deleted Nov 21, 2024
@lunkwill42 lunkwill42 self-assigned this Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement maintenance maintengine nav-ref Fronted by the NAV user reference committee
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants