Commit fa43268
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 and
emits a warning log when the method is missing so operators running
non-standard device models notice the missing push-skip optimization.
Closes #13311 parent 0d17acd commit fa43268
1 file changed
+13
-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 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
479 | 491 | | |
480 | 492 | | |
481 | 493 | | |
| |||
0 commit comments