fuel-plugin-nsxv/pre_build_hook

32 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# Add here any the actions which are required before plugin build
# like packages building, packages downloading from mirrors and so on.
# The script should return 0 if there were no errors.
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/
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
rm -fr $(find "${PLUGIN_MOD_DIR:?}" -name '.git' )
mv "$PLUGIN_MOD_DIR"/* "$(dirname $PLUGIN_MOD_DIR)"
# Download puppet modules that are in fuel-library/
TARBALL_VERSION='5a6ac37'
REPO_PATH="https://github.com/openstack/fuel-library/tarball/${TARBALL_VERSION}"
wget -qO- "$REPO_PATH" | tar -C "$PLUGIN_MOD_DIR" --strip-components=3 -zxvf - "openstack-fuel-library-${TARBALL_VERSION}/deployment/puppet/"
mv "$PLUGIN_MOD_DIR"/osnailyfacter/lib/puppet/parser/functions/get_ssl_property.rb "$(dirname $PLUGIN_MOD_DIR)"/nsxv/lib/puppet/parser/functions
mv "$PLUGIN_MOD_DIR"/l23network "$(dirname $PLUGIN_MOD_DIR)"
mv "$PLUGIN_MOD_DIR"/openstack "$(dirname $PLUGIN_MOD_DIR)"
# clean
rm -fr "$PLUGIN_MOD_DIR"