diff --git a/pre_build_hook b/pre_build_hook index d19c008..b78e914 100755 --- a/pre_build_hook +++ b/pre_build_hook @@ -7,9 +7,10 @@ set -eux ROOT="$(dirname $(readlink -f $0))" PLUGIN_MOD_DIR="$ROOT/deployment_scripts/puppet/modules/upstream" +NAME=$(sed -rn 's/^name:\s*(.*)/\1/p' "$ROOT"/metadata.yaml) # Download upstream puppet modules that are not in fuel-library/ -"$ROOT"/remove_modules.sh +find "$ROOT/deployment_scripts/puppet/modules" -maxdepth 1 -mindepth 1 -type d ! -name $NAME -prune -exec rm -fr {} \; "$ROOT"/update_modules.sh -d "$PLUGIN_MOD_DIR" # Remove .git directory diff --git a/remove_modules.sh b/remove_modules.sh deleted file mode 100755 index 197975b..0000000 --- a/remove_modules.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -e -# remove all external puppet modules - -PLUGIN_MOD_DIR="deployment_scripts/puppet/modules" - -dir=$(dirname $0) -cd "${dir}" || exit 1 - -grep "^mod '" Puppetfile| awk -F "'" '{ print $2 }' | while read module; do - if [ -d "${PLUGIN_MOD_DIR}/${module}" ]; then - echo "Remove: ${PLUGIN_MOD_DIR}/${module}" - rm -rf "${PLUGIN_MOD_DIR:?}/${module}" - fi -done -rm -f 'Puppetfile.lock'