update kitchen-init.sh and run_tests deps.
diff --git a/kitchen-init.sh b/kitchen-init.sh
index 809524e..e1ef27e 100755
--- a/kitchen-init.sh
+++ b/kitchen-init.sh
@@ -28,9 +28,9 @@
###################################
test ! -e .kitchen.yml || {
kitchen init -D kitchen-${driver} -P kitchen-salt --no-create-gemfile
- echo .kitchen >> .gitignore
- echo .bundle >> .gitignore
- echo .vendor >> .gitignore
+ grep '.kitchen' .gitignore || echo .kitchen >> .gitignore
+ grep '.bundle' .gitignore || echo .bundle >> .gitignore
+ grep '.vendor' .gitignore || echo .vendor >> .gitignore
rm -rf test
rm -f .kitchen.yml
rm -f chefignore
@@ -79,16 +79,22 @@
test -e .travis.yml || \
curl -skL "${SOURCE_REPO_URI}/.travis.yml" -o .travis.yml
+# OTHER metadata if formula was not generated by up-to-date cookiecutter-salt-formula
+#####################################################################################
+
+test -e tests/pillar || \
+ mkdir -p tests/pillar
+
+test -e metadata.yml || \
+ curl -skL "${SOURCE_REPO_URI}/metadata.yml" -o metadata.yml
+
+# Always update to letests
+curl -skL "${SOURCE_REPO_URI}/Makefile" -o Makefile
+curl -skL "${SOURCE_REPO_URI}/tests/run_tests.sh" -o tests/run_tests.sh && chmod u+x tests/run_tests.sh
# ADD CHANGES
#############
-echo "**************************************"
-echo "To update to latest test scripts, run:"
-echo "SOURCE_REPO_URI=${SOURCE_REPO_URI}"
-echo 'curl -skL "${SOURCE_REPO_URI}/Makefile" -o Makefile'
-echo 'curl -skL "${SOURCE_REPO_URI}/tests/run_tests.sh" -o tests/run_tests.sh'
-
git add \
.gitignore \
.kitchen.yml \
diff --git "a/\173\173cookiecutter.service_name\175\175/tests/run_tests.sh" "b/\173\173cookiecutter.service_name\175\175/tests/run_tests.sh"
index c496efd..f5bd64c 100755
--- "a/\173\173cookiecutter.service_name\175\175/tests/run_tests.sh"
+++ "b/\173\173cookiecutter.service_name\175\175/tests/run_tests.sh"
@@ -45,6 +45,7 @@
virtualenv $VENV_DIR
source ${VENV_DIR}/bin/activate
pip install salt${PIP_SALT_VERSION}
+ pip install jsonschema
if [[ -f ${CURDIR}/pip_requirements.txt ]]; then
pip install -r ${CURDIR}/pip_requirements.txt
fi
@@ -200,19 +201,22 @@
}
run_model_validate(){
- [[ -d ${SCHEMARDIR} ]] || { log_err "${SCHEMARDIR} not found!"; return 1; }
- # model validator require py modules
- fetch_dependency "salt:https://github.com/salt-formulas/salt-formula-salt"
- link_modules
- # Rendered Example:
- # salt-call --local -c /test1/maas/tests/build/salt --id=maas_cluster modelschema.model_validate maas cluster
- for role in ${SCHEMARDIR}/*.yaml; do
- state_name=$(basename "${role%*.yaml}")
- minion_id="${state_name}"
- # in case debug-reruns, usefull to make cleanup
- [ -n "$DEBUG" ] && { salt_run saltutil.clear_cache; salt_run saltutil.refresh_pillar; salt_run saltutil.sync_all; }
- salt_run -m ${DEPSDIR}/salt-formula-salt --id=${minion_id} modelschema.model_validate ${FORMULA_NAME} ${state_name} || { log_err "Execution of ${FORMULA_NAME}.${state_name} failed"; exit 1 ; }
- done
+ if [ -d ${SCHEMARDIR} ]; then
+ # model validator require py modules
+ fetch_dependency "salt:https://github.com/salt-formulas/salt-formula-salt"
+ link_modules
+ # Rendered Example:
+ # salt-call --local -c /test1/maas/tests/build/salt --id=maas_cluster modelschema.model_validate maas cluster
+ for role in ${SCHEMARDIR}/*.yaml; do
+ state_name=$(basename "${role%*.yaml}")
+ minion_id="${state_name}"
+ # in case debug-reruns, usefull to make cleanup
+ [ -n "$DEBUG" ] && { salt_run saltutil.clear_cache; salt_run saltutil.refresh_pillar; salt_run saltutil.sync_all; }
+ salt_run -m ${DEPSDIR}/salt-formula-salt --id=${minion_id} modelschema.model_validate ${FORMULA_NAME} ${state_name} || { log_err "Execution of ${FORMULA_NAME}.${state_name} failed"; exit 1 ; }
+ done
+ else
+ log_err "${SCHEMARDIR} not found!";
+ fi
}
_atexit() {