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 #14643 - fixed FillDiscoveryAttributeSetsForExistingHosts migration #268

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
6 participants

@lzap lzap force-pushed the lzap:unused-param-14643 branch 2 times, most recently from bbb4bac to b28beea Apr 14, 2016

@lzap

This comment has been minimized.

Copy link
Member Author

lzap commented Apr 14, 2016

This patch fixed a problem when there is an existing discovered host, the migration won't execute at all. Now, I hit another problem - REX plugin somehow orchestrates an action during validation (?) which breaks migration too:

== 20141223142759 FillDiscoveryAttributeSetsForExistingHosts: migrating =======
-- Populating attribute set for discovered host 5254001f4db5
-- Error while populating host 5254001f4db5: ERF42-4154 [Foreman::Exception]: Unable to detect primary interface using MAC '' specified by discovery_fact 'discovery_bootif' (delete it and re-discover): /home/ohad/git/foreman_discovery/app/services/foreman_discovery/fact_parser.rb:9:in `suggested_primary_interface'
/home/ohad/git/foreman/app/models/host/base.rb:198:in `set_interfaces'
/home/ohad/git/foreman/app/models/host/base.rb:181:in `populate_fields_from_facts'
/home/ohad/git/foreman_discovery/app/models/host/discovered.rb:80:in `populate_fields_from_facts'
/home/ohad/git/foreman_discovery/db/migrate/20141223142759_fill_discovery_attribute_sets_for_existing_hosts.rb:6:in `block in up'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:46:in `each'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:46:in `each'
/home/ohad/git/foreman_discovery/db/migrate/20141223142759_fill_discovery_attribute_sets_for_existing_hosts.rb:3:in `up'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:611:in `exec_migration'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:592:in `block (2 levels) in migrate'
/home/ohad/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/benchmark.rb:288:in `measure'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:591:in `block in migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:590:in `migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:768:in `migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:998:in `block in execute_migration_in_transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:1044:in `block in ddl_transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/transactions.rb:220:in `transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:1044:in `ddl_transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:997:in `execute_migration_in_transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:959:in `block in migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:955:in `each'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:955:in `migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:823:in `up'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:801:in `migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:240:in `call'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in execute'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/ohad/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:150:in `invoke_task'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:106:in `each'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:106:in `block in top_level'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:115:in `run_with_threads'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:100:in `top_level'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:78:in `block in run'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:176:in `standard_exception_handling'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:75:in `run'
./bin/rake:4:in `<main>'
-- Populating attribute set for discovered host 001a4a231301
-- Error while populating host 001a4a231301: ERF42-4154 [Foreman::Exception]: Unable to detect primary interface using MAC '' specified by discovery_fact 'discovery_bootif' (delete it and re-discover): /home/ohad/git/foreman_discovery/app/services/foreman_discovery/fact_parser.rb:9:in `suggested_primary_interface'
/home/ohad/git/foreman/app/models/host/base.rb:198:in `set_interfaces'
/home/ohad/git/foreman/app/models/host/base.rb:181:in `populate_fields_from_facts'
/home/ohad/git/foreman_discovery/app/models/host/discovered.rb:80:in `populate_fields_from_facts'
/home/ohad/git/foreman_discovery/db/migrate/20141223142759_fill_discovery_attribute_sets_for_existing_hosts.rb:6:in `block in up'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:46:in `each'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:46:in `each'
/home/ohad/git/foreman_discovery/db/migrate/20141223142759_fill_discovery_attribute_sets_for_existing_hosts.rb:3:in `up'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:611:in `exec_migration'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:592:in `block (2 levels) in migrate'
/home/ohad/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/benchmark.rb:288:in `measure'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:591:in `block in migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:590:in `migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:768:in `migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:998:in `block in execute_migration_in_transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:1044:in `block in ddl_transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/transactions.rb:220:in `transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:1044:in `ddl_transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:997:in `execute_migration_in_transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:959:in `block in migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:955:in `each'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:955:in `migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:823:in `up'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:801:in `migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:240:in `call'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in execute'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/ohad/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:150:in `invoke_task'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:106:in `each'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:106:in `block in top_level'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:115:in `run_with_threads'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:100:in `top_level'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:78:in `block in run'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:176:in `standard_exception_handling'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:75:in `run'
./bin/rake:4:in `<main>'
-- Populating attribute set for discovered host 001a4a23131b
-- Error while populating host 001a4a23131b: ERF42-4154 [Foreman::Exception]: Unable to detect primary interface using MAC '' specified by discovery_fact 'discovery_bootif' (delete it and re-discover): /home/ohad/git/foreman_discovery/app/services/foreman_discovery/fact_parser.rb:9:in `suggested_primary_interface'
/home/ohad/git/foreman/app/models/host/base.rb:198:in `set_interfaces'
/home/ohad/git/foreman/app/models/host/base.rb:181:in `populate_fields_from_facts'
/home/ohad/git/foreman_discovery/app/models/host/discovered.rb:80:in `populate_fields_from_facts'
/home/ohad/git/foreman_discovery/db/migrate/20141223142759_fill_discovery_attribute_sets_for_existing_hosts.rb:6:in `block in up'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:46:in `each'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:46:in `each'
/home/ohad/git/foreman_discovery/db/migrate/20141223142759_fill_discovery_attribute_sets_for_existing_hosts.rb:3:in `up'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:611:in `exec_migration'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:592:in `block (2 levels) in migrate'
/home/ohad/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/benchmark.rb:288:in `measure'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:591:in `block in migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:590:in `migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:768:in `migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:998:in `block in execute_migration_in_transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:1044:in `block in ddl_transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/transactions.rb:220:in `transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:1044:in `ddl_transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:997:in `execute_migration_in_transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:959:in `block in migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:955:in `each'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:955:in `migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:823:in `up'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:801:in `migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:240:in `call'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in execute'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/ohad/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:150:in `invoke_task'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:106:in `each'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:106:in `block in top_level'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:115:in `run_with_threads'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:100:in `top_level'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:78:in `block in run'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:176:in `standard_exception_handling'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:75:in `run'
./bin/rake:4:in `<main>'
-- Populating attribute set for discovered host 525400648566
-- Error while populating host 525400648566: ERF42-4154 [Foreman::Exception]: Unable to detect primary interface using MAC '' specified by discovery_fact 'discovery_bootif' (delete it and re-discover): /home/ohad/git/foreman_discovery/app/services/foreman_discovery/fact_parser.rb:9:in `suggested_primary_interface'
/home/ohad/git/foreman/app/models/host/base.rb:198:in `set_interfaces'
/home/ohad/git/foreman/app/models/host/base.rb:181:in `populate_fields_from_facts'
/home/ohad/git/foreman_discovery/app/models/host/discovered.rb:80:in `populate_fields_from_facts'
/home/ohad/git/foreman_discovery/db/migrate/20141223142759_fill_discovery_attribute_sets_for_existing_hosts.rb:6:in `block in up'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:46:in `each'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:46:in `each'
/home/ohad/git/foreman_discovery/db/migrate/20141223142759_fill_discovery_attribute_sets_for_existing_hosts.rb:3:in `up'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:611:in `exec_migration'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:592:in `block (2 levels) in migrate'
/home/ohad/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/benchmark.rb:288:in `measure'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:591:in `block in migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:590:in `migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:768:in `migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:998:in `block in execute_migration_in_transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:1044:in `block in ddl_transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/transactions.rb:220:in `transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:1044:in `ddl_transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:997:in `execute_migration_in_transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:959:in `block in migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:955:in `each'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:955:in `migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:823:in `up'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:801:in `migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:240:in `call'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in execute'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/ohad/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:150:in `invoke_task'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:106:in `each'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:106:in `block in top_level'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:115:in `run_with_threads'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:100:in `top_level'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:78:in `block in run'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:176:in `standard_exception_handling'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:75:in `run'
./bin/rake:4:in `<main>'
-- Populating attribute set for discovered host 001a4a2313c0
-- Error while populating host 001a4a2313c0: undefined method `execution' for #<Nic::Managed:0x0000000e26ece8> (delete it and re-discover): /home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activemodel-4.2.6/lib/active_model/attribute_methods.rb:433:in `method_missing'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:132:in `each'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:132:in `detect'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:132:in `public_send'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:132:in `method_missing'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:99:in `method_missing'
/home/ohad/git/foreman_remote_execution/app/models/concerns/foreman_remote_execution/nic_extensions.rb:15:in `set_execution_flag'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:432:in `block in make_lambda'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:164:in `call'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:164:in `block in halting'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:504:in `call'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:504:in `block in call'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:504:in `each'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:504:in `call'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:778:in `_run_validation_callbacks'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activemodel-4.2.6/lib/active_model/validations/callbacks.rb:113:in `run_validations!'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activemodel-4.2.6/lib/active_model/validations.rb:338:in `valid?'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/validations.rb:58:in `valid?'
/home/ohad/git/foreman/app/models/concerns/orchestration.rb:69:in `valid?'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/validations.rb:83:in `perform_validations'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/validations.rb:43:in `save!'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/attribute_methods/dirty.rb:29:in `save!'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/transactions.rb:291:in `block in save!'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/transactions.rb:351:in `block in with_transaction_returning_status'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/transactions.rb:220:in `transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/transactions.rb:348:in `with_transaction_returning_status'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/transactions.rb:291:in `save!'
/home/ohad/git/foreman/app/models/host/base.rb:201:in `set_interfaces'
/home/ohad/git/foreman/app/models/host/base.rb:181:in `populate_fields_from_facts'
/home/ohad/git/foreman_discovery/app/models/host/discovered.rb:80:in `populate_fields_from_facts'
/home/ohad/git/foreman_discovery/db/migrate/20141223142759_fill_discovery_attribute_sets_for_existing_hosts.rb:6:in `block in up'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:46:in `each'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:46:in `each'
/home/ohad/git/foreman_discovery/db/migrate/20141223142759_fill_discovery_attribute_sets_for_existing_hosts.rb:3:in `up'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:611:in `exec_migration'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:592:in `block (2 levels) in migrate'
/home/ohad/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/benchmark.rb:288:in `measure'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:591:in `block in migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:590:in `migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:768:in `migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:998:in `block in execute_migration_in_transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:1044:in `block in ddl_transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/transactions.rb:220:in `transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:1044:in `ddl_transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:997:in `execute_migration_in_transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:959:in `block in migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:955:in `each'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:955:in `migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:823:in `up'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:801:in `migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:240:in `call'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in execute'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/ohad/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:150:in `invoke_task'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:106:in `each'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:106:in `block in top_level'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:115:in `run_with_threads'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:100:in `top_level'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:78:in `block in run'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:176:in `standard_exception_handling'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:75:in `run'
./bin/rake:4:in `<main>'
-- Populating attribute set for discovered host 848f69fe2714
-- Error while populating host 848f69fe2714: undefined method `execution' for #<Nic::Managed:0x0000000e364df0> (delete it and re-discover): /home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activemodel-4.2.6/lib/active_model/attribute_methods.rb:433:in `method_missing'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:132:in `each'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:132:in `detect'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:132:in `public_send'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:132:in `method_missing'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:99:in `method_missing'
/home/ohad/git/foreman_remote_execution/app/models/concerns/foreman_remote_execution/nic_extensions.rb:15:in `set_execution_flag'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:432:in `block in make_lambda'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:164:in `call'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:164:in `block in halting'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:504:in `call'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:504:in `block in call'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:504:in `each'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:504:in `call'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:778:in `_run_validation_callbacks'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activemodel-4.2.6/lib/active_model/validations/callbacks.rb:113:in `run_validations!'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activemodel-4.2.6/lib/active_model/validations.rb:338:in `valid?'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/validations.rb:58:in `valid?'
/home/ohad/git/foreman/app/models/concerns/orchestration.rb:69:in `valid?'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/validations.rb:83:in `perform_validations'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/validations.rb:43:in `save!'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/attribute_methods/dirty.rb:29:in `save!'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/transactions.rb:291:in `block in save!'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/transactions.rb:351:in `block in with_transaction_returning_status'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/transactions.rb:220:in `transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/transactions.rb:348:in `with_transaction_returning_status'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/transactions.rb:291:in `save!'
/home/ohad/git/foreman/app/models/host/base.rb:201:in `set_interfaces'
/home/ohad/git/foreman/app/models/host/base.rb:181:in `populate_fields_from_facts'
/home/ohad/git/foreman_discovery/app/models/host/discovered.rb:80:in `populate_fields_from_facts'
/home/ohad/git/foreman_discovery/db/migrate/20141223142759_fill_discovery_attribute_sets_for_existing_hosts.rb:6:in `block in up'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:46:in `each'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:46:in `each'
/home/ohad/git/foreman_discovery/db/migrate/20141223142759_fill_discovery_attribute_sets_for_existing_hosts.rb:3:in `up'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:611:in `exec_migration'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:592:in `block (2 levels) in migrate'
/home/ohad/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/benchmark.rb:288:in `measure'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:591:in `block in migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:590:in `migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:768:in `migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:998:in `block in execute_migration_in_transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:1044:in `block in ddl_transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/transactions.rb:220:in `transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:1044:in `ddl_transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:997:in `execute_migration_in_transaction'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:959:in `block in migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:955:in `each'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:955:in `migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:823:in `up'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/migration.rb:801:in `migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/activerecord-4.2.6/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:240:in `call'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in execute'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/ohad/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:150:in `invoke_task'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:106:in `each'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:106:in `block in top_level'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:115:in `run_with_threads'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:100:in `top_level'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:78:in `block in run'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:176:in `standard_exception_handling'
/home/ohad/.rvm/gems/ruby-2.2.3@foreman/gems/rake-10.5.0/lib/rake/application.rb:75:in `run'
./bin/rake:4:in `<main>'
== 20141223142759 FillDiscoveryAttributeSetsForExistingHosts: migrated (0.1750s) 

@iNecas @ares is it a bug in REX?

Anyway, I added host deletion during migration if we encounter problem. It's just a discovered host and if it's too old, it needs to be rebooted and rediscovered anyway. Opinions @ohadlevy @orrabin ?

@iNecas

This comment has been minimized.

Copy link
Member

iNecas commented Apr 14, 2016

This is not a REX bug: this is a bug of migration using full activerecord objects for data manipulation, which can cause issues like this: because the execution flag will be just added in other migration. One should use fake objects for this instead to prevent running the code that relies on the data being migrated.

Handling this in REX doesn't solve the issue, just silences the symptoms that will bite us next time somewhere else.

@lzap

This comment has been minimized.

Copy link
Member Author

lzap commented Apr 18, 2016

Fake objects? Isn't there a better solution? Like turning off validations or hooks / orchestration?

@ares

This comment has been minimized.

Copy link
Member

ares commented Apr 18, 2016

@lzap if we only had orchestration not being triggered by ActiveRecord callbacks :-) you could probably skip validations (to avoid before_validations) but I'm not sure about others

@iNecas

This comment has been minimized.

Copy link
Member

iNecas commented Apr 20, 2016

It's not just about validations: every method that you use on the active
record object and is defined in Foreman is a potential risk for breaking in
next version. We could also use Sequel for the data manipulation (as
opposed to plain old sql transformations).

On Mon, Apr 18, 2016 at 4:25 PM, Marek Hulán notifications@github.com
wrote:

@lzap https://github.com/lzap if we only had orchestration not being
triggered by ActiveRecord callbacks :-) you could probably skip validations
(to avoid before_validations) but I'm not sure about others


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#268 (comment)

@lzap

This comment has been minimized.

Copy link
Member Author

lzap commented Apr 25, 2016

Can you give me guys a link to foreman core where we use the fake objects? I want to follow the same pattern.

@ares

This comment has been minimized.

Copy link
Member

ares commented Apr 26, 2016

https://github.com/theforeman/foreman/blob/develop/db/migrate/20150714140850_remove_new_from_compute_attributes.rb#L1

or just search for Fake in db/migrate, there are many examples, just keep in mind this approach does not work well with STI

@lzap lzap force-pushed the lzap:unused-param-14643 branch from b28beea to 5f53eaf May 11, 2016

@lzap

This comment has been minimized.

Copy link
Member Author

lzap commented May 11, 2016

Ok finally got it working. @ohadlevy @orrabin

FakeDiscoveredHost.where(:type => "Host::Discovered").all.each do |host|
begin
say "Populating attribute set for discovered host #{host.name}"
host.discovery_attribute_set = DiscoveryAttributeSet.where(:host_id => host.id).first_or_create

This comment has been minimized.

Copy link
@orrabin

orrabin Jun 24, 2016

Member

These 2 rows are identical to what we have in populate_fields_from_facts, maybe there should be a method on the host for populating the attribute set in case we ever change it.

This comment has been minimized.

Copy link
@dLobatog

dLobatog Jun 27, 2016

Member

Notice these aren't Host::Discovered anymore but FakeDiscoveredHost, so validations and triggers from the Host::Discovered will not do much

@orrabin

This comment has been minimized.

Copy link
Member

orrabin commented Jun 24, 2016

@lzap I was able to reproduce the error before your fix and this pr fixes it for me.

@dLobatog

This comment has been minimized.

Copy link
Member

dLobatog commented Jun 27, 2016

@orrabin If you don't mind I'll merge to fix the migration problem, I'm not sure #268 (comment) should be a blocker, especially since the migration uses the fake model.

Thanks @orrabin @iNecas @ares for taking the time to go over this

@dLobatog

This comment has been minimized.

Copy link
Member

dLobatog commented Jun 27, 2016

Merged as c10071d, thanks @lzap!

@dLobatog dLobatog closed this Jun 27, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.