Commit a250197
committed
[fix] Guard missing skip_push_update_on_save in register view #1331
DeviceRegisterView._update_device_name calls
``device.skip_push_update_on_save()`` whenever an agent re-registers
with a hostname different from the MAC address. While the method is
defined on AbstractDevice, subclasses or older installations that
lack it would crash with AttributeError on every such re-registration
(HTTP 500).
This breaks the consistent_registration / factory-reset workflow:
1. A router does a factory reset and loses its local UUID/key.
2. The agent computes a consistent key and POSTs to /register/.
3. OpenWISP finds the existing device by key.
4. The view enters _update_device_name (hostname differs from MAC).
5. If skip_push_update_on_save is missing, AttributeError → HTTP 500.
6. The agent sees no X-Openwisp-Controller header and aborts.
7. After 6 retries procd kills the agent.
Wrap the call in ``getattr`` so the registration path succeeds whether
the helper method exists or not. The guard is forward-compatible.
Closes #13311 parent 0d17acd commit a250197
1 file changed
+7
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
475 | 475 | | |
476 | 476 | | |
477 | 477 | | |
478 | | - | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
479 | 485 | | |
480 | 486 | | |
481 | 487 | | |
| |||
0 commit comments