Skip to content

Commit

Permalink
WordPress.org: fix #153 - cavalcade provisioning failures
Browse files Browse the repository at this point in the history
Refactors cavalcade provisioning to:

 - remove duplication
 - handle when the service fails to restart
 - better handle folder creation
 - avoid potential permission issues for some files
 - prevent parameter expansion on the changed lines that could cause sites with spaces in their folder names to fail
  • Loading branch information
tomjn authored May 26, 2021
1 parent 0faba9b commit e26f9d5
Showing 1 changed file with 26 additions and 21 deletions.
47 changes: 26 additions & 21 deletions wordpressorg.test/provision/vvv-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,30 @@ WP_LOCALES=( ja es_ES )

wme_svn_git_migration $SITE_DIR

function wme_wporg_setup_cavalcade() {
# Cavalcade
printf "Installing Cavalcade..."
wme_noroot git clone https://github.com/humanmade/Cavalcade.git "${SITE_DIR}/wp-content/mu-plugins/cavalcade"
wme_noroot cp -f "${PROVISION_DIR}/cavalcade.php" "${SITE_DIR}/wp-content/mu-plugins/"

if [[ -d "/etc/cavalcade" ]]; then
pushd "/etc/cavalcade"
git pull
popd
else
mkdir -p "/etc/cavalcade"
git clone https://github.com/humanmade/Cavalcade-Runner.git "/etc/cavalcade"
fi

mkdir -p "/etc/init/"
cp -f "${PROVISION_DIR}/cavalcade-wordpressorg.conf" "/etc/init/cavalcade-wordpressorg.conf"
if service cavalcade-wordpressorg restart; then
printf "cavalcade service restarted"
else
printf "cavalcade service did not restart"
fi
}

if [ ! -L $SITE_DIR ]; then
printf "\n#\n# Provisioning $SITE_DOMAIN\n#\n"

Expand Down Expand Up @@ -82,20 +106,7 @@ if [ ! -L $SITE_DIR ]; then
wme_download_pomo "${gplocale}" "meta/o2" "$SITE_DIR/wp-content/languages/themes/o2-${locale}"
done

# Cavalcade
printf "Installing Cavalcade..."
git clone https://github.com/humanmade/Cavalcade.git $SITE_DIR/wp-content/mu-plugins/cavalcade
cp -f $PROVISION_DIR/cavalcade.php $SITE_DIR/wp-content/mu-plugins/

if [[ ! -d "/etc/cavalcade" ]]; then
git clone https://github.com/humanmade/Cavalcade-Runner.git /etc/cavalcade
else
git -C /etc/cavalcade pull
fi

mkdir -p "/etc/init/"
cp -f "$PROVISION_DIR/cavalcade-wordpressorg.conf" "/etc/init/cavalcade-wordpressorg.conf"
service cavalcade-wordpressorg restart
wme_wporg_setup_cavalcade

# Ignore external dependencies and Meta Environment tweaks
IGNORED_FILES=(
Expand Down Expand Up @@ -151,13 +162,7 @@ else
# translate.wordpressorg.test
git -C $SITE_DIR/wp-content/plugins/glotpress pull

# Cavalcade
git -C $SITE_DIR/wp-content/mu-plugins/cavalcade pull
git -C /etc/cavalcade pull
cp -f "$PROVISION_DIR/cavalcade.php" "$SITE_DIR/wp-content/mu-plugins/"
mkdir -p "/etc/init"
cp -f "$PROVISION_DIR/cavalcade-wordpressorg.conf" "/etc/init/cavalcade-wordpressorg.conf"
service cavalcade-wordpressorg restart
wme_wporg_setup_cavalcade
fi

# Pull global header/footer
Expand Down

0 comments on commit e26f9d5

Please sign in to comment.