Improve error handling
This commit is contained in:
parent
5dacc8fb5d
commit
f5f67a1073
1 changed files with 14 additions and 4 deletions
|
@ -32,10 +32,20 @@ for expression in "role-sp" "role-idp" "index.html"; do
|
||||||
esac
|
esac
|
||||||
|
|
||||||
curl ${base_url}/${url} -o "${tmpfile}"
|
curl ${base_url}/${url} -o "${tmpfile}"
|
||||||
if ! grep -q entityID "${tmpfile}" ; then
|
|
||||||
echo "No entityID found in file for ${expression}"
|
case $file in
|
||||||
exit 1
|
*.json)
|
||||||
fi
|
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}
|
full_path=${base_dir}${file}
|
||||||
mkdir -p "$(dirname ${full_path})"
|
mkdir -p "$(dirname ${full_path})"
|
||||||
mv "${tmpfile}" "${full_path}"
|
mv "${tmpfile}" "${full_path}"
|
||||||
|
|
Loading…
Add table
Reference in a new issue