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] Unable to delete offline device #949

Open
pandafy opened this issue Dec 6, 2024 · 9 comments
Open

[bug] Unable to delete offline device #949

pandafy opened this issue Dec 6, 2024 · 9 comments
Labels

Comments

@pandafy
Copy link
Member

pandafy commented Dec 6, 2024

Describe the bug

Devices that are no longer connected to OpenWISP cannot be deleted.

This issue occurs because, in #840, we introduced a check requiring a device's config status to be set to deactivated before allowing deletion. However, this prevents users from deleting disconnected devices that cannot update their config status.

Steps To Reproduce

  1. Navigate to the Devices section.
  2. Select a device that is no longer connected to OpenWISP.
  3. Attempt to delete the device.

Expected behavior
It should be possible to delete the device

Workaround for users affected by this bug

Use the following steps to delete the device:

  1. Delete the configuration of the device
  2. Deactivate the device
  3. After deactivating, delete button would be visible on the device page. You can delete the device normally.
@pandafy pandafy added the bug label Dec 6, 2024
@pandafy pandafy moved this from To do (general) to To do (Python & Django) in OpenWISP Contributor's Board Dec 6, 2024
@pandafy
Copy link
Member Author

pandafy commented Dec 6, 2024

Possible solution

  1. Make the Delete Button Visible: Allow the delete button to remain visible for devices with a deactivating config status.
  2. Intermediate Warning Page: When the user clicks the delete button, display an intermediate page with the following warning:

"The device is still in the deactivating state, meaning its configuration is still present on the device. If you wish to remove the configuration from the device, please wait until the config status changes to deactivated. Proceeding will delete the device from OpenWISP without ensuring its configuration has been removed."

@akhilsharmaa
Copy link

deleting disconnected devices that cannot update their config status.

hey @pandafy, i have a doubt "how exactly we will know that device is disconnected ?" or " how do we know that this specific device cannot update it's config status" ?

Do we need to send a basic command to the device, if it fail to execute that command then we consider that device as disconnected ?

@pandafy
Copy link
Member Author

pandafy commented Dec 13, 2024

Do we need to send a basic command to the device, if it fail to execute that command then we consider that device as disconnected ?

No, we only need to provide a way to override the current flow for device deletion.

Current flow:

  1. Click "Deactivate" on the device page.
  2. Wait for the device to apply the configuration removal and report back.
  3. Once confirmed, the user can delete the device.

Problem:
If the device is disconnected during step 2, OpenWISP cannot confirm that the configuration is removed, so the device cannot be deleted.

@akhilsharmaa
Copy link

i got it @pandafy,
unfortunetly, I couldn't reproduce the issue, everytime i deactivate the device and then stop the router instantly (vbox), either it deactivate successfully or give the popup:
Image
and after this popup device deactivating successfully,
maybe because i'm using the vm, so..

Anyone want to work on this please go ahead. i am not working on this.

@pandafy
Copy link
Member Author

pandafy commented Dec 16, 2024

@akhilsharmaa stop the VM before deactivating the device.

@akhilsharmaa
Copy link

@akhilsharmaa stop the VM before deactivating the device.

@pandafy, i tried deactivating the vm after stopping the vm. but still i can delete that device. please this screen-rec :

in the video, you can see that vm is connected to the openwisp-cotroller (reboot command is working). then follow the steps. in the end you can see that i can deactivate the device. am i missing something ?

Screencast.from.2024-12-16.19-26-06.webm

@pandafy
Copy link
Member Author

pandafy commented Dec 16, 2024

You need to keep the VM powered off. The problem arises when the devices are no longer used (i.e. disconnected from the network). When you reboot the VM, OpenWrt downloads the latest configuration from OpenWISP and the configuration status is flagged as deactivated.

I would recommend you to take up another issue (look for "good first issue" label). A solution for this issue would likely require some brainstorming before implementing.

@akhilsharmaa
Copy link

I would recommend you to take up another issue (look for "good first issue" label). A solution for this issue would likely require some brainstorming before implementing.

Yes, i'm leaving this issue. ; (

@dee077
Copy link
Contributor

dee077 commented Jan 1, 2025

Hey @pandafy,

I've replicated the bug and enabled the delete button to show when the config status is set to deactivating and the device can be deleted as well.

However, I’m unsure about the best way to add the following warning text, which should appear after clicking the delete button:

Warning:
"The device is still in the deactivating state, meaning its configuration is still present on the device.
If you wish to remove the configuration from the device, please wait until the config status changes to deactivated.
Proceeding will delete the device from OpenWISP without ensuring its configuration has been removed."

Should I:

  1. Create a new template extending the existing one, delete_selected_confirmation.html?
  2. Is there a better approach to integrate this warning?

Additionally, some guidance on how to edit this warning message would be really helpful.

Current Flow:

Screencast.from.2025-01-01.20-01-35.webm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: To do (Python & Django)
Development

No branches or pull requests

3 participants