vccw-team / vccw

A Vagrant based development environment.
http://vccw.cc/
MIT License
1.02k stars 181 forks source link

provision-post.sh not running #121

Closed raulillana closed 8 years ago

raulillana commented 8 years ago

Howdy!

When my Chef provision ends, the provision-post.sh should be called, but it's not.

Output:

==> whatever: Running handlers:
==> whatever: [2016-06-19T01:35:15+00:00] INFO: Running report handlers
==> whatever: Running handlers complete
==> whatever: [2016-06-19T01:35:15+00:00] INFO: Report handlers complete
==> whatever: Chef Client finished, 18/223 resources updated in 308.438156891 seconds

My provision-post.sh:

#!/usr/bin/env bash

set -ex

# Automatic Remote Import
# uncheck on Movefile ready
vagrant ssh -c "cd /vagrant && wordmove pull -e live --all"

# Automatic Replacement of DB strings
# --test-run # optional flag for testing
# --skip-columns=guid # WP Codex recommends to not change the GUID.
# wp search-replace old-site.com new-site.dev --skip-columns=guid

# Remove crap (sorry Matt)
vagrant ssh -c "wp plugin uninstall hello"
vagrant ssh -c "wp plugin uninstall akismet"
vagrant ssh -c "wp theme uninstall twentyfourteen"
vagrant ssh -c "wp theme uninstall twentyfifteen"

# Install Child Theme Boilerplate _child
# cd /vagrant/www/wpm/wp-content/themes/
# git clone https://github.com/ahmadawais/_child.git

# Import last DB backup
if [ ! -f /vagrant/backup/wordpress.sql ]
then
    echo "No DB backup to import!"
else
    echo "Importing last DB backup..."
    vagrant ssh -c "wp db import /vagrant/backup/wordpress.sql"
fi

# Import last WP-content backup
if [ ! -d /vagrant/backup/wp-content ]
then
    echo "No WP-content backup to import!"
else
    echo "Importing last WP-content backup..."
    cp -Ru vagrant ssh -c "/vagrant/backup/wp-content /vagrant/www/wordpress/wp-content"
fi
exit

BTW my exportdb.sh and exportwp.sh scripts are working fine via run_remote and vagrant-triggers.

config.trigger.before :halt do
    info "Dumping DB before shutting down..."
    run_remote  "bash /vagrant/provision/exportdb.sh"
    run_remote  "bash /vagrant/provision/exportwp.sh"
  end

Any tips welcome... :_)

PS: Great work on this tool guys, really. 👍

raulillana commented 8 years ago

I forgot that seems like provision-pre.sh isn't running also. Mine is empty so i can't really tell.

==> whatever: [vagrant-hostsupdater] Checking for host entries
==> whatever: [vagrant-hostsupdater]   found entry for: 192.168.255.10 whatever.com
==> whatever: Running provisioner: chef_solo...
==> whatever: Detected Chef (latest) is already installed
==> whatever: Generating chef JSON and uploading...
==> whatever: Running chef-solo...
raulillana commented 8 years ago

Ok i figured it out. It was a directory problem. I feel dumb, sorry. ^^'

  if File.exists?(File.join(File.dirname(__FILE__), 'provision/provision-pre.sh')) then
    config.vm.provision :shell, :path => File.join( File.dirname(__FILE__), 'provision/provision-pre.sh' )
  end