dice-cyfronet/atmosphere

Error after pushing latest master into development env

Closed this issue · 2 comments

Master sha1 95fcc18

F, [2015-03-24T08:51:44.862454 #12126] FATAL -- : 
NoMethodError (undefined method `>' for nil:NilClass):
  vendor/bundle/ruby/2.1.0/bundler/gems/atmosphere-a2b459c52559/lib/atmosphere/utils.rb:7:in `block in min_elements_by'
  vendor/bundle/ruby/2.1.0/bundler/gems/atmosphere-a2b459c52559/lib/atmosphere/utils.rb:5:in `each'
  vendor/bundle/ruby/2.1.0/bundler/gems/atmosphere-a2b459c52559/lib/atmosphere/utils.rb:5:in `min_elements_by'
  vendor/bundle/ruby/2.1.0/bundler/gems/atmosphere-a2b459c52559/app/providers/atmosphere/optimization_strategy/default.rb:76:in `block in select'
  vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.8/lib/active_record/relation/delegation.rb:132:in `each'
  vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.8/lib/active_record/relation/delegation.rb:132:in `inject'
  vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.8/lib/active_record/relation/delegation.rb:132:in `public_send'
  vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.8/lib/active_record/relation/delegation.rb:132:in `method_missing'
  vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.8/lib/active_record/relation/delegation.rb:99:in `method_missing'
  vendor/bundle/ruby/2.1.0/bundler/gems/atmosphere-a2b459c52559/app/providers/atmosphere/optimization_strategy/default.rb:74:in `select'
  vendor/bundle/ruby/2.1.0/bundler/gems/atmosphere-a2b459c52559/app/providers/atmosphere/optimization_strategy/default.rb:11:in `select_tmpls_and_flavors'
  vendor/bundle/ruby/2.1.0/bundler/gems/atmosphere-a2b459c52559/app/providers/atmosphere/optimization_strategy/default.rb:26:in `new_vms_tmpls_and_flavors'
  vendor/bundle/ruby/2.1.0/bundler/gems/atmosphere-a2b459c52559/app/services/atmosphere/optimizer.rb:32:in `satisfy_appliance'
  vendor/bundle/ruby/2.1.0/bundler/gems/atmosphere-a2b459c52559/app/services/atmosphere/optimizer.rb:10:in `run'
  vendor/bundle/ruby/2.1.0/bundler/gems/atmosphere-a2b459c52559/app/models/atmosphere/appliance.rb:189:in `optimize_saved_appliance'
  vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:424:in `block in make_lambda'
  vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:221:in `call'
  vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:221:in `block in halting_and_conditional'
  vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:86:in `call'
  vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:86:in `run_callbacks'
  vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.8/lib/active_record/callbacks.rb:306:in `_create_record'
  vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.8/lib/active_record/timestamp.rb:57:in `_create_record'
  vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.8/lib/active_record/persistence.rb:483:in `create_or_update'
  vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.8/lib/active_record/callbacks.rb:302:in `block in create_or_update'
  vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:113:in `call'
  vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:113:in `call'
  vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:166:in `block in halting'
  vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:166:in `call'
  vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:166:in `block in halting'
  vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:166:in `call'
  vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:166:in `block in halting'
  vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:166:in `call'
  vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:166:in `block in halting'
  vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:166:in `call'
  vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:166:in `block in halting'
  vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:166:in `call'
  vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:166:in `block in halting'
  vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:166:in `call'
  vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:166:in `block in halting'
  vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:86:in `call'
  vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:86:in `run_callbacks'
  vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.8/lib/active_record/callbacks.rb:302:in `create_or_update'
  vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.8/lib/active_record/persistence.rb:125:in `save!'
  vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.8/lib/active_record/validations.rb:57:in `save!'
  vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.8/lib/active_record/attribute_methods/dirty.rb:29:in `save!'
  vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.8/lib/active_record/transactions.rb:273:in `block in save!'
  vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.8/lib/active_record/transactions.rb:329:in `block in with_transaction_returning_status'
  vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `block in transaction'
  vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:209:in `within_new_transaction'
  vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `transaction'
  vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.8/lib/active_record/transactions.rb:208:in `transaction'
  vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.8/lib/active_record/transactions.rb:326:in `with_transaction_returning_status'
  vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.8/lib/active_record/transactions.rb:273:in `save!'
  vendor/bundle/ruby/2.1.0/bundler/gems/atmosphere-a2b459c52559/app/controllers/atmosphere/api/v1/appliances_controller.rb:22:in `create'

/cc @tbartynski, @nowakowski

Exception is thrown for AneuFuse appliance type

at = Atmosphere::ApplianceType.find_by name: 'AneuFuse'
params = { cpu: aneu.preference_cpu, memory: aneu.preference_memory, disk: aneu.preference_disk }
tmpls = VirtualMachineTemplate.active.on_active_cs.where(appliance_type_id: at.id)

Optimizer.instance.select_tmpl_and_flavor(tmpls, params)

Most probably something wrong with flavors

The issue (which is now resolved) was caused by migration-related mixup on dev. Not a real bug. Closing.