Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Record and NameServer are not validated by custom validators #248

Closed
peteeckel opened this issue Apr 24, 2024 · 0 comments · Fixed by #249
Closed

Record and NameServer are not validated by custom validators #248

peteeckel opened this issue Apr 24, 2024 · 0 comments · Fixed by #249
Assignees
Labels
bug Something isn't working

Comments

@peteeckel
Copy link
Owner

peteeckel commented Apr 24, 2024

Versions
NetBox Version: 3.7.6
NetBox DNS Version: 0.22.8
Python Version: 3.11.5

Describe the bug
For Record and Nameserver objects, custom validators are not executed.

To Reproduce
Steps to reproduce the behavior:

  1. Define a custom validator for testing, e.g.
#
# /opt/netbox/netbox/deny.py
#
from extras.validators import CustomValidator

class Deny(CustomValidator):

    def validate(self, instance):
        self.fail("I don't feel like this today, sorry")
  1. Configure NetBox to use the validator to validate one of the object types mentioned above
CUSTOM_VALIDATORS = {
    "netbox_dns.record": [
        "validators.deny.Deny",
    ],
}
  1. Edit and save an arbitrary record

Expected result
Saving the record is denied with the error message "I don't feel like this today, sorry"

Actual result
The record is saved

@peteeckel peteeckel added the bug Something isn't working label Apr 24, 2024
@peteeckel peteeckel self-assigned this Apr 24, 2024
@peteeckel peteeckel changed the title Record, View and NameServer are not validated by custom validators Record and NameServer are not validated by custom validators Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant