emyl / vagrant-triggers

Allow the definition of arbitrary scripts that will run on the host before and/or after Vagrant commands.
MIT License
546 stars 35 forks source link

Cannot mount network share after "up" #27

Closed mbrodala closed 9 years ago

mbrodala commented 9 years ago

I have added a trigger like this:

config.trigger.after :up do
  run "net use Z: \\\\192.168.33.10\\webroot"
end

This fails however:

System error 67 has occurred The network name cannot be found

If I run the command manually from command line after starting the machine, the mount drive is added perfectly fine however.

Any ideas? I already tried sleeping to no avail.

mbrodala commented 9 years ago

Just found a solution by adding even more escaping:

config.trigger.after :up do
  run "net use Z: \\\\\\\\192.168.33.10\\\\webroot"
end

Thus it seems like one needs to do escaping once for the Ruby interpreter and once more for command passthrough. Could this be changed to pass through the command as is without evaluating backslashes?

The initial version seems to end up as net use Z: \192.168.33.10webroot, at least that's what I get when printing it in an irb. I also (obviously) get the error message above if I try this share path on command line.

mbrodala commented 9 years ago

Thanks for fixing this. :+1: