-
-
Notifications
You must be signed in to change notification settings - Fork 73
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
Support for installing/configuring CUSTOM_VALIDATORS #194
base: develop
Are you sure you want to change the base?
Conversation
…l1-matt/ansible-role-netbox into feature/157_custom_validators
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments.
Also, it's preferred that you rebase against develop when syncing or amending commits for minor fixes, and then force pushing the result afterwards. This is mainly to keep commit history succinct—otherwise I'll squash them on merge but that'll result in losing your direct authorship (if that matters to you).
The wrapping on the doc updates is also a bit off—it doesn't seem to be following either Asciidoc convention or a character limit. The convention is to break lines at the end of a sentence (i.e. one sentence per line), but I've also wrapped on commas or end of a clause if a line is particularly long.
} | ||
``` | ||
|
||
TIP: By default, a local (non-LDAP) superuser will still be created by this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not relevant, I think this was accidentally copied and left in?
dest: "{{ netbox_shared_path }}/custom_validators.py" | ||
owner: "{{ netbox_user }}" | ||
group: "{{ netbox_group }}" | ||
ignore_errors: yes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Errors shouldn't be ignored here.
notify: | ||
- reload netbox.service | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove extra newline.
notify: | ||
- reload netbox.service | ||
|
||
- name: Symlink/Remove NetBox local_settings.py file into/from the active NetBox release |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compared to local_settings.py
, as far as I can tell custom_validators.py
is not an expected file that gets imported in the upstream NetBox codebase. Having not tested this I'm assuming dropping it in the netbox
folder makes it reachable from NetBox as custom_validators.XYZ
and is why it's being symlinked here?
This isn't really an issue for stable NetBox deployments, but if I recall correctly it prevents updates for git-based deployments because the NetBox directory ends up having uncommitted changes. Which means we have to use a different method of making this file importable, maybe via installing the file into the virtualenv's site-packages
directory directly?
@@ -76,6 +76,9 @@ netbox_ldap_config_template: netbox_ldap_config.py.j2 | |||
|
|||
# netbox_local_settings_file: "{{ playbook_dir }}/files/netbox/local_settings.py" | |||
|
|||
netbox_custom_validators_enabled: false | |||
netbox_custom_validators_file: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest setting a non-empty default here, custom_validators.py
is fine (and the user can override it with something more specific if they prefer).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually it looks like a default was specified in the README. This should be consistent with that. I'm fine with either filename.
Toggle `netbox_custom_validators_enabled` to `true` to create a custom validator file for | ||
NetBox. `netbox_custom_validators_file` should be the path to your custom validator file - by | ||
default, Ansible will search your playbook's `files/` directory for this. | ||
You can find an example in `examples/`. You will also need to set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This appears to refer to an example but I don't see any changes in this PR to introduce that example.
NetBox. `netbox_custom_validators_file` should be the path to your custom validator file - by | ||
default, Ansible will search your playbook's `files/` directory for this. | ||
You can find an example in `examples/`. You will also need to set | ||
`netbox_config.CUSTOM_VALIDATORS` to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could use some more clarity. I don't think this is the exact value that users should be using, right? It depends on what validators they define in their validators file.
Also extra note, in #191 I moved all configuration file changes into a block so the handler is only specified once. Something to look out for when rebasing. |
#157 Adds support custom validation rules and custom validation logic.