We use Jenkins to spin test Chef deployments of our apps every night.
Whilst troubleshooting some problems, I manually run vagrant provision --provider=aws, but soon cancelled it as I didn't need it. After which, I neglected to run vagrant destroy.
After trying to run the Jenkins job again, I got the following error:
An action 'up' was attempted on the machine 'default',
but another process is already executing an action on the machine.
Vagrant locks each machine for access by only one process at a time.
Please wait until the other Vagrant process finishes modifying this
machine, then try again.
When running vagrant global-status I got:
id name provider state directory
--------------------------------------------------------------------------------------------------------------------------------
0d2d2c5 default aws preparing /mnt/disk2/blah
However running vagrant destroy 0d2d2c5 yielded:
jenkins@ip-10-80-53-172:~/jobs/blah$ vagrant destroy 0d2d2c5
default: Are you sure you want to destroy the 'default' VM? [y/N] y
==> default: Instance is not created. Please run `vagrant up` first.
And the only way to rectify this was removing the entry from ~/.vagrant.d/data/machine-index/index
{"version":1,"machines":{"0d2d2c5639084324be38704e3af1fe50":{"local_data_path":"/mnt/disk2/blah/.vagrant","name":"default","provider":"aws","state":"preparing","vagrantfile_name":null,"vagrantfile_path":"/mnt/disk2/blah","updated_at":null,"extra_data":{"box":{"name":"ubuntu/trusty64","provider":"aws","version":"20151218.0.0"}}}}}
Admittedly this is a 'self inflictred' issue as I forgot to destroy the VM, but I wonder if there needs to be a way of synchronizing the VMs that vagrant knows about against what is actually running?
Cheers
Hi @swordeh
As mentioned in the documentation, global-status is a cache of all the machines, not a real-time solution: https://docs.vagrantup.com/v2/cli/global-status.html
You can clear the cache with the --prune option.
Does that answer your question?
Hey @sethvargo
Absolutely, that's what I was looking for. Sorry for the false report!
Thank you.
Most helpful comment
Hi @swordeh
As mentioned in the documentation, global-status is a cache of all the machines, not a real-time solution: https://docs.vagrantup.com/v2/cli/global-status.html
You can clear the cache with the
--pruneoption.Does that answer your question?