Description of problem: When creating EC2 instance with manual VPC selection, the REST API request fails with internal server error when the specified security group doesn't correspond to the selected cloud network. {'error': {'kind': 'internal_server_error', 'klass': 'NoMethodError', 'message': "undefined method `to_a' for 65:Fixnum Did you mean? to_yaml to_param to_c to_d to_r to_i to_f to_s Relevant log from evm.log: http://pastebin.test.redhat.com/464907 Version-Release number of selected component (if applicable): both 5.7.1.3 and 5.8.0.4 How reproducible: very Steps to Reproduce: Sample request: POST /api/provision_requests { "action": "create", "version": "1.1", "template_fields": { "guid": "11d44078-04ba-11e7-89eb-005056969c69" }, "vm_fields": { "vm_name": "test-dfvsdfsdf-weox", "instance_type": 42, "request_type": "template", "placement_auto": false, "cloud_network": 1, "cloud_subnet": 2, "placement_availability_zone": 3, "security_groups": 65, <= this doesn't correspond to the cloud_network "guest_access_key_pair": 65, "monitoring": "basic" }, "requester": { "user_name": "admin", "owner_first_name": "Administrator", "owner_last_name": "Administratorovich", "owner_email": "admin", "auto_approve": true } } Expected results: graceful fail
Able to duplicate the issue using the API with the following procedure: 1. Provision to AWS using a dialog from the classic UI 2. Run the rebuild_provision_request tool (ruby tools/rebuild_provision_request.rb --request-id=<id> --console)using the provision request id created in step one. 3. Taking the output from the tool I manually modified the security_groups value to something not available on the provider. 4. Paste the changed output ( including the different security_groups value ) in the Rails console. require 'rest-client'; RestClient.post 'http://user:pass@localhost:3000/api/provision_requests', '{"version":"1.1","template_fields":{"guid":"6582c94e-8425-11e6-94b4-a45e60f1b905","name":"test-linux","request_type":"template"},"vm_fields":{"placement_auto":false,"placement_availability_zone":13,"cloud_network":10,"cloud_subnet":23,"security_groups":6,"number_of_vms":1,"vm_name":"db_test_provision_1","retirement":0,"retirement_warn":604800,"instance_type":136,"guest_access_key_pair":125,"monitoring":"basic","addr_mode":"dhcp"},"requester":{"owner_first_name":"d","owner_last_name":"b","owner_email":"db"},"tags":{},"additional_values":null,"ems_custom_attributes":null,"miq_custom_attributes":null}' 5. The log shows the error as referenced in the BZ description
https://github.com/ManageIQ/manageiq/pull/15409
https://github.com/ManageIQ/manageiq-providers-azure/pull/91
New commit detected on ManageIQ/manageiq/master: https://github.com/ManageIQ/manageiq/commit/4b29550be9d29f8bbf4e11e7ba6dc67348375425 commit 4b29550be9d29f8bbf4e11e7ba6dc67348375425 Author: Drew Bomhof <dbomhof> AuthorDate: Tue Jun 20 11:53:12 2017 -0400 Commit: Drew Bomhof <dbomhof> CommitDate: Mon Jul 10 17:18:29 2017 -0400 Manage passing varying data types to security_groups https://bugzilla.redhat.com/show_bug.cgi?id=1432578 app/models/miq_request_workflow.rb | 24 ++++++++++++++++------ .../miq_provision_amazon_dialogs_template.yaml | 2 +- .../miq_provision_openstack_dialogs_template.yaml | 2 +- spec/models/miq_request_workflow_spec.rb | 8 ++++++++ 4 files changed, 28 insertions(+), 8 deletions(-)
Verified that the exception no longer happens.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2018:0380