Bug #26940
closedcreating host with openscap capsule fails with ISE when org/loc is not properly selected for a capsule
Description
Description of problem:
Creating host with openscap capsule fails with ISE when org/loc is not properly selected for a capsule
How reproducible:
always
Steps to Reproduce:
1. # hammer -v -u admin -p changeme --output=csv host create --architecture-id="1" --domain-id="4" --ip="95.253.203.135" --location-id="1" --mac="c4:28:04:a8:20:bb" --medium-id="12" --name="QBtbElRVyA" --operatingsystem-id="1" --openscap-proxy-id="1" --organization-id="7" --partition-table-id="104" --root-password="RLxtKubz"
Actual results:
Could not create the host:
Internal Server Error: the server was unable to finish the request. This may be caused by unavailability of some required service, incorrect API call or a server-side bug. There may be more information in the server's logs.
2019-06-04T07:55:24 [I|app|96b4f46e] Started POST "/api/hosts" for ::1 at 2019-06-04 07:55:24 +0000 2019-06-04T07:55:24 [I|app|96b4f46e] Processing by Api::V2::HostsController#create as JSON 2019-06-04T07:55:24 [I|app|96b4f46e] Parameters: {"location_id"=>2, "organization_id"=>28, "host"=>{"name"=>"uax", "location_id"=>2, "organization_id"=>28, "ip"=>"95.253.203.135", "mac"=>"c4:28:04:a8:20:bb", "architecture_id"=>1, "domain_id"=>1, "openscap_proxy_id"=>1, "puppetclass_ids"=>[], "operatingsystem_id"=>1, "medium_id"=>1, "ptable_id"=>90, "compute_attributes"=>{"volumes_attributes"=>{}}, "content_facet_attributes"=>{}, "subscription_facet_attributes"=>{}, "build"=>true, "managed"=>true, "enabled"=>true, "overwrite"=>true, "interfaces_attributes"=>[], "root_pass"=>"[FILTERED]"}, "apiv"=>"v2"} 2019-06-04T07:55:24 [D|app|96b4f46e] Authenticated user admin against INTERNAL authentication source 2019-06-04T07:55:24 [D|app|96b4f46e] Current user set to foreman_admin (admin) 2019-06-04T07:55:24 [I|app|96b4f46e] Authorized user admin(Admin User) 2019-06-04T07:55:24 [I|app|96b4f46e] Current user set to admin (admin) 2019-06-04T07:55:24 [D|app|96b4f46e] Current location set to Default Location 2019-06-04T07:55:24 [D|app|96b4f46e] Current organization set to Unassigned Organization 2019-06-04T07:55:24 [D|app|96b4f46e] Current location set to Default Location 2019-06-04T07:55:24 [D|app|96b4f46e] Current organization set to Unassigned Organization 2019-06-04T07:55:24 [W|app|96b4f46e] Action failed | NoMethodError: undefined method `has_feature?' for nil:NilClass | /home/vagrant/projects/foreman_openscap/app/models/concerns/foreman_openscap/openscap_proxy_core_extensions.rb:68:in `openscap_proxy_has_feature' | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:426:in `block in make_lambda' | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:198:in `block (2 levels) in halting' | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:606:in `block (2 levels) in default_terminator' | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:605:in `catch' | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:605:in `block in default_terminator' | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:199:in `block in halting' | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:513:in `block in invoke_before' | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:513:in `each' | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:513:in `invoke_before' | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:131:in `run_callbacks' | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:816:in `_run_validate_callbacks' | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activemodel-5.2.1/lib/active_model/validations.rb:409:in `run_validations!' | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activemodel-5.2.1/lib/active_model/validations/callbacks.rb:118:in `block in run_validations!' | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:132:in `run_callbacks' | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:816:in `_run_validation_callbacks' | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activemodel-5.2.1/lib/active_model/validations/callbacks.rb:118:in `run_validations!' | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activemodel-5.2.1/lib/active_model/validations.rb:339:in `valid?' | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activerecord-5.2.1/lib/active_record/validations.rb:67:in `valid?' | /home/vagrant/projects/foreman/app/models/concerns/orchestration.rb:86:in `valid?' | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activerecord-5.2.1/lib/active_record/validations.rb:84:in `perform_validations' | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activerecord-5.2.1/lib/active_record/validations.rb:46:in `save' | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activerecord-5.2.1/lib/active_record/transactions.rb:310:in `block (2 levels) in save' | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activerecord-5.2.1/lib/active_record/transactions.rb:387:in `block in with_transaction_returning_status' | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:254:in `block in transaction' | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:239:in `block in within_new_transaction' | /home/vagrant/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize' | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:236:in `within_new_transaction' | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:254:in `transaction' | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activerecord-5.2.1/lib/active_record/transactions.rb:212:in `transaction' | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activerecord-5.2.1/lib/active_record/transactions.rb:385:in `with_transaction_returning_status' | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activerecord-5.2.1/lib/active_record/transactions.rb:310:in `block in save' | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activerecord-5.2.1/lib/active_record/transactions.rb:325:in `rollback_active_record_state!' | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activerecord-5.2.1/lib/active_record/transactions.rb:309:in `save' | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activerecord-5.2.1/lib/active_record/suppressor.rb:44:in `save' | /home/vagrant/projects/foreman/app/models/concerns/foreman/sti.rb:26:in `save'
Expected results:
Should not print ISE, but some reasonable error message
Additional info:
When I have fixed org/loc assignment in the capsule, same command worked.
Updated by The Foreman Bot almost 5 years ago
- Status changed from New to Ready For Testing
- Assignee set to Ondřej Pražák
- Pull request https://github.com/theforeman/foreman_openscap/pull/394 added
Updated by Marek Hulán almost 5 years ago
- Subject changed from creating host with openscap capsule fails with ISE when org/loc is not properly selected for a capsule to creating host with openscap capsule fails with ISE when org/loc is not properly selected for a capsule
- Fixed in Releases foreman_openscap 1.0.2 added
Updated by Anonymous almost 5 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset foreman_openscap|030d5705fd12c21510be523fc139555c6181930e.
Updated by Marek Hulán over 4 years ago
- Copied to Bug #27384: creating host with openscap capsule fails with ISE when org/loc is not properly selected for a capsule added