Bug #12320
closedHammer CLI : Failed to create a new VM on OpenStack - undefined method `delete_if' for nil:NilClass
Description
Hello!
Using this command line :
hammer --username admin --password nms123 host create --hostgroup-id 2 --compute-resource-id 11 --name newnode --interface="type=interface,primary=true,provision=true,managed=true,virtualnic=false" --compute-attributes "flavor_ref=2,tenant_id=5c231dcefbce40c0b57b6f2db60b8b71,security_groups=default,image_ref=7dd9edd9-b70b-4663-b651-e88f250053ef,net_id=private_admin"
I got error message :
Failed to create a compute OpenStack (OpenStack) instance newnode.openstacklocal: undefined method `delete_if' for nil:NilClass
2015-10-27T13:01:30 [sql] [I] Adding Compute instance for newnode.openstacklocal
2015-10-27T13:01:30 [sql] [W] failed to create vm: undefined method `delete_if' for nil:NilClass
2015-10-27T13:01:30 [app] [W] Failed to create a compute OpenStackVysavac (OpenStack) instance newnode.openstacklocal: undefined method `delete_if' for nil:NilClass
|
| RuntimeError: undefined method `delete_if' for nil:NilClass
| /usr/share/foreman/app/models/compute_resources/foreman/model/openstack.rb:94:in `rescue in create_vm'
| /usr/share/foreman/app/models/compute_resources/foreman/model/openstack.rb:77:in `create_vm'
| /usr/share/foreman/app/models/concerns/orchestration/compute.rb:76:in `setCompute'
| /usr/share/foreman/app/models/concerns/orchestration.rb:152:in `execute'
| /usr/share/foreman/app/models/concerns/orchestration.rb:97:in `block in process'
| /usr/share/foreman/app/models/concerns/orchestration.rb:89:in `each'
| /usr/share/foreman/app/models/concerns/orchestration.rb:89:in `process'
| /usr/share/foreman/app/models/concerns/orchestration.rb:19:in `on_save'
| /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:660:in `_run__2374701391934229388__save__4604321682448592473__callbacks'
| /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:405:in `__run_callback'
| /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:385:in `_run_save_callbacks'
| /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:81:in `run_callbacks'
| /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/callbacks.rb:264:in `create_or_update'
| /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/persistence.rb:84:in `save'
| /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/validations.rb:50:in `save'
| /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/attribute_methods/dirty.rb:22:in `save'
| /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/transactions.rb:259:in `block (2 levels) in save'
| /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
| /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
| /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/transactions.rb:208:in `transaction'
| /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
| /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/transactions.rb:259:in `block in save'
| /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/transactions.rb:270:in `rollback_active_record_state!'
| /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/transactions.rb:258:in `save'
| /usr/share/foreman/app/models/concerns/foreman/sti.rb:29:in `save_with_type'
| /usr/share/foreman/app/controllers/api/v2/hosts_controller.rb:87:in `create'
| /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.21/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
| /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.21/lib/abstract_controller/base.rb:167:in `process_action'
| /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.21/lib/action_controller/metal/rendering.rb:10:in `process_action'
| /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.21/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
| /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:573:in `block (5 levels) in run_2737492662265853562__process_action__2399364825739452189__callbacks'
| /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:215:in `block in _conditional_callback_around_7552'
| /usr/share/foreman/app/controllers/api/v2/base_controller.rb:151:in `disable_json_root'
| /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:214:in `_conditional_callback_around_7552'
| /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:550:in `block (4 levels) in run_2737492662265853562__process_action__2399364825739452189__callbacks'
Using compute resource GUI it works fine.
I'm new to foreman, maybe I miss something in my command line. But at least I would not expect such error message.
Thanks
Jan
Updated by Dominic Cleal about 9 years ago
- Related to Bug #8769: Unable to build new VM in openstack with API added
Updated by Ronan Lanore about 5 years ago
- Fixed in Releases hammer-cli-foreman-0.17.0 added
- Found in Releases hammer-cli-foreman-0.17.0 added
- Found in Releases deleted (
1.9.2)
It's a docuementation problem. You must provide security group as an array on command line.
Like:
--compute-attributes=security_groups=["default"]
Updated by Martin Bacovsky about 5 years ago
- Project changed from Hammer CLI to Foreman
- Category changed from Hammer core to Compute resources - OpenStack
If this is caused by invalid data API should validate and respond with helpful error message guiding the user to correct his input.
Moving to OpenStack component
Updated by Ewoud Kohl van Wijngaarden about 2 years ago
- Status changed from New to Rejected
Closing this due to its age. Please reopen if it's still relevant.