This commit is contained in:
davidnewhall2 2019-12-29 04:10:01 -08:00
parent 2d3d034e83
commit e7e7baabee
1 changed files with 8 additions and 3 deletions

View File

@ -18,16 +18,19 @@ DASHMAP[11310]="UniFi-Poller_ Client DPI - Prometheus.json"
# Simple function to make sure no stray files got uploaded. # Simple function to make sure no stray files got uploaded.
function check { function check {
echo -n "Checking dashboards in: "
pushd "${WHERE}"
SAVEIFS=$IFS SAVEIFS=$IFS
# unobtainium # unobtainium
IFS=$(echo -en "\n\b") IFS=$(echo -en "\n\b")
for file in ${WHERE}*; do for file in *; do
found=0 found=0
[ "$file" != "${WHERE}README.md" ] || continue [ "$file" != "README.md" ] || continue
# Check for this file's existence in the DASHMAP variable.
for i in ${!DASHMAP[@]}; do for i in ${!DASHMAP[@]}; do
if [ "${WHERE}${DASHMAP[$i]}" == "$file" ]; then if [ "${DASHMAP[$i]}" == "$file" ]; then
found=1 found=1
echo "found! $file -> $i" echo "found! $file -> $i"
break break
@ -37,10 +40,12 @@ function check {
if [ "$found" = "0" ]; then if [ "$found" = "0" ]; then
IFS=$SAVEIFS IFS=$SAVEIFS
echo "uh oh. file not found in DASHMAP: $file" echo "uh oh. file not found in DASHMAP: $file"
popd >> /dev/null
exit 2 exit 2
fi fi
done done
popd >> /dev/null
IFS=$SAVEIFS IFS=$SAVEIFS
} }