Add environment check to collection linking script
This commit is contained in:
parent
9cd0cfcb4f
commit
7bb00a3586
8
Makefile
8
Makefile
@ -2,7 +2,7 @@ clean:
|
|||||||
rm --recursive --force .ansible/
|
rm --recursive --force .ansible/
|
||||||
|
|
||||||
dev:
|
dev:
|
||||||
poetry install --remove-untracked
|
@poetry install --remove-untracked
|
||||||
poetry run pre-commit install
|
@poetry run pre-commit install
|
||||||
poetry run ansible-galaxy collection install --requirements-file ./requirements.yaml --collections-path ./.ansible
|
@poetry run ansible-galaxy collection install --requirements-file ./requirements.yaml --collections-path ./.ansible
|
||||||
./dynamically-link-local-collections.bash
|
@bash ./link-local-collections.sh
|
||||||
|
@ -15,4 +15,14 @@ for collection_path in "$PWD"/"$ANSIBLE_NAMESPACE"/*; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Done!"
|
echo "Finished linking local collections"
|
||||||
|
|
||||||
|
LOCAL_COLLECTION_PATH=$(dirname "$ANSIBLE_COLLECTION_DIR")
|
||||||
|
|
||||||
|
if [ -z ${ANSIBLE_COLLECTIONS_PATH+x} ]; then
|
||||||
|
echo "WARNING: Environment variable ANSIBLE_COLLECTIONS_PATH is not set, collections will not be callable"
|
||||||
|
echo " HINT: export ANSIBLE_COLLECTIONS_PATH=$LOCAL_COLLECTION_PATH"
|
||||||
|
elif [[ ${ANSIBLE_COLLECTIONS_PATH} != *"$LOCAL_COLLECTION_PATH"* ]]; then
|
||||||
|
echo "WARNING: Environment variable ANSIBLE_COLLECTIONS_PATH does not include local collection directory"
|
||||||
|
echo " HINT: export ANSIBLE_COLLECTIONS_PATH=\$ANSIBLE_COLLECTIONS_PATH:$LOCAL_COLLECTION_PATH"
|
||||||
|
fi
|
Reference in New Issue
Block a user