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.

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
--- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vagrant-up/5f92709f-19ef-425d-9e04-3463f885e592%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to