Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1508069 - set_network_adapter method erroring out with undefined method `[]' for nil:NilClass')]
Summary: set_network_adapter method erroring out with undefined method `[]' for nil:Ni...
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate
Version: 5.8.0
Hardware: All
OS: Linux
Target Milestone: GA
: 5.10.0
Assignee: Greg McCullough
QA Contact: Dave Johnson
Depends On:
Blocks: 1503797 1511501 1511502
TreeView+ depends on / blocked
Reported: 2017-10-31 19:12 UTC by Lynn Dixon
Modified: 2018-06-21 20:42 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1511501 1511502 (view as bug list)
Last Closed: 2018-06-21 20:42:19 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:

Attachments (Terms of Use)
method being used to add nics in provisioning request. (deleted)
2017-10-31 19:12 UTC, Lynn Dixon
no flags Details

Description Lynn Dixon 2017-10-31 19:12:22 UTC
Created attachment 1346070 [details]
method being used to add nics in provisioning request.

Description of problem:
When trying to provision a VM into VMware and adding additional nics (beyond first nic) during provisioning, using the set_network_adapter method, a cryptic error of "undefined method `[]' for nil:NilClass')]"  results, and automate exits.

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

How reproducible:
Connect CFME 5.8.2 to vCenter version 6.0.0 and use the set_network_adapter method as such:

prov.set_network_adapter(1, {:network => network2, :is_dvs => false} ) 

Actual results:
VM Provision errors out, and subsequent service provision as well with following error:
Calling Create Notification type: automate_user_error subject type: MiqRequest id: 86 options: {:message=>"VM Provision Error: [calo-dev-cfme-wk1] VM [vmw_nics_01] Step [CheckProvisioned] Status [Error Creating VM] Message [[NoMethodError]: undefined method `[]' for nil:NilClass] "}

Expected results:
VM is provisioned and additional nics are added.

Additional info:
CFME 5.8.2
vCenter Version 6.0.0 Build 5318172
VMware template has one nic, but Custom Spec has 5 defined.

I will attach the actual method that I am using in my state machine.  I have this method being called in the Infrastucture --> VM --> Provisioning -> StateMachine -> VMProvision_VM -> Provision VM From Template statemachine.  It is placed in the schema immediately before pre-provisioning.

Comment 7 CFME Bot 2017-11-08 19:44:21 UTC
New commit detected on ManageIQ/manageiq-providers-vmware/master:

commit 8b196f6027a3bc0ae77f2cbb15ebab58a3309ec5
Author:     Greg McCullough <>
AuthorDate: Sat Nov 4 19:47:35 2017 -0400
Commit:     Greg McCullough <>
CommitDate: Mon Nov 6 09:02:43 2017 -0500

    Properly update network hash when the first array element is nil
    Refactor and add tests for normalize_network_adapter_settings

 .../provision/configuration/network.rb             | 40 ++++++++++------
 .../provision/configuration/network_spec.rb        | 55 ++++++++++++++++++++++
 2 files changed, 81 insertions(+), 14 deletions(-)
 create mode 100644 spec/models/manageiq/providers/vmware/infra_manager/provision/configuration/network_spec.rb

Note You need to log in before you can comment on or make changes to this bug.