Bug #12696
openBuilt call can fail due to orchestration conflict checking
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1288215
Description of problem:
The built url calls `save!` which triggers checking orchestration conflicts. This seems unnecessary, and can even prevent the host from being built, putting it in a reboot loop. To give you an example, a host with DNS has its record checked for conflicts when built is called. On very slow DNS servers this could time out and cause the call to fail.
Upstream Foreman makes the timeout at least configurable (http://projects.theforeman.org/issues/11709), but I wonder why it should check conflicts at all when we're marking the host built?
Version-Release number of selected component (if applicable):
6.1.3
How reproducible:
Sometimes, if your DNS is very, very slow
Additional info:
Traceback from the failed built call:
/usr/share/foreman/lib/net/dns.rb:37:in `rescue in lookup'
/usr/share/foreman/lib/net/dns.rb:15:in `lookup'
/usr/share/foreman/lib/net/dns.rb:63:in `dns_lookup'
/usr/share/foreman/lib/net/dns/a_record.rb:28:in `conflicts'
/usr/share/foreman/lib/net.rb:24:in `conflicting?'
/usr/share/foreman/app/models/concerns/orchestration/dns.rb:121:in `dns_conflict_detected?'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:512:in `_run__3613348864840830943__validation__1758447277780704494__callbacks'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_validation_callbacks'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks'
/opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations/callbacks.rb:53:in `run_validations!'
/opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations.rb:194:in `valid?'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/validations.rb:69:in `valid?'
/usr/share/foreman/app/models/concerns/orchestration.rb:47:in `valid?'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/validations.rb:77:in `perform_validations'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/validations.rb:56:in `save!'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/attribute_methods/dirty.rb:33:in `save!'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:246:in `block in save!'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:295:in `block in with_transaction_returning_status'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:208:in `transaction'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:293:in `with_transaction_returning_status'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:246:in `save!'
/usr/share/foreman/app/models/host/managed.rb:251:in `built'
/usr/share/foreman/app/controllers/unattended_controller.rb:40:in `built'