Bug #11550
closedFailed to create a compute vmware-hq (VMware) instance es1.initial..dev: undefined method `key?' for #<String:0x0000000ab647e8>
Description
I try clone new vm from my vmware template but receive this error.
In production.log i found this:
2015-08-25T13:06:46 [app] [I] Processing by HostsController#create as */* 2015-08-25T13:06:46 [app] [I] Parameters: {"utf8"=>"✓", "authenticity_token"=>"lYAxdILeQcJm+8YZcArIGGaOTzbVIQN0BNkXGKgI/Og=", "host"=>{"name"=>"es1", "hostgroup_id"=>"", "compute_resource_id"=>"1", "compute_profile_id"=>"1", "environment_id"=>"1", "puppet_ca_proxy_id"=>"1", "puppet_proxy_id"=>"1", "puppetclass_ids"=>[""], "managed"=>"true", "progress_report_id"=>"[FILTERED]", "type"=>"Host::Managed", "interfaces_attributes"=>{"0"=>{"_destroy"=>"0", "type"=>"Nic::Managed", "mac"=>"", "identifier"=>"", "name"=>"es1", "domain_id"=>"2", "subnet_id"=>"1", "ip"=>"10.77.47.3", "managed"=>"1", "primary"=>"1", "provision"=>"1", "virtual"=>"0", "tag"=>"", "attached_to"=>"", "compute_attributes"=>{"type"=>"VirtualE1000", "network"=>"PG_Vlan_147_Developers_Network"}}}, "compute_attributes"=>{"cpus"=>"1", "corespersocket"=>"1", "memory_mb"=>"8192", "cluster"=>"Vmware-Cluster-03", "path"=>"/Datacenters/South Port/vm/Developers_new", "guest_id"=>"debian7_64Guest", "scsi_controller_type"=>"ParaVirtualSCSIController", "hardware_version"=>"Default", "start"=>"1", "volumes_attributes"=>{"0"=>{"_delete"=>"", "datastore"=>"HQ-QNAP-02_Developers_Datastore", "name"=>"Hard disk", "size_gb"=>"25", "thin"=>"false", "eager_zero"=>"false"}}, "image_id"=>"Developers_new/linux_dev"}, "architecture_id"=>"1", "operatingsystem_id"=>"1", "provision_method"=>"image", "build"=>"1", "medium_id"=>"", "ptable_id"=>"", "disk"=>"", "root_pass"=>"[FILTERED]", "is_owned_by"=>"3-Users", "enabled"=>"1", "comment"=>"", "overwrite"=>"false"}, "capabilities"=>"build image", "provider"=>"Vmware"} 2015-08-25T13:06:55 [app] [W] Failed to create a compute vmware-hq (VMware) instance es1.initial.dev: undefined method `key?' for #<String:0x0000000ab647e8> | | NoMethodError: undefined method `key?' for #<String:0x0000000ab647e8> | /usr/share/foreman/vendor/ruby/1.9.1/gems/fog-1.32.0/lib/fog/vsphere/requests/compute/cloudinit_to_customspec.rb:16:in `cloudinit_to_customspec' | /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:376:in `clone_vm' | /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:323:in `create_vm'
How i can debug this error?
Updated by Dominic Cleal about 9 years ago
- Status changed from New to Need more information
Check which cloud-init template you have associated by viewing the host's Templates tab (on the left), it needs to be YAML format.
Updated by Nikita Stupin about 9 years ago
I create cloud-init template with this content.
--- globalIPSettings: dnsServerList: - <%= @host.subnet.dns_primary %> dnsSuffixList: - <%= @host.domain %> identity: LinuxPrep: domain: <%= @host.domain %> hostName: <%= @host.shortname %> hwClockUTC: true timeZone: "Europe/Moscow" nicSettingMap: - adapter: dnsDomain: <%= @host.domain %> dnsServerList: - <%= @host.subnet.dns_primary %> gateway: - <%= @host.subnet.gateway %> ip: <%= @host.ip %> subnetMask: <%= @host.subnet.mask %>
Virtual machine suceftully create from template but:
1. I set storage as 25GB in template set storage set as 50GB, in new VM storage size not changed. This correctly or bug?
2. Network adapter in new VM is disabled.
3. VM after create in foreman interface marked as "pending installation".
Updated by Dominic Cleal about 9 years ago
Nikita Stupin wrote:
I create cloud-init template with this content.
[...]
Is the template showing as linked to the host, either on the Templates tab or via the Resolve Templates button when editing the host?
Virtual machine suceftully create from template but:
1. I set storage as 25GB in template set storage set as 50GB, in new VM storage size not changed. This correctly or bug?
Bug, but fixed for 1.10 via #9705.
2. Network adapter in new VM is disabled.
3. VM after create in foreman interface marked as "pending installation".
Probably because of this failure.
Updated by Nikita Stupin about 9 years ago
Dominic Cleal wrote:
linked to the hostIs the template showing as linked to the host, either on the Templates tab or via the Resolve Templates button when editing the host?
Bug, but fixed for 1.10 via #9705.
Thanks!
2. Network adapter in new VM is disabled.
3. VM after create in foreman interface marked as "pending installation".Probably because of this failure.
But, disabled network adapter is bug of the foreman or my template?
Updated by Dominic Cleal about 9 years ago
- Status changed from Need more information to New
Nikita Stupin wrote:
Dominic Cleal wrote:
2. Network adapter in new VM is disabled.
3. VM after create in foreman interface marked as "pending installation".Probably because of this failure.
But, disabled network adapter is bug of the foreman or my template?
Not sure, if you're hitting an exception during provisioning then all bets are off about the final state of the VM. I don't know why you're seeing this error, leaving the ticket open.
Updated by Nikita Stupin about 9 years ago
Please close this ticket, error with " undefined method `key?" is not actually.
About disabled network adapter may be i create new ticket?
Updated by Dominic Cleal about 9 years ago
- Status changed from New to Resolved
Nikita Stupin wrote:
Please close this ticket, error with " undefined method `key?" is not actually.
Do you know what the cause was in the end? It might be useful to record it for others.
About disabled network adapter may be i create new ticket?
If it's still happening after the exception's fixed, then yep, could be worthwhile. Also it might be worth trying on nightlies in a couple of days time (once built) since the fix I mentioned above for storage also changed how network interfaces are cloned, and was only just merged to nightlies.
Updated by Nikita Stupin about 9 years ago
Dominic Cleal wrote:
Do you know what the cause was in the end? It might be useful to record it for others.
Yes, cause in invalid YAML in my cloud init template. May be add checking YAML validate, or add example cloud-init template in default configuration?
About disabled network adapter may be i create new ticket?
If it's still happening after the exception's fixed, then yep, could be worthwhile. Also it might be worth trying on nightlies in a couple of days time (once built) since the fix I mentioned above for storage also changed how network interfaces are cloned, and was only just merged to nightlies.
Thanks! I try backport this changes in my 1.9 or try nightly.
Updated by Dominic Cleal about 9 years ago
Nikita Stupin wrote:
Dominic Cleal wrote:
Do you know what the cause was in the end? It might be useful to record it for others.
Yes, cause in invalid YAML in my cloud init template. May be add checking YAML validate, or add example cloud-init template in default configuration?
Interesting, syntax check might be something to raise to Fog as it appears to all be there. If you have a useful template that might serve as a default, please submit it to https://github.com/theforeman/community-templates/tree/develop/cloudinit
Updated by Ivan Necas about 7 years ago
- Related to Bug #14058: vmware provisioning fails with cryptic error when not using propper user_data script added