Comments (4)
Seems like this was introduced in 3.1.0? (netbox-community/netbox#7619) So from my perspective this is one of those features that should be configurable by this role in order to get 3.1.0 support through the door in the first place.
If I understand correctly this would fundamentally be the same as netbox_scripts
/netbox_reports
(with the slight difference of those validators being referenced in the custom validators config)?
from ansible-role-netbox.
They were part of the 3.0 release. They are slightly different from reports and scripts because there is no "root" folder that NetBox automatically looks for them in.
That means the user has to have a package/folder in the path so NetBox can followed the dotted path configured (I use local_validators
in the same directory as manage.py
).
Other than that, I am using similar logic to reports/scripts for copying & linking files.
from ansible-role-netbox.
Oh I thought the custom validator support in 3.0 was just a specific DSL in configuration.py
, not external files.
I just thought of something I've done before that might be useful. You can add directories to the PYTHONPATH
at runtime:
import os
import sys
sys.path.insert(0, os.path.join(os.getcwd(), "{{ shared_directory }}/validators"))
That could go at the top of the configuration.py
template. This way they don't necessarily have to be in the netbox folder itself, and might possibly be simpler to reason about (e.g. what if someone wanted to use a different package name than local_validators
in their config?). Food for thought.
from ansible-role-netbox.
specific DSL in
configuration.py
, not external files.
It's both :)
The external files part is where you want to write a CustomValidator class that overrides the validate()
method to do more complex validation than what the DSL provides. The dynamic configuration is "best" IMO and so there's no need to put anything in configuration.py
(except perhaps your sys.path
trick to get the path set up correctly) - and if users of this role want/need to define their validators in configuration.py
, they still can using the role as it exists today, rather than adding new role-specific variables to handle it.
from ansible-role-netbox.
Related Issues (20)
- Support for Deployment of Multiple RQ Workers HOT 1
- uWSGI randomly resets TCP connections HOT 3
- Role needs to be updated to latest NetBox HOT 6
- AnsibleUndefinedVariable: {{ ansible_processor_vcpus }} when running role HOT 2
- Install uwsgi in venv and point service file to venv binary HOT 8
- Only run invalidate command if commit is NOT present
- markupsafe 2.1.1 cannot import soft_unicode HOT 1
- Recommended SSL settings HOT 3
- Vagrant Install failing with errors HOT 1
- Support 'clearcache' steps during upgrade in v3.2.3+
- Required Updates for "Up to" NetBox v3.4.2 Support HOT 6
- Fails to deploy on clean Debian 11 HOT 11
- RQworker reload fails randomly HOT 2
- Git-based installation: problematic file ownership
- NetBox dropped "clearcache" management command HOT 2
- Wrong check between Python 3.7 and 3.8 HOT 3
- Outdated Version on Ansible-Galaxy HOT 1
- NetBox 4.0 and higher require Python 3.10 or higher
- Creating NetBox superuser fails on NetBox 4.0 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ansible-role-netbox.