chef / knife-vsphere

Chef knife plug-in for VMware vSphere
Apache License 2.0
202 stars 125 forks source link

vsphere vm clone - error when specifying hostname/domain #177

Closed dmitriy-panasiuk closed 8 years ago

dmitriy-panasiuk commented 9 years ago

Hi,

I am trying to clone a vm from a template. It works fine, but if i add --chostname and --cdomain params it gives an error knife vsphere vm clone lcr_autodeployed_vm --template w2008r2_template --chostname lcr_test --cdomain ams.dev -f Templates --dest-folder test -VV INFO: Using configuration from C:/chef-repo/.chef/knife.rb DEBUG: value for config item chef_node_name: DEBUG: value for config item vsphere_host: nl1vc03.global.sdl.corp DEBUG: value for config item vsphere_path: /sdk DEBUG: value for config item vsphere_port: 443 DEBUG: value for config item vsphere_nossl: DEBUG: value for config item vsphere_user: global\srv-cmtask DEBUG: value for config item vsphere_pass: srv_tridion_cm DEBUG: value for config item vsphere_insecure: true DEBUG: value for config item proxy_host: DEBUG: value for config item proxy_port: DEBUG: value for config item vsphere_dc: SDL Kiev DEBUG: value for config item folder: Live Content Reach/AutoDeployment DEBUG: value for config item vsphere_dc: SDL Kiev DEBUG: value for config item linked_clone: DEBUG: value for config item resource_pool: DEBUG: value for config item vsphere_dc: SDL Kiev DEBUG: value for config item datastore: DEBUG: value for config item datastorecluster: DEBUG: value for config item customization_vlan: DEBUG: value for config item linked_clone: DEBUG: value for config item datastore: DEBUG: value for config item datastore: DEBUG: value for config item datastorecluster: DEBUG: value for config item thin_provision: DEBUG: value for config item mark_as_template: DEBUG: value for config item annotation: DEBUG: value for config item customization_cpucount: DEBUG: value for config item customization_memory: DEBUG: value for config item customization_vlan: DEBUG: value for config item customization_spec: DEBUG: value for config item customization_dns_ips: DEBUG: value for config item customization_dns_suffixes: DEBUG: value for config item disable_customization: DEBUG: Identified os as windows. C:/Users/Administrator/.chefdk/gem/ruby/2.1.0/gems/knife-vsphere-1.2.3/lib/chef/knife/vsphere_vm_clone.rb:548:in generate_clone_spec': undefined methodidentification' for #RbVmomi::VIM::CustomizationIdentitySettings:0x6d42710 (NoMethod Error) from C:/Users/Administrator/.chefdk/gem/ruby/2.1.0/gems/knife-vsphere-1.2.3/lib/chef/knife/vsphere_vm_clone.rb:310:in run' from C:/opscode/chefdk/embedded/apps/chef/lib/chef/knife.rb:422:inblock in run_with_pretty_exceptions' from C:/opscode/chefdk/embedded/apps/chef/lib/chef/local_mode.rb:39:in with_server_connectivity' from C:/opscode/chefdk/embedded/apps/chef/lib/chef/knife.rb:421:inrun_with_pretty_exceptions' from C:/opscode/chefdk/embedded/apps/chef/lib/chef/knife.rb:214:in run' from C:/opscode/chefdk/embedded/apps/chef/lib/chef/application/knife.rb:142:inrun' from C:/opscode/chefdk/embedded/apps/chef/bin/knife:25:in <top (required)>' from C:/opscode/chefdk/bin/knife:63:inload' from C:/opscode/chefdk/bin/knife:63:in `

'

If i add --cspec param it gives different error C:/Users/Administrator/.chefdk/gem/ruby/2.1.0/gems/knife-vsphere-1.2.3/lib/chef/knife/vsphere_vm_clone.rb:551:in generate_clone_spec': undefined methodautoMode' for nil:NilClass (NoMethodError) from C:/Users/Administrator/.chefdk/gem/ruby/2.1.0/gems/knife-vsphere-1.2.3/lib/chef/knife/vsphere_vm_clone.rb:310:in `run'

swalberg commented 9 years ago

Hi, I was away for a week. I will have a look at these traces once I'm caught up.

swalberg commented 9 years ago

Hi, sorry for the delay. I've replicated the problem here. It looks like the identity settings needs to be set up. There is a lot of data that goes into the customization spec, such as licensing information, that should be pulled from a config file or passed as JSON on the command line.

I need to read up a bit on this but unfortunately am going away for a week starting tomorrow. @mheidenr or @tim95030 may have some thoughts here?

mheidenr commented 9 years ago

@dmitriy-panasiuk please build gem from https://github.com/ezrapagel/knife-vsphere/pull/181 and give it a try

As licenseFilePrintData is required for Sever 2000&2003 only I suppose to let it die slowly

@swalberg this is just an idea and I did not test it

swalberg commented 9 years ago

@mheidenr thanks for the patch, I'll wait to hear how it works. When I tested it, though, that entire identity hash was nil so the block before and after the license assignment was causing error, too.

tim95030 commented 9 years ago

I haven't had time to look into this. The testing I have done and what I do currently is use a windows cspec and no other customization settings so this is definitely a path I have not tried. I will see if I can try some things over the weekend.

jjasghar commented 8 years ago

Please reopen if this is still relevant, and post the new error :metal:.