OpenWISP

[hard][rare] Auto-registration fails but device is created anyway

In rare cases, auto-registration may fail because of misconfiguration or bugs introduced during development.

It then may happen that even if the auto-registration fails, the device may be created anyway, eg: if the uncaught exception is triggered in the phase which adds templates (m2m relationship in django are saved after the main object has been created).

This is not good because it triggers other unexpected behaviour, a chain reaction which is hard to debug. The ideal solution would be to ensure to catch any potential exception during all the critical phases of the autoregistration and if any of these phases fails, the system should log the error, trigger something like a 400 bad request and delete the newly created invalid device.

Task tags

  • python
  • bug
  • django

Students who completed this task

MTJ

Task type

  • code Code
close

2019