GetValkyrie / valkyrie

Valkyrie is an opinionated local dev stack that makes features/git based Drupal development easy.
http://www.getvalkyrie.com
GNU General Public License v3.0
45 stars 11 forks source link

Ensure only one Valkyrie VM is running at a time #46

Open ergonlogic opened 9 years ago

ergonlogic commented 9 years ago

We hard-code the IP address, among other things, so these kind of collisions will cause all kinds of hard-to-diagnose issues.

ergonlogic commented 9 years ago

vagrant global-status provides us everything we need:

id       name     provider   state    directory                                                                   
------------------------------------------------------------------------------------------------------------------                  
e176eb1  valkyrie virtualbox poweroff /home/ergonlogic/vagrant/projects/13                                        
0bed096  valkyrie virtualbox poweroff /home/ergonlogic/vagrant/projects/15                                        
2892219  valkyrie virtualbox running  /home/ergonlogic/vagrant/projects/rel0    

Unfortunately, it doesn't yet implement the --machine-readable option: https://github.com/mitchellh/vagrant/issues/4097

Still, it should be pretty easy to parse that, and loop over running VMs named 'valkyrie'.

ergonlogic commented 9 years ago

This should probably happen in a pre-up hook.

ergonlogic commented 9 years ago

Marking as postponed. We could work on that upstream issue, if we really want to push this forward.