summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>2018-01-15 01:33:02 +0100
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>2018-01-16 00:31:36 +0100
commitcd54edf52750b7d770468a31947ec3d5dc385a91 (patch)
tree09454602f431600caf6a1280730b0432373292ae
parent6233ce9048958f19f31ac07f9c88309591590b7f (diff)
[PDF] check-jinja: Filter-out incompatible PDF/IA
While checking all PDFs against all installers, some mandatory requirements are sometimes not met: - minimum cluster nodes (e.g. Apex requires 5 nodes, 1 PDF has 3); - minimum interface count (e.g. Compass requires min 3 NICs, some PDFs only have two interfaces or less); The added filter is far from ideal: - node requirements are based on the latest (not highest) index used by the installer adapter to accomodate special handling of 3-node cluster in Daisy templates; - interface req is based on the average interfaces/node, with quite some margin - this is a very loose mechanism; With this in, `check-jinja` has a return code of 0 (note that yamllint failures of output files are not affecting the return code). Change-Id: I43ade3567bf3026069ff93eca17abc212fab211c Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
-rwxr-xr-xconfig/utils/check-jinja2.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/config/utils/check-jinja2.sh b/config/utils/check-jinja2.sh
index 3c5e5163..1001b156 100755
--- a/config/utils/check-jinja2.sh
+++ b/config/utils/check-jinja2.sh
@@ -27,11 +27,29 @@ done
# Iterate all PDFs, check with each installer adapter, log results
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