chef-boneyard / chef-provisioning

A library for creating machines and infrastructures idempotently in Chef.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

undefined method `[]' for nil:NilClass (vSphere Provisioning)

jsstormshak opened this issue · comments

Undefined method when attempting to converge a cloned vCenter VM from Template. The cloning is fully successful within this same Cookbook, however, the start_up (Power On) fails and produces this error. See details below. Any and all help here is greatly appreciated. Thanks!

vCenter 6
Chef vSphere Provisioning Cookbook - 0.8.3
Chef Client 12.5.1

Actual Cookbook:
chef_gem 'chef-provisioning-vsphere' do
action :install
compile_time true
end
require 'chef/provisioning/vsphere_driver'
with_vsphere_driver host: 'vcenter-2.domain.com',
insecure: true,
user: 'domain\username,
password: 'password'
with_machine_options :bootstrap_options => {
use_linked_clone: true,
num_cpus: 1,
memory_mb: 2048,
datacenter: 'Marion',
host: 'Management/esxi-15b14.domain.com',
template_name: 'Service-Portal-Template-VM',
template_folder: 'Linux/Infrastructure/SelfServicePortal',
vm_folder: 'Linux/Infrastructure/SelfServicePortal',
chef_server: "https://ma-chefserver-p1.cccis.com:443",
chef_environment: "Chef Development",
customization_spec: {
ipsettings: {
ip: '10.88.65.xx',
subnetMask: '255.255.252.0',
gateway: ['10.88.xx.1'],
dnsServerList: ['10.88.196.xx','10.88.196.xx']
},
domain: 'domain.com'
}
},
:ssh => {
:user => 'chefboot',
:password => 'password',
:paranoid => false,
:port => 22
},
:sudo => true

machine 'ma-Service-Portal-p1' do
run_list ['recipe[Linux_Run_Once::Manage_Run_Once]']
action :converge
end

Output that includes details and error message:
establishing connection to ma-vcs-2.win.cccis.com
- creating machine ma-Service-Portal-p1 on vsphere://vcenter-2.domain.com/sdk?use_ssl=true&insecure=true
- use_linked_clone: true
- num_cpus: 1
- memory_mb: 2048
- datacenter: "Marion"
- template_name: "ma-vanilla-OL5U5-OSOnly-NoSANFS"
- template_folder: "Linux/Infrastructure/SelfServicePortal"
- vm_folder: "Linux/Infrastructure/SelfServicePortal"
- chef_server: "https://chefserver.domain.com:443"
- chef_environment: "Chef Development"
- customization_spec: {:ipsettings=>{:ip=>"10.88.65.XX", :subnetMask=>"255.255.252.0", :gateway=>["10.88.XX.1"], :dnsServerList=>["10.88.196.54", "10.88.196.55"]}, :domain=>"cccis.com"}
- customizing ma-Service-Portal-p1 with static IP 10.88.65.XX
- customizing ma-Service-Portal-p1 with /
dynamic IP and DNS: ["10.88.196.XX", "10.88.196.XX"]
- Machine - created - ma-Service-Portal-p1 (5016359f-e732-a9e2-ae59-f7917a3c28e3 on vsphere://vcenter-2.domain.com/sdk?use_ssl=true&insecure=true)[2016-06-08T18:58:58+00:00] INFO: Processing chef_node[ma-Service-Portal-p1] action create (basic_chef_client::block line 57)

- update node ma-Service-Portal-p1 at chefzero://localhost:8889
-   update normal.chef_provisioning.reference.server_id from "50162694-3ce0-c57d-0ed5-10bc6d9ba23f" to "5016359f-e732-a9e2-ae59-f7917a3c28e3"
-   update normal.chef_provisioning.reference.allocated_at from "2016-06-08 18:43:46 UTC" to "2016-06-08 18:58:58 UTC"
-   update run_list from ["recipe[Linux_Run_Once]"] to ["Linux_Run_Once"]
=============================================================================
Error executing action `converge` on resource 'machine[ma-Service-Portal-p1]'

    NoMethodError
-------------
undefined method `[]' for nil:NilClass
Resource Declaration:
---------------------
# In /home/jstormsh/.chef/local-mode-cache/cache/cookbooks/Linux_Adhoc_Deployments/recipes/Manage_Adhoc_Deploys.rb
---------------------
# In /home/jstormsh/.chef/local-mode-cache/cache/cookbooks/Linux_Adhoc_Deployments/recipes/Manage_Adhoc_Deploys.rb

 49: machine 'ma-Service-Portal-p1' do
 50:   run_list ['recipe[Linux_Run_Once::Manage_Run_Once]']
 51:   action :converge
 52:   converge true
 53: end

Stack Trace:
Generated at 2016-06-09 16:00:45 +0000
NoMethodError: machine[ma-Service-Portal-p1](Linux_Adhoc_Deployments::Manage_Adhoc_Deploys line 49) had an error: NoMethodError: undefined method []' for nil:NilClass /home/jstormsh/.chefdk/gem/ruby/2.1.0/gems/chef-provisioning-vsphere-0.8.3/lib/chef/provisioning/vsphere_driver/driver.rb:418:inblock in start_machine'