[bug] Shared default templates not re-assigned after device organization change
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
- #1427 di @omlahore — chiusa senza merge
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 55/100
Direzione di ricerca
Riproduci il comportamento tramite l’endpoint REST PATCH /api/v1/controller/device/{id}/ o l’interfaccia di amministrazione, quindi segui il gestore del cambio di organizzazione descritto nell’analisi. L’attività è completata quando lo spostamento di un dispositivo tra organizzazioni rimuove i template non applicabili e riassegna tutti i template condivisi e specifici dell’organizzazione applicabili con default=True, in modo che corrisponda a un dispositivo appena registrato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
When a device is moved from one organization to another, shared templates with default=True are removed and not re-assigned when the device is moved back. Only templates with required=True survive the roundtrip.
Steps to reproduce
- Create a shared template (no organization) with
default=True,required=False(e.g. "SSH Keys") - Create a shared template with
default=True,required=True(e.g. "default-management-vpn") - Create an org-specific template with
default=Truein Org A (e.g. "Provision-OrgA") - Register a device in Org A — it gets all 3 templates automatically ✅
- Move the device to Org B via the admin UI or API
- Observed: Only the
required=Truetemplate remains. The shareddefault=Truetemplate and the org-specific template are both removed. - Move the device back to Org A
- Observed: The org-specific template is re-assigned (because
default=Truein Org A), but the shareddefault=Truetemplate is NOT re-assigned.
Expected behavior
After moving a device to a new organization, all applicable default=True templates (both shared and org-specific) should be automatically assigned, just as they would be for a newly registered device in that organization.
Actual behavior
Shared templates with default=True but required=False are removed during the org change and never re-applied, even when moving back to the original organization. The device ends up with fewer templates than a freshly registered device in the same org.
Workaround
Setting the shared template to required=True prevents it from being removed during organization changes. However, this prevents users from ever unassigning the template, which may not be desirable.
Environment
- openwisp-controller version: latest (as of April 2026)
- Tested via REST API (
PATCH /api/v1/controller/device/{id}/with{"organization": "<new-org-id>"}) - Also reproducible via the admin UI
Analysis
The issue appears to be in the organization-change handler: it correctly removes org-specific templates that don't belong to the new organization, but it also removes shared default=True templates (which are valid in any organization). When the device arrives in the new org, only org-specific default=True templates are auto-assigned — the shared ones are not reconsidered.
The required=True flag acts as a "never remove" guard, which is why those templates survive. But default=True should mean "always assign to new devices in this context", and an organization change is effectively a "new device in this org" scenario.
- Lingua principale
- Python
- Stelle
- 792
- Fork
- 335
- Merge medio
- 9h 41m
- PR unite (30g)
- 32
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di openwisp/openwisp-controller
-
[bug] DeviceListFilterBackend drops additional query filters when config__templates is providedApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
openwisp/openwisp-controller#1544 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[fix] Recent Commands row uses "created" timestamp for the "Modified" fieldForse già presa @xovishnukosuri l’ha presa 229 giorni fa. Apertabug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
openwisp/openwisp-controller#1263 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 45/100
openwisp/openwisp-controller#1524 ·
I maintainer di solito rispondono entro 1 giorno
-
[feature] Emit a signal when a device operating system changesForse di nuovo libera @Vara715 l’ha presa 13 giorni fa e non c’è nessuna pull request aperta. Apertaenhancement
Difficoltà 3/5 Mezza giornata Idoneità per principianti 65/100
openwisp/openwisp-controller#1506 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[feature] Add board_name field to Device model for DTB board identificationForse di nuovo libera @atif09 l’ha presa 41 giorni fa e non c’è nessuna pull request aperta. Apertaenhancement gsoc
openwisp/openwisp-controller#1491 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di openwisp/openwisp-controller
Issue simili
-
app: scripts status: backlog type: documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
netbox-community/netbox-scripts#68 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 91/100
marin-community/marin#10765 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 70/100
flathub/com.unity.UnityHub#230 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
namespace operations
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 63/100
EclipseFdn/open-vsx.org#14910 ·
I maintainer di solito rispondono entro 1 giorno