Parallels / vagrant-parallels

Vagrant Parallels Provider

Home Page:https://parallels.github.io/vagrant-parallels

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parallels plugin crashed on `vagrant destroy` with non-existent Machines

stephenreay opened this issue · comments

When vagrant destroy is invoked when a configured machine doesn't exist on disk, the Parallels plugin crashes.

I've tested this with single-machine and multi-machine Vagrantfiles, on both Intel and Arm, the result is the same.

/Volumes/Work/Vagrant/gems/3.1.4/gems/vagrant-parallels-2.4.0/lib/vagrant-parallels/util/common.rb:9:in `is_macvm': undefined method `directory' for nil:NilClass (NoMethodError)

          return !!Dir.glob(machine.box.directory.join('*.macvm')).first
                                       ^^^^^^^^^^
	from /Volumes/Work/Vagrant/gems/3.1.4/gems/vagrant-parallels-2.4.0/lib/vagrant-parallels/synced_folder.rb:10:in `usable?'
	from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/action/builtin/mixin_synced_folders.rb:41:in `block in default_synced_folder_type'
	from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/action/builtin/mixin_synced_folders.rb:40:in `each'
	from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/action/builtin/mixin_synced_folders.rb:40:in `default_synced_folder_type'
	from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/action/builtin/mixin_synced_folders.rb:170:in `synced_folders'
	from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/machine.rb:633:in `synced_folders'
	from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/plugins/kernel_v2/config/vm.rb:745:in `validate'
	from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/config/v2/root.rb:72:in `block in validate'
	from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/config/v2/root.rb:67:in `each'
	from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/config/v2/root.rb:67:in `validate'
	from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/action/builtin/config_validate.rb:15:in `call'
	from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/action/warden.rb:48:in `call'
	from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/action/builder.rb:180:in `call'
	from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/action/runner.rb:101:in `block in run'
	from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/util/busy.rb:19:in `busy'
	from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/action/runner.rb:101:in `run'
	from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/machine.rb:248:in `action_raw'
	from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/machine.rb:217:in `block in action'
	from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/environment.rb:631:in `lock'
	from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/machine.rb:203:in `call'
	from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/machine.rb:203:in `action'
	from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/batch_action.rb:86:in `block (2 levels) in run'

to reproduce:

mkdir foo
cd foo
vagrant init
vagrant destroy
🤯