-
Notifications
You must be signed in to change notification settings - Fork 7
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
Stop search for zones being greedy #79
base: main
Are you sure you want to change the base?
Conversation
Reviewer's Guide by SourceryThis PR changes the NetBox zone search to stop being greedy by changing the search query to use a trailing wildcard. Sequence diagram for zone search query modificationsequenceDiagram
participant Client
participant OctoDNS
participant NetBox
Client->>OctoDNS: Request zone data
OctoDNS->>NetBox: Search query with '.zone_name'
Note right of NetBox: More specific search<br/>with leading dot
NetBox-->>OctoDNS: Return matching zones
OctoDNS-->>Client: Return zone data
Flow diagram showing zone name matching behaviorflowchart LR
A[Zone Name] --> B{Search Query}
B -->|Before| C[zone_name__ic: name]
B -->|After| D[zone_name__ic: .name]
C -->|Matches| E[example.com]
C -->|Matches| F[myexample.com]
D -->|Matches| G[example.com]
D -.-x H[myexample.com]
style H fill:#ffcccc
style D fill:#ccffcc
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @davesbell - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider expanding the commit message to explain what 'greedy' behavior was being fixed and how adding the dot prefix resolves it. This will help future maintainers understand the context of this change.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Thank you so much for your Pull Request! We’ve noticed an issue in our current CI/CD process that’s preventing the tests from running correctly on your commit. It appears that some of our dependencies are out of date, which is likely causing the problem. I’ll address these issues first, and once everything is back to normal, I’ll review your PR. Thank you for your patience! |
@davesbell We’ve resolved the issues with our CI/CD pipeline. Could you please rebase your branch onto the latest main so we can proceed with reviewing your PR? Once that’s done, our tests should run correctly. Thanks again! |
@davesbell Thank you for pointing out the issue. Your proposed fix does seem to resolve the immediate problem. However, we need to account for the possibility of apex records—for example, a user who wants to create an A record for Instead of modifying the NetBox query, I’ve updated the code to more accurately determine whether an FQDN is part of the zone. I hope this addresses your concern. You can test the development version by running: Please let me know if this resolves the issue on your end. |
This fixes #78
I have a domain example.com
I have DNS records in the zones:
example.com
test.example.com
I have the following DNS record defined in netbox:
a-test.example.com
This causes two DNS records to be created.
2025-01-15T11:37:03 [6191755264] INFO NetboxSource[netbox] zone example.com. record added: Rr<a-test, A, 300, 127.0.0.1
2025-01-15T10:46:19 [6143684608] INFO NetboxSource[netbox] zone test.example.com. record added: Rr<a-, A, 300, 127.0.0.1