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

Fixes #18549 - Don't rebuild already correct DNS entries #4297

Closed
wants to merge 1 commit into from

Conversation

agx
Copy link
Member

@agx agx commented Feb 17, 2017

If we do so and try to recreate them right away ecreate_dns_record might
still see a valid entry due to zone transfer slowness or other caching
issues. In this case we'd end up without a DNS entry after all. So
intead do nothing if the entry is already good.

This is a forward port from a fix I applied to a local 1.10.x instance.

Signed-off-by: Guido Günther agx@sigxcpu.org

If we do so and try to recreate them right away ecreate_dns_record might
still see a valid entry due to zone transfer slowness or other caching
issues. In this case we'd end up without a DNS entry after all. So
intead do nothing if the entry is already good.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
@mention-bot
Copy link

@agx, thanks for your PR! By analyzing the history of the files in this pull request, we identified @ohadlevy, @isratrade and @timogoebel to be potential reviewers.

Copy link
Member

@dLobatog dLobatog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@agx One minor comment inline, please check it out. Thanks for the contribution!

@@ -42,7 +42,7 @@ def rebuild_dns
results = {}

DnsInterface::RECORD_TYPES.each do |record_type|
del_dns_record_safe(record_type)
dns_record(record_type).nil? || dns_record(record_type).valid? || del_dns_record_safe(record_type)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first check for .nil? is already done on del_dns_record_safe on app/model/concerns/dns_interface.rb.

Could you move the .valid? check to that method, and add a test on test/models/orchestration/dns_test.rb for rebuild_dns with an already correct DNS record?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dLobatog wouldn't that obfuscate the meaning of del_dns_record_safe? It'd rather add a del_incorrect_dns_record

@theforeman-bot
Copy link
Member

Thank you for your contribution, @agx! This PR has been inactive for 6 months, closing for now.
Feel free to reopen when you return to it. This is an automated process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants