Tidy up error handling

This commit is contained in:
Luis Pabon 2024-01-04 13:06:15 +00:00
parent 0b0222f41c
commit a69d65f481
No known key found for this signature in database

View File

@ -58,9 +58,13 @@ _dns_gcloud_start_tr() {
gcloud dns record-sets transaction start \ gcloud dns record-sets transaction start \
--transaction-file="$tr" \ --transaction-file="$tr" \
--zone="$managedZone" --zone="$managedZone"
rc=$? rc=$?
if $rc != 0; then
_err "_dns_gcloud_start_tr: RC= $rc failed to execute transaction" _err "_dns_gcloud_start_tr: RC= $rc failed to execute transaction"
return 0 fi
return $rc
} }
_dns_gcloud_execute_tr() { _dns_gcloud_execute_tr() {
@ -68,9 +72,13 @@ _dns_gcloud_execute_tr() {
--transaction-file="$tr" \ --transaction-file="$tr" \
--zone="$managedZone" --zone="$managedZone"
rc=$? rc=$?
if $rc != 0; then
_debug tr "$(cat "$tr")" _debug tr "$(cat "$tr")"
_err "_dns_gcloud_execute_tr: RC= $rc failed to execute transaction" _err "_dns_gcloud_execute_tr: RC= $rc failed to execute transaction"
return $rc
fi
for i in $(seq 1 120); do for i in $(seq 1 120); do
if gcloud dns record-sets changes list \ if gcloud dns record-sets changes list \
@ -107,10 +115,14 @@ _dns_gcloud_add_rrs() {
--type=TXT \ --type=TXT \
--zone="$managedZone" \ --zone="$managedZone" \
--transaction-file="$tr" --transaction-file="$tr"
rc=$? rc=$?
if $rc != 0; then
_debug tr "$(cat "$tr")" _debug tr "$(cat "$tr")"
_err "_dns_gcloud_add_rrs: rc=$rc failed to add RRs" _err "_dns_gcloud_add_rrs: rc=$rc failed to add RRs"
return 0 fi
return $rc
} }
_dns_gcloud_find_zone() { _dns_gcloud_find_zone() {