jonlives / knife-flip

A knife plugin to quickly move a node between environments
76 stars 7 forks source link

chef provisioning vsphere doesn't work with chefdk 1.2.20 #8

Closed telee2 closed 7 years ago

telee2 commented 7 years ago

I recently updated chefdk to ver 1.2.20. After the upgrade I tried running : chef-client -c C:.chef\knife.rb chef_vsphere\recipe\side-a.rb require 'chef/provisioning/vsphere_driver'

with_chef_server "https://chef-manage.local/organizations/chef/", :client_name => Chef::Config[:node_name], :signing_key_filename => Chef::Config[:client_key], :ssl_verify_mode => :verify_none

local data bags

dbu = data_bag_item('creds', 'username') dbp = data_bag_item('creds', 'password') with_vsphere_driver host: 'vcenter-b.local', insecure: true, :user => dbu["username"], :password => dbp["password"]

with_machine_options :bootstrap_options => { use_linked_clone: false, num_cpus: 2, memory_mb: 4096, network_name: ["Data Monitoring DPortGroup B"], datacenter: 'Datacenter - B', resource_pool: 'Cluster Data - B', datastore: 'Datastore_B2', template_name: 'Chef-Centos-7', template_folder: 'AutoTest', vm_folder: 'AutoTest', additional_disk_size_gb: [50,20], customization_spec: { ipsettings: { dnsServerList: ['192.168.150.11', '192.168.150.12'] }, :domain => 'dev.local' }, :ssh => { :user => 'vagrant', :password => 'vagrant', :paranoid => false, :port => 22 }, :options => { :prefix => 'sudo', :ssh_pty_enable => true },

:convergence_options => {
  :ssl_verify_mode => :verify_none,
  :verify_api_cert => false,
  :validator => "chef-validator",
  :chef_server => "https://chef-manage.local/organizations/chef/",
  :ignore_failure => true,
  #:install_sh_url => "http://yum.local/chef/chef_bootstrap.sh",
  #:install_sh_arguments => "-P chef-dk"

}

},

:sudo => true num_servers = 5 machine_batch do 1.upto(num_servers) do |i| machine "chef-Vsphere-#{i}" do

   files '/etc/chef/trusted_certs/chef-manage_local.crt' => 'C:\Users\tlee\chef-repo\.chef\trusted_certs\chef-manage_local.crt',
         '/etc/chef/trusted_certs/CA.crt' => 'C:\Users\tlee\chef-repo\.chef/trusted_certs\CA.crt',
         '/etc/chef/trusted_certs/Intermediate_CA.crt' => 'C:\Users\tlee\chef-repo\.chef\trusted_certs\Intermediate_CA.crt'
   action :converge
   run_list ['set_env::default', 'lvm::default']
 end

end end

C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/cheffish-4.1.0/lib/cheffish/merged_config.rb:6: warning: toplevel constant Mash referenced by Chef::Mash [2017-03-03T12:38:13-05:00] WARN: Resource.dsl_name is deprecated and will be removed in Chef 13. Use resource_name instead. (CHEF-5)C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-p rovisioning-2.1.0/lib/chef/resource/machine_batch.rb:53:in to_text'. Please see https://docs.chef.io/deprecations_custom_resource_cleanups.html for further details and information on how to correct this problem. at C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0 /gems/chef-12.18.31-universal-mingw32/lib/chef/event_dispatch/dispatcher.rb:43:incall'

================================================================================ Error executing action converge on resource 'machine_batch[default]'

ArgumentError

wrong number of arguments (given 0, expected 1..2)

Resource Declaration:

In C:/Users/tlee/chef-repo/cookbooks/chef_vsphere/recipes/side-b.rb

72: machine_batch do 73: 1.upto(num_servers) do |i| 74: machine "chef-Vsphere-#{i}" do 75: 76: files '/etc/chef/trusted_certs/chef-manage_local.crt' => 'C:\Users\tlee\chef-repo.chef\trusted_certs\chef-manage_local.crt', 77: '/etc/chef/trusted_certs/CA.crt' => 'C:\Users\tlee\chef-repo.chef/trusted_certs\CA.crt', 78: '/etc/chef/trusted_certs/Intermediate_CA.crt' => 'C:\Users\tlee\chef-repo.chef\trusted_certs\Intermediate_CA.crt' 79: action :converge 80: run_list ['set_env::default', 'lvm::default'] 81: end 82: end 83: end

Compiled Resource:

