I'm trying to tweak my Vagrantfile so it automatically creates a folder in the project root if it's missing. Creating the folder is no problem, but I'm having trouble finding out where to create that folder.
I was able to figure out that this information is available on a Vagrant::Environment
object as cwd
, but I can't figure out how to get the current instance from inside my Vagrantfile. The documentation for Vagrant seems to be a bit sparse.
Edit:
My question is not about how to use Puppet. I'm writing some code inside the Vagrantfile. I want to know how to get the current instance of Vagrant::Environment
.
To find the Vagrantfile directory try this in the Vagrantfile:
vagrant_root = File.dirname(__FILE__)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With