openwisp / openwisp/openwisp-controller

[bug] If default templates contain a flaw, auto-registration will fail

Open
#212 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
773
Forks
315
Avg merge
2d 16h
Merged PRs (30d)
14

Description

If the default templates have a conflict with one another which causes the resulting NetJSON configuration to fail the schema validation, auto-registration will fail with 500 internal server error.

A possible solution would be the following:

  • if the current template being saved is flagged as default
  • before saving, create a NetJSON configuration from all the default templates using the same backend and try to validate it against the schema used, if the validation fails, trigger a django ValidationError

We must provide a way to extend this behaviour, since downstream apps will need more complex validation rules (openwisp-controller will have to check default templates for each organization if the default template being edited is "shared").

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the auto-registration path and the save flow for default templates described in the issue. Verify how the backend builds NetJSON configurations and invokes schema validation, then define completion as raising Django ValidationError before saving invalid default-template combinations while leaving an extension point for downstream validation rules.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
backend, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.