Stealth Rabbi
Stealth Rabbi

Reputation: 10346

setting up a synced folder that may not exist

In my vagrantfile, I've set up a synced folder, such as

node_config.vm.synced_folder "../.", "/proj_root"

This works fine. I'd like to add other synced foldrs where the source directory may not exist on the host machine. When vagrant runs, it reports that it can't find the source directory

There are errors in the configuration of this machine. Please fix
the following errors and try again:

vm:
* The host path of the shared folder is missing: ../../test_no_such_dir

I understand the error, however, I'm looking for a way to optionally set up the synced_folder. Perhaps I can just run mkdir on the directories to create them if they don't exist, but I'm not sure if I can run arbitrary commands in the vagrantfile.

Upvotes: 2

Views: 391

Answers (1)

Stealth Rabbi
Stealth Rabbi

Reputation: 10346

There are optional args that I can use. One of them is create which creates the source directory if it doesn't exist.

node_config.vm.synced_folder "../../test_no_such", "/test_no_such", create:true

Upvotes: 2

Related Questions