diff --git a/natmd-test-common/overlay/opt/mdqp/post.d/40-create-transitive b/natmd-test-common/overlay/opt/mdqp/post.d/40-create-transitive index ec531904..2c36ee07 100755 --- a/natmd-test-common/overlay/opt/mdqp/post.d/40-create-transitive +++ b/natmd-test-common/overlay/opt/mdqp/post.d/40-create-transitive @@ -32,10 +32,20 @@ for expression in "role-sp" "role-idp" "index.html"; do esac curl ${base_url}/${url} -o "${tmpfile}" - if ! grep -q entityID "${tmpfile}" ; then - echo "No entityID found in file for ${expression}" - exit 1 - fi + + case $file in + *.json) + jq -e .[].entityID "${tmpfile}" 1> /dev/null + ;; + *.xml|*.html) + xmlstarlet sel -t -v "//md:EntityDescriptor/@entityID" -n -m "//*[local-name()='EntityDescriptor']" -v "@entityID" -n "${tmpfile}" 1>/dev/null + ;; + *) + echo "Unsupported file type (${file}))" + exit 1 + ;; + esac + full_path=${base_dir}${file} mkdir -p "$(dirname ${full_path})" mv "${tmpfile}" "${full_path}"