summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorBen Busby <contact@benbusby.com>2022-07-31 11:47:28 -0600
committerBen Busby <contact@benbusby.com>2022-07-31 11:47:28 -0600
commit3460986481b11cbd212c0504db49d9684ea9eeeb (patch)
tree16a61a4eed9c751742745b255ee517e76a471b12 /tools
parent431ea613d19fc471de14629dc5dcc7fd22cfbddd (diff)
downloadfarside-3460986481b11cbd212c0504db49d9684ea9eeeb.tar.gz
Handle dig return code 9 in update workflow
If dig returns exit code 9 (no reply from server) when checking an instance for cloudflare records, it shouldn't fail the CI build but rather just skip adding the instance to the non-cloudflare services list. This should be re-evaluated soon to see if the CI build routinely has issues with getting a server reply. If so, a different approach needs to be taken to check if an instance is using cloudflare.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/un-cloudflare.sh7
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/un-cloudflare.sh b/tools/un-cloudflare.sh
index 690dd73..b10178b 100755
--- a/tools/un-cloudflare.sh
+++ b/tools/un-cloudflare.sh
@@ -7,9 +7,11 @@ file="services-full.json"
while read -r line; do
if [[ "$line" == "\"https://"* ]]; then
domain=$(echo "$line" | sed -e "s/^\"https:\/\///" -e "s/\",//" -e "s/\"//")
- ns=$(dig ns "$domain")
+ ns=$(dig ns "$domain" || true)
if [[ "$ns" == *"cloudflare"* ]]; then
echo "\"$domain\" using cloudflare, skipping..."
+ elif [ ${#ns} -eq 0 ]; then
+ echo "Unable to verify records for \"$domain\", skipping..."
else
echo "$line" >> out.json
fi
@@ -22,5 +24,4 @@ done <$file
sed -i '' -e ':begin' -e '$!N' -e 's/,\n]/\n]/g' -e 'tbegin' -e 'P' -e 'D' out.json
cat out.json | jq --indent 2 . > services.json
-rm out.json
-
+rm -f out.json