Project

General

Profile

Actions

Bug #24348

closed

hammer host create returns ISE when LibVirt compute-resource is not in correct organization

Added by Ondřej Pražák almost 6 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Compute resources - libvirt
Target version:
-
Difficulty:
easy
Triaged:
Yes
Fixed in Releases:
Found in Releases:

Description

Description of problem:
`hammer host create ...` returns ISE instead of an error message when LibVirt compute-resource is not in correct organization

Version-Release number of selected component (if applicable):
nightly

How reproducible:
always

Steps to Reproduce:
1. Remove libvirt compute resource from your organization
2. # hammer -v -u admin -p changeme host create --architecture-id="3" --compute-resource-id="2" --domain-id="3" --environment-id="5" --ip="148.172.224.43" --location-id="5" --mac="94:e3:d9:06:72:48" --medium-id="10" --name="jhutar$RANDOM" --operatingsystem-id="3" --organization-id="6" --partition-table-id="141" --puppet-proxy-id="1" --root-password="\xea\xae\x8f\xf0\x98\x87\x8a\xe9\xb5\xa8\xd0\x9e\xec\x8b\xa4\xe6\xa9\x88\xe0\xae\x88\xe1\x8b\xb8\xe5\x83\x95\xf0\x97\xbf\xa3\xe7\x87\x93\xf0\x96\xa6\x9e\xeb\xa9\x83\xe7\x88\x8a\xe6\x88\x8f\xe7\x9d\x8d\xea\x85\xa0\xef\xac\x85"

Actual results:

2018-07-23T07:27:35 [I|app|a858c] Processing by Api::V2::HostsController#create as JSON
2018-07-23T07:27:35 [I|app|a858c]   Parameters: {"location_id"=>4, "organization_id"=>3, "host"=>{"name"=>"libvirt-org", "location_id"=>4, "organization_id"=>3, "environment_id"=>1, "ip"=>"148.172.224.43", "mac"=>"94:e3:d9:06:72:48", "architecture_id"=>1, "domain_id"=>1, "puppet_proxy_id"=>1, "puppetclass_ids"=>[], "operatingsystem_id"=>1, "medium_id"=>1, "ptable_id"=>94, "compute_resource_id"=>1, "build"=>true, "enabled"=>true, "managed"=>true, "compute_attributes"=>{"volumes_attributes"=>{}}, "content_facet_attributes"=>{}, "subscription_facet_attributes"=>{}, "overwrite"=>true, "host_parameters_attributes"=>[], "interfaces_attributes"=>[], "root_pass"=>"[FILTERED]"}, "apiv"=>"v2"}
2018-07-23T07:27:35 [I|app|a858c] Authorized user admin(Admin User)
2018-07-23T07:27:35 [I|app|a858c] Current user set to admin (admin)
2018-07-23T07:27:36 [W|app|a858c] Action failed
NoMethodError: undefined method `provided_attributes' for nil:NilClass
/usr/share/foreman/app/models/concerns/orchestration/compute.rb:30:in `compute_provides?'
/usr/share/foreman/app/models/nic/base.rb:181:in `compute_provides_ip?'
/usr/share/foreman/app/services/nic_ip_required/base.rb:58:in `compute_provides_ip?'
/usr/share/foreman/app/services/nic_ip_required/base.rb:20:in `required?'
/usr/share/foreman/app/models/nic/base.rb:165:in `require_ip4_validation?'
/usr/share/foreman/app/models/nic/base.rb:35:in `block in <class:Base>'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:413:in `instance_exec'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:413:in `block in make_lambda'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:177:in `block (2 levels) in halting_and_conditional'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:177:in `each'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:177:in `all?'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:177:in `block in halting_and_conditional'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:507:in `block in invoke_before'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:507:in `each'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:507:in `invoke_before'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:130:in `run_callbacks'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:827:in `_run_validate_callbacks'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activemodel-5.1.6/lib/active_model/validations.rb:405:in `run_validations!'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activemodel-5.1.6/lib/active_model/validations/callbacks.rb:114:in `block in run_validations!'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:131:in `run_callbacks'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:827:in `_run_validation_callbacks'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activemodel-5.1.6/lib/active_model/validations/callbacks.rb:114:in `run_validations!'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activemodel-5.1.6/lib/active_model/validations.rb:335:in `valid?'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/validations.rb:65:in `valid?'
/usr/share/foreman/app/models/concerns/orchestration.rb:86:in `valid?'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/autosave_association.rb:334:in `association_valid?'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/autosave_association.rb:321:in `block in validate_collection_association'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/autosave_association.rb:321:in `each'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/autosave_association.rb:321:in `each_with_index'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/autosave_association.rb:321:in `validate_collection_association'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/autosave_association.rb:220:in `block in define_autosave_validation_callbacks'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/autosave_association.rb:158:in `instance_eval'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/autosave_association.rb:158:in `block in define_non_cyclic_method'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:413:in `block in make_lambda'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:197:in `block (2 levels) in halting'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:601:in `block (2 levels) in default_terminator'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:600:in `catch'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:600:in `block in default_terminator'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:198:in `block in halting'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:507:in `block in invoke_before'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:507:in `each'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:507:in `invoke_before'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:130:in `run_callbacks'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:827:in `_run_validate_callbacks'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activemodel-5.1.6/lib/active_model/validations.rb:405:in `run_validations!'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activemodel-5.1.6/lib/active_model/validations/callbacks.rb:114:in `block in run_validations!'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:131:in `run_callbacks'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:827:in `_run_validation_callbacks'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activemodel-5.1.6/lib/active_model/validations/callbacks.rb:114:in `run_validations!'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activemodel-5.1.6/lib/active_model/validations.rb:335:in `valid?'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/validations.rb:65:in `valid?'
/usr/share/foreman/app/models/concerns/orchestration.rb:86:in `valid?'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/validations.rb:82:in `perform_validations'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/validations.rb:44:in `save'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/attribute_methods/dirty.rb:35:in `save'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/transactions.rb:308:in `block (2 levels) in save'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/transactions.rb:384:in `block in with_transaction_returning_status'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `block in transaction'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/transaction.rb:194:in `block in within_new_transaction'
/opt/rh/rh-ruby24/root/usr/share/ruby/monitor.rb:214:in `mon_synchronize'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/transaction.rb:191:in `within_new_transaction'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `transaction'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/transactions.rb:210:in `transaction'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/transactions.rb:381:in `with_transaction_returning_status'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/transactions.rb:308:in `block in save'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/transactions.rb:323:in `rollback_active_record_state!'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/transactions.rb:307:in `save'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/suppressor.rb:42:in `save'
/usr/share/foreman/app/models/concerns/foreman/sti.rb:26:in `save'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.13.3/app/models/foreman_tasks/concerns/action_triggering.rb:27:in `block in save'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.13.3/app/models/foreman_tasks/concerns/action_triggering.rb:127:in `dynflow_task_wrap'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.13.3/app/models/foreman_tasks/concerns/action_triggering.rb:27:in `save'
/usr/share/foreman/app/controllers/api/v2/hosts_controller.rb:145:in `create'