Declared in C:/Users/tlee/chef-repo/cookbooks/chef_vsphere/recipes/side-b.rb:72:in `from_file'

machine_batch("default") do action [:converge] retries 0 retry_delay 2 default_guard_interpreter :default driver "vsphere://vcenter-b.local/sdk?use_ssl=true&insecure=true" chef_server {:chef_server_url=>"https://chef-manage.local/organizations/chef/", :options=>{:client_name=>"tlee", :signing_key_filename=>"C:/Users/tlee/chef-repo/.chef/tlee.pem", :ss l_verify_mode=>:verify_none, :api_version=>"0"}} machine_options {:bootstrap_options=>{:use_linked_clone=>false, :num_cpus=>2, :memory_mb=>4096, :networkname=>["Data Monitoring DPortGroup B"], :datacenter=>"Datacenter - B", :resource pool=>"Cluster Data - B", :datastore=>"Datastore_B2", :template_name=>"Chef-Centos-7", :template_folder=>"AutoTest", :vm_folder=>"AutoTest", :additional_disk_sizegb=>[50, 20], :customization spec=>{:ipsettings=>{:dnsServerList=>["192.168.150.11", "192.168.150.12"]}, :domain=>"dev.local"}, :ssh=>{:user=>"vagrant", :password=>"vagrant", :paranoid=>false, :port=>22}, :options=>{:pref ix=>"sudo", :ssh_pty_enable=>true}, :convergence_options=>{:ssl_verify_mode=>:verify_none, :verify_api_cert=>false, :validator=>"chef-validator", :chef_server=>"https://chef-manage.local/ organizations/chef/", :ignore_failure=>true}}, :sudo=>true} declared_type :machine_batch cookbook_name "@recipe_files" recipe_name "C:/Users/tlee/chef-repo/cookbooks/chef_vsphere/recipes/side-b.rb" machines ["chef-Vsphere-1", "chef-Vsphere-2", "chef-Vsphere-3", "chef-Vsphere-4", "chef-Vsphere-5"] end

Platform:

i386-mingw32

[2017-03-03T12:38:13-05:00] WARN: Resource.dsl_name is deprecated and will be removed in Chef 13. Use resource_name instead. (CHEF-5)C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/ch ef-provisioning-2.1.0/lib/chef/resource/machine_batch.rb:53:in to_text'. Please see https://docs.chef.io/deprecations_custom_resource_cleanups.html for further details and information on how to correct this problem. at C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0 /gems/chef-12.18.31-universal-mingw32/lib/chef/event_dispatch/dispatcher.rb:43:incall' [2017-03-03T12:38:13-05:00] WARN: Resource.dsl_name is deprecated and will be removed in Chef 13. Use resource_name instead. (CHEF-5)C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-p rovisioning-2.1.0/lib/chef/resource/machine_batch.rb:53:in to_text'. Please see https://docs.chef.io/deprecations_custom_resource_cleanups.html for further details and information on how to correct this problem. at C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0 /gems/chef-12.18.31-universal-mingw32/lib/chef/event_dispatch/dispatcher.rb:43:incall' [2017-03-03T12:38:13-05:00] INFO: Running queued delayed notifications before re-raising exception [2017-03-03T12:38:13-05:00] DEBUG: Re-raising exception: Chef::Exceptions::CookbookNotFound - Cookbook @recipe_files not found. If you're loading @recipe_files from another cookbook, make sure you configure the dependency in your metadata C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31-universal-mingw32/lib/chef/cookbook/cookbook_collection.rb:39:in block in initialize' C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/ohai-8.23.0/lib/ohai/mash.rb:77:indefault' C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/ohai-8.23.0/lib/ohai/mash.rb:77:in default' C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31-universal-mingw32/lib/chef/resource.rb:1456:in[]' C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31-universal-mingw32/lib/chef/resource.rb:1456:in cookbook_version' C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31-universal-mingw32/lib/chef/data_collector/resource_report.rb:82:into_hash' C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31-universal-mingw32/lib/chef/data_collector.rb:391:in add_resource_report' C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31-universal-mingw32/lib/chef/data_collector.rb:459:inblock in detect_unprocessed_resources' C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31-universal-mingw32/lib/chef/data_collector.rb:456:in each' C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31-universal-mingw32/lib/chef/data_collector.rb:456:indetect_unprocessed_resources' C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31-universal-mingw32/lib/chef/data_collector.rb:167:in converge_failed' C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31-universal-mingw32/lib/chef/event_dispatch/dispatcher.rb:43:incall' C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31-universal-mingw32/lib/chef/event_dispatch/dispatcher.rb:43:in block in call_subscribers' C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31-universal-mingw32/lib/chef/event_dispatch/dispatcher.rb:34:ineach' C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31-universal-mingw32/lib/chef/event_dispatch/dispatcher.rb:34:in call_subscribers' (eval):2:inconverge_failed' C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31-universal-mingw32/lib/chef/client.rb:673:in rescue in block in converge' C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31-universal-mingw32/lib/chef/client.rb:666:inblock in converge' C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31-universal-mingw32/lib/chef/client.rb:665:in catch' C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31-universal-mingw32/lib/chef/client.rb:665:inconverge' C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31-universal-mingw32/lib/chef/client.rb:704:in converge_and_save' C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31-universal-mingw32/lib/chef/client.rb:284:inrun' C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31-universal-mingw32/lib/chef/application.rb:277:in run_with_graceful_exit_option' C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31-universal-mingw32/lib/chef/application.rb:253:inblock in run_chef_client' C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31-universal-mingw32/lib/chef/local_mode.rb:44:in with_server_connectivity' C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31-universal-mingw32/lib/chef/application.rb:236:inrun_chef_client' C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31-universal-mingw32/lib/chef/application/client.rb:464:in sleep_then_run_chef_client' C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31-universal-mingw32/lib/chef/application/client.rb:451:inblock in interval_run_chef_client' C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31-universal-mingw32/lib/chef/application/client.rb:450:in loop' C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31-universal-mingw32/lib/chef/application/client.rb:450:ininterval_run_chef_client' C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31-universal-mingw32/lib/chef/application/client.rb:434:in run_application' C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31-universal-mingw32/lib/chef/application.rb:59:inrun' C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31-universal-mingw32/bin/chef-client:26:in <top (required)>' C:/opscode/chefdk/modules/chef/../../bin/chef-client:68:inload' C:/opscode/chefdk/modules/chef/../../bin/chef-client:68:in `

' [2017-03-03T12:38:13-05:00] ERROR: Running exception handlers [2017-03-03T12:38:13-05:00] ERROR: Exception handlers complete [2017-03-03T12:38:13-05:00] FATAL: Chef::Exceptions::CookbookNotFound: Cookbook @recipe_files not found. If you're loading @recipe_files from another cookbook, make sure you configure the depe ndency in your metadata