-
Notifications
You must be signed in to change notification settings - Fork 2
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
!next-prefix action tag using location and prefix type fails with prefix_length is null #154
Comments
I think the issue here is that the ---
prefixes:
- "!next_prefix":
locations: "{{ site_name.parent.parent.parent.id }}"
type: "container"
length: {{ ipam_templates[site_size | lower]['template_prefix_size'] | int }}
status__name: "Active"
description: "{{ site_name }} Parent Prefix"
type: "container"
"!ref": "parent_prefix" |
Did try this and still got the same error. Even just hardcoded the length and it fails. ---
prefixes:
- "!next_prefix":
locations: "{{ site_name.parent.parent.parent.id }}"
type: "container"
length: 25
status__name: "Active"
description: "{{ site_name }} Parent Prefix"
type: "container"
"!ref": "parent_prefix" |
Does seem like its something about no prefixes available in certain circumstances. If I play around with it and make the length much smaller it results in the expected error around "no prefixes available for ..." still debugging further to see what is happening but if I ensure the prefix is available it works as expected. |
In a similar example, I just changed the source and destination to not have potential namepsace issues with the method names, such as prefix -> prefix1 and VLAN -> VLAN1 and that fixed the issue. |
I was able to reproduce this in a test and it is exactly as @itdependsnetworks mentioned. Design Builder translates the source/destination labels of custom relationships to actual fields on a proxy model. If there is a clash then this type of issue is caused. If you look at the In [4]: Prefix._meta.get_field("vlan")
Out[4]: <django.db.models.fields.related.ForeignKey: vlan> |
@jeffkala do you consider this a bug that we should try and mitigate? |
At least maybe we can just document it and provide best practices to work around it? I'm not fully onboard that we "must" mitigate it as it seems rare its hit. |
Environment
Expected Behavior
!next-prefix action tag will get-next properly when a filter criteria is specified to determine the "parent" prefixes to search in.
Observed Behavior
Steps to Reproduce
For additonal testing did validate the same _get_next functionality from ORM returns a value.
The text was updated successfully, but these errors were encountered: