diff options
author | Alexandru Avadanii <Alexandru.Avadanii@enea.com> | 2018-01-22 16:50:10 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2018-01-22 16:50:10 +0000 |
commit | 52723a26b52a0bd264195996715d8f52ee6c1051 (patch) | |
tree | eddf25d45cb048be69d186330503d3f2ab624088 | |
parent | 2ff40f3189cae452cdb49fc4baf26f5eb94f81be (diff) | |
parent | cd54edf52750b7d770468a31947ec3d5dc385a91 (diff) |
Merge "[PDF] check-jinja: Filter-out incompatible PDF/IA"
-rwxr-xr-x | config/utils/check-jinja2.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/config/utils/check-jinja2.sh b/config/utils/check-jinja2.sh index 960f288b..59a6506b 100755 --- a/config/utils/check-jinja2.sh +++ b/config/utils/check-jinja2.sh @@ -35,11 +35,29 @@ done # shellcheck disable=SC2086 while IFS= read -r lab_config; do SUMMARY+="\n${lab_config#labs/};" + lab_nodes=$(grep -ce 'node:' "${lab_config}") + lab_tmacs=$(grep -ce 'mac_address:' "${lab_config}") + ((lab_amacs=lab_tmacs/lab_nodes)); ((lab_nodes-=1)) echo "###################### ${lab_config} ######################" for adapter in ${INSTALLER_ADAPTERS}; do pdf_inst=0 pdf_inst_pass=0 pdf_yaml_pass=0 + ia_nodes=$(grep -hPo 'nodes\W+\K\d+' -R "${adapter}" | tail -1) + ia_rmacs=$(grep -hPo 'interfaces\W+\K\d+' -R "${adapter}" | sort | tail -1) + ((ia_nodes+=1)); ((ia_rmacs+=1)) + if [[ ${ia_nodes} -gt ${lab_nodes} ]]; then + SUMMARY+='-;' + echo -n "[GENERATE] [SKIP] $(basename "${adapter}") requires at least" + echo -e " ${ia_nodes} nodes, but found only ${lab_nodes}, skipping.\n" + continue + fi + if [[ ${ia_rmacs} -ge ${lab_amacs} ]]; then + SUMMARY+='-;' + echo -n "[GENERATE] [SKIP] $(basename "${adapter}") requires at least" + echo -e " ${ia_rmacs} nics, but found ~ ${lab_amacs}, skipping.\n" + continue + fi while IFS= read -r jinja_template; do pdf_gen_cmd="${GEN_CFG} -y ${lab_config} -j ${jinja_template}" if ${pdf_gen_cmd} > "${TMPF}"; then |