Expected results:
Should return nice error message that compute resource is not in a correct organization.


Related issues 2 (0 open2 closed)

Related to Foreman - Bug #24199: Assigning environment on host create doesn't check the assignment of organization/locationClosedIvan NecasActions
Copied to Foreman - Bug #25098: `hammer host create ...` returns ISE instead of an error message when LibVirt compute-resource is not in correct organizationClosedSebastian GräßlActions
Actions #1

Updated by Marek Hulán almost 6 years ago

  • Related to Bug #24199: Assigning environment on host create doesn't check the assignment of organization/location added
Actions #2

Updated by Marek Hulán almost 6 years ago

  • Subject changed from `hammer host create ...` returns ISE instead of an error message when LibVirt compute-resource is not in correct organization to `hammer host create ...` returns ISE instead of an error message when LibVirt compute-resource is not in correct organization

This should be fixed using the new validation method added in related issue

Actions #3

Updated by Tomer Brisker over 5 years ago

  • Difficulty set to easy
  • Triaged changed from No to Yes
Actions #4

Updated by The Foreman Bot over 5 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/6027 added
Actions #5

Updated by Tomer Brisker over 5 years ago

  • Fixed in Releases 1.20.0 added
Actions #6

Updated by Sebastian Gräßl over 5 years ago

  • Status changed from Ready For Testing to Closed
Actions #7

Updated by Marek Hulán over 5 years ago

  • Copied to Bug #25098: `hammer host create ...` returns ISE instead of an error message when LibVirt compute-resource is not in correct organization added
Actions #8

Updated by Tomer Brisker over 5 years ago

  • Subject changed from `hammer host create ...` returns ISE instead of an error message when LibVirt compute-resource is not in correct organization to hammer host create returns ISE when LibVirt compute-resource is not in correct organization
Actions

Also available in: Atom PDF