I'm trying to grab the DB_USER and DB_PASSWORD fields from a wp-config.php
file during provisioning. I cannot get this information out during
provisioning. Below is the Vagrantfile stripped down to almost nothing
using awk. The following sed command has also been tried as a replacement
for the awk command.
sed -n "/^ *define( *'DB_USER', *'\([^']*\)'.*/ {s//\1/p;q;}" /var/www/html/
wp-config.php
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.synced_folder ".", "/var/www"
config.vm.provision "shell", inline: <<-SHELL
ls -l /var/www/html/wp-config.php
awk -F '\'' '/DB_USER/ {print $2}' /var/www/html/wp-config.php
SHELL
end
Both commands work when run from the VM after it is up. However, I get
errors like the following when trying to run them during provisioning.
==> default: /tmp/vagrant-shell: line 2: unexpected EOF while looking for
matching `''
==> default: /tmp/vagrant-shell: line 3: syntax error: unexpected end of
file
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.
The file is located at the path specified in the synced folder.
Any ideas on what I need to do to get this working?
--
You received this message because you are subscribed to the Google Groups
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.