1

Setting up a Linux-based Vagrant box and configuration, I am looking at the following problem:

During provision stage, I am installing Subversion. I would like, also during the provision stage, to edit the ~/.subversion/servers file so that it gets necessary proxy settings.

I know how to do that (using sed), however there is one catch.

~/.subversion does not exist at this point.

The directory ~/.subversion is not actually created until you first call svn info, svn status or whatever.

So I added to my Vagrantfile...

config.vm.provision "shell", inline: "svn info 2>/dev/null"

...and the command does get executed (with error, since of course there is no working directory to call info on)...

==> default: Running provisioner: shell...
    default: Running: inline script
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

...but there still is no ~/subversion.

I don't quite understand why svn info, which does the trick (of setting up ~/.subversion) works fine when I am logged in to the virtual machine (via vagrant ssh), but fails when executed during provisioning as displayed above.

How can I initialize ~/.subversion during Vagrant provisioning stage (without actually accessing a real repo)?

1 Answer 1

0

config.vm.provision "shell", inline: "svn info 2>/dev/null"

This line is run as user root.

Consequently, it does not set up ~vagrant/.subversion, but /root/.subversion.

The solution is to run the line as user vagrant:

config.vm.provision "shell", inline: "svn info 2>/dev/null", privileged: false

Even better, run the command "svn info 2>/dev/null; true" -- this gets rid of Vagrant reporting that a provisioning command returned with non-zero exit status.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .