Vagrant vsphere - неопределенный метод `[]'для nil:NilClass

Это действительно странный гейзенбаг. Иногда при звонке vagrant upЯ получаю что-то вроде этого:

Bringing machine 'default' up with 'vsphere' provider...
==> default: Calling vSphere CloneVM with the following settings:
==> default:  -- Template VM: COLUMBIA/vm/DirectChannel/vagrantchefnode
==> default:  -- Target VM: COLUMBIA/vm/DirectChannel/dirchantsrv1
==> default: Waiting for SSH to become available...
undefined method `[]' for nil:NilClass

(Я точно забыла, как выглядит последняя строка, я пытаюсь воссоздать ее из журнала, который был запущен с тегом --debug.)

Однажды после того, как я настроил Vagrant-файлы, он сделал это в первый раз, а затем после vagrant destroy, прошел прямо мимо него без проблем. В какой-то момент я делал это каждый раз, поэтому я отправил выходные данные отладки в файл журнала. Затем я отредактировал Vagrantfile, и он остановился. Затем я отредактировал файл Vagrant, вернув его в прежнее состояние, и это все равно больше не повторилось. Мне нужно знать, что вызывает это, чтобы я мог убедиться, что это больше не повторится.

Вот строки из файла журнала, которые включают "ноль":

DEBUG command:  -- options: {:provider=>nil}
 INFO batch_action: Starting action: #<Vagrant::Machine:0x000000018bb658> up {:destroy_on_error=>true, :parallel=>true, :provision_ignore_sentinel=>false, :provision_types=>nil}
 INFO machine: New machine ID: nil
ERROR warden: Error occurred: undefined method `[]' for nil:NilClass
ERROR warden: Error occurred: undefined method `[]' for nil:NilClass
ERROR warden: Error occurred: undefined method `[]' for nil:NilClass
ERROR warden: Error occurred: undefined method `[]' for nil:NilClass
ERROR vagrant: #<VagrantPlugins::VSphere::Errors::VSphereError: undefined method `[]' for nil:NilClass>
ERROR vagrant: undefined method `[]' for nil:NilClass
 INFO interface: error: undefined method `[]' for nil:NilClass
undefined method `[]' for nil:NilClass
 INFO interface: Machine: error-exit ["VagrantPlugins::VSphere::Errors::VSphereError", "undefined method `[]' for nil:NilClass"]

А вот и Vagrantfiles:

1) Vagrantfile, упакованный с коробкой:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.provider :vsphere do |vsphere|
    vsphere.host = 'vsphereserver.myorg.com'
    vsphere.compute_resource_name = 'TestDev'
    vsphere.user = 'vagrantadmin'
    vsphere.password = 'password'
    vsphere.insecure = true
  end

  config.ssh.username = 'auto'
  config.ssh.private_key_path = '~/.vagrant.d/id_rsa'
end

2) Файл Vagrant в моем домашнем каталоге (~ /.vagrant.d):

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = 'vsphere'

  config.vm.provider :vsphere do |vsphere|
    vsphere.template_name = 'vagrantchefnode'
  end

  config.vm.provision "chef_client", id: "chef" do |chef|
    chef.provisioning_path = "/etc/chef"
    chef.chef_server_url = "https://chefserver.myorg.com"
    chef.validation_key_path = "/home/user/.vagrant.d/chef/validation.pem"
#    chef.client_key_path = "/etc/chef/client.pem"
    chef.validation_client_name = "chef-validator"
    chef.custom_config_path = "/home/user/.vagrant.d/Vagrantfile.chef"
    chef.delete_node = true
    chef.delete_client = true
    chef.add_role "base"
  end
end

3) Vagrantfile из каталога проекта (~/.vagrant.d/boxes/chefnode1):

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|

  config.vm.provider :vsphere do |vsphere|
#    vsphere.template_name = 'chefnode'
    vsphere.customization_spec_name = 'test2'
    vsphere.name = 'test2'
  end

  config.vm.provision "chef_client", id: "chef" do |chef|
    chef.node_name = "test2"
    chef.add_role "dev"
  end
end

Мне кажется, что что-то не так на стороне VMware, но у меня нет полного доступа на хосте VMware. Есть идеи?

0 ответов

Другие вопросы по тегам