I just wanted to share something I had to figure out on my own.
I have two separate databases that I use within my Vagrant-based development system.
After upgrading to Vagrant 2.2.3 to utilize the built-in triggers function, I had trouble getting both database tables to dump.
Originally I tried this... which did not work and only ran the second run_remote call.
# run some script before the guest is destroyed
config.trigger.before :destroy do |trigger|
trigger.warn = "Preparing to backup the first database before destroying the VM..."
trigger.run_remote = {inline: "bash /usr/local/apache2/sql/dump_db.sh"}
trigger.run_remote = {inline: "bash /usr/local/apache2/sql/dump_db_2.sh"}
end
When that didn't work, I eventually tried this... which worked.
# run some script before the guest is destroyed
config.trigger.before :destroy do |trigger|
trigger.warn = "Preparing to backup the first database before destroying the VM..."
trigger.run_remote = {inline: "bash /usr/local/apache2/sql/dump_db.sh"}
end
# run some script before the guest is destroyed
config.trigger.before :destroy do |trigger|
trigger.warn = "Preparing to backup the second database before destroying the VM..."
trigger.run_remote = {inline: "bash /usr/local/apache2/sql/dump_db_2.sh"}
end
Hope this helps someone down the road.