fixes
This commit is contained in:
parent
1d928c97e2
commit
fb78db5406
|
|
@ -25,19 +25,26 @@ DASHMAP[10418]="UniFi-Poller_ Client Insights - InfluxDB.json"
|
||||||
DASHMAP[11310]="UniFi-Poller_ Client DPI - Prometheus.json"
|
DASHMAP[11310]="UniFi-Poller_ Client DPI - Prometheus.json"
|
||||||
DASHMAP[10419]="UniFi-Poller_ Client DPI - InfluxDB.json"
|
DASHMAP[10419]="UniFi-Poller_ Client DPI - InfluxDB.json"
|
||||||
|
|
||||||
|
SAVEIFS=$IFS
|
||||||
|
# unobtainium
|
||||||
|
IFS=$(echo -en "\n\b")
|
||||||
|
|
||||||
# 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: "
|
echo -n "Checking dashboards in: "
|
||||||
pushd "${WHERE}"
|
pushd "${WHERE}"
|
||||||
SAVEIFS=$IFS
|
|
||||||
# unobtainium
|
|
||||||
IFS=$(echo -en "\n\b")
|
|
||||||
|
|
||||||
for file in *; do
|
for file in *; do
|
||||||
found=0
|
found=0
|
||||||
[ "$file" != "README.md" ] || continue
|
[ "$file" != "README.md" ] || continue
|
||||||
|
|
||||||
|
isChanged "${WHERE}${DASHMAP[$i]}"
|
||||||
|
if [ "$?" = "1" ]; then
|
||||||
|
echo "Not changed: ${WHERE}${DASHMAP[$i]}"
|
||||||
|
else
|
||||||
|
echo "Changed: ${WHERE}${DASHMAP[$i]}"
|
||||||
|
fi
|
||||||
|
|
||||||
# Check for this file's existence in the DASHMAP variable.
|
# Check for this file's existence in the DASHMAP variable.
|
||||||
for i in ${!DASHMAP[@]}; do
|
for i in ${!DASHMAP[@]}; do
|
||||||
if [ "${DASHMAP[$i]}" = "$file" ]; then
|
if [ "${DASHMAP[$i]}" = "$file" ]; then
|
||||||
|
|
@ -48,7 +55,6 @@ function check {
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "$found" = "0" ]; then
|
if [ "$found" = "0" ]; then
|
||||||
IFS=$SAVEIFS
|
|
||||||
echo "uh oh. file not found in DASHMAP: $file"
|
echo "uh oh. file not found in DASHMAP: $file"
|
||||||
popd >> /dev/null
|
popd >> /dev/null
|
||||||
exit 2
|
exit 2
|
||||||
|
|
@ -56,7 +62,6 @@ function check {
|
||||||
|
|
||||||
done
|
done
|
||||||
popd >> /dev/null
|
popd >> /dev/null
|
||||||
IFS=$SAVEIFS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Simple function to make sure no expected files are missing.
|
# Simple function to make sure no expected files are missing.
|
||||||
|
|
@ -66,10 +71,6 @@ function check2 {
|
||||||
files=$(ls)
|
files=$(ls)
|
||||||
popd >> /dev/null
|
popd >> /dev/null
|
||||||
|
|
||||||
SAVEIFS=$IFS
|
|
||||||
# unobtainium
|
|
||||||
IFS=$(echo -en "\n\b")
|
|
||||||
|
|
||||||
for i in ${!DASHMAP[@]}; do
|
for i in ${!DASHMAP[@]}; do
|
||||||
found=0
|
found=0
|
||||||
|
|
||||||
|
|
@ -82,22 +83,16 @@ function check2 {
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "$found" = "0" ]; then
|
if [ "$found" = "0" ]; then
|
||||||
IFS=$SAVEIFS
|
|
||||||
echo "uh oh. configured DASHMAP file missing: ${DASHMAP[$i]}"
|
echo "uh oh. configured DASHMAP file missing: ${DASHMAP[$i]}"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
IFS=$SAVEIFS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function isChanged {
|
function isChanged {
|
||||||
local changed=false
|
local changed=false
|
||||||
local filename=$1
|
local filename=$1
|
||||||
|
|
||||||
SAVEIFS=$IFS
|
|
||||||
# unobtainium
|
|
||||||
IFS=$(echo -en "\n\b")
|
|
||||||
for file in $CHANGES; do
|
for file in $CHANGES; do
|
||||||
if [ "$file" = "$filename" ]; then
|
if [ "$file" = "$filename" ]; then
|
||||||
changed=true
|
changed=true
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue