X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=mcp%2Fscripts%2Flib_template.sh;h=bec8e159e8493ee9bcc93896870783ce50a4c67f;hb=b381277ae274473ae4e05a1aa9dd171dbab461d6;hp=0fbe628b77d58740a594730ca73ace28312fd702;hpb=256e2a50b9b340bb78a8c85fdd7cacf96d0fb637;p=fuel.git diff --git a/mcp/scripts/lib_template.sh b/mcp/scripts/lib_template.sh index 0fbe628b7..bec8e159e 100644 --- a/mcp/scripts/lib_template.sh +++ b/mcp/scripts/lib_template.sh @@ -23,16 +23,14 @@ function do_templates_scenario { local target_lab=$1; shift local target_pod=$1; shift local lab_config_uri=$1; shift - local scenario_dir=$1 + local scenario_dir=$1; shift + local extra_yaml=("$@") BASE_CONFIG_PDF="${lab_config_uri}/labs/${target_lab}/${target_pod}.yaml" BASE_CONFIG_IDF="${lab_config_uri}/labs/${target_lab}/idf-${target_pod}.yaml" LOCAL_PDF="${image_dir}/$(basename "${BASE_CONFIG_PDF}")" LOCAL_IDF="${image_dir}/$(basename "${BASE_CONFIG_IDF}")" - # Make sample PDF/IDF available via default lab-config (pharos submodule) - ln -sf "$(readlink -f "../config/labs/local")" "./pharos/labs/" - # Expand scenario file and main reclass input (pod_config.yaml) based on PDF if ! curl --create-dirs -o "${LOCAL_PDF}" "${BASE_CONFIG_PDF}"; then notify_e "[ERROR] Could not retrieve PDF (Pod Descriptor File)!" @@ -49,10 +47,6 @@ function do_templates_scenario { notify_e "[ERROR] IDF does not match yaml schema!" fi fi - if ! "${PHAROS_GEN_CFG}" -y "${LOCAL_PDF}" \ - -j "${PHAROS_IA}" -v > "${image_dir}/pod_config.yml"; then - notify_e "[ERROR] Could not convert PDF+IDF to reclass model input!" - fi printenv | \ awk '/^(SALT|MCP|MAAS).*=/ { gsub(/=/,": "); print }' >> "${LOCAL_PDF}" j2args=$(find "${scenario_dir}" -name '*.j2' -exec echo -j {} \;) @@ -61,6 +55,14 @@ function do_templates_scenario { -i "$(dirname "$(readlink -f "${PHAROS_IA}")")"; then notify_e '[ERROR] Could not convert j2 scenario definitions!' fi + for _yaml in "${extra_yaml[@]}"; do + awk '/^---$/{f=1;next;}f' "${_yaml}" >> "${LOCAL_PDF}" + done + if ! "${PHAROS_GEN_CFG}" -y "${LOCAL_PDF}" \ + -i "$(dirname "$(readlink -f "${PHAROS_IA}")")" \ + -j "${PHAROS_IA}" -v > "${image_dir}/pod_config.yml"; then + notify_e "[ERROR] Could not convert PDF+IDF to reclass model input!" + fi } # Expand reclass and virsh network templates based on PDF + IDF + others @@ -78,7 +80,8 @@ function do_templates_cluster { awk '/^---$/{f=1;next;}f' "${_yaml}" >> "${LOCAL_PDF}" done # shellcheck disable=SC2046 - j2args=$(find "${RECLASS_CLUSTER_DIR}" "$(readlink -f virsh_net)" $(readlink -f ./*j2) \ + j2args=$(find "${RECLASS_CLUSTER_DIR}" "$(readlink -f virsh_net)" \ + "$(readlink -f docker-compose)" $(readlink -f ./*j2) \ -name '*.j2' -exec echo -j {} \;) # shellcheck disable=SC2086 if ! "${PHAROS_GEN_CFG}" -y "${LOCAL_PDF}" ${j2args} -b -v \