Updating per comment re: Exit vs Return on initial validation

This commit is contained in:
Gary McGregor 2024-09-24 07:23:39 -05:00
parent e6b3e42d61
commit cb113437f6
No known key found for this signature in database
GPG Key ID: 0D2A7E7C1C113901

View File

@ -39,6 +39,9 @@ dns_omglol_add() {
_debug "omg.lol Address" "$omglol_address" _debug "omg.lol Address" "$omglol_address"
omglol_validate "$omglol_apikey" "$omglol_address" "$fulldomain" omglol_validate "$omglol_apikey" "$omglol_address" "$fulldomain"
if [ ! $? ]; then
return 1
fi
dnsName=$(_getDnsRecordName "$fulldomain" "$omglol_address") dnsName=$(_getDnsRecordName "$fulldomain" "$omglol_address")
authHeader="$(_createAuthHeader "$omglol_apikey")" authHeader="$(_createAuthHeader "$omglol_apikey")"
@ -66,6 +69,9 @@ dns_omglol_rm() {
_debug address "$omglol_address" _debug address "$omglol_address"
omglol_validate "$omglol_apikey" "$omglol_address" "$fulldomain" omglol_validate "$omglol_apikey" "$omglol_address" "$fulldomain"
if [ ! $? ]; then
return 1
fi
dnsName=$(_getDnsRecordName "$fulldomain" "$omglol_address") dnsName=$(_getDnsRecordName "$fulldomain" "$omglol_address")
authHeader="$(_createAuthHeader "$omglol_apikey")" authHeader="$(_createAuthHeader "$omglol_apikey")"
@ -82,24 +88,24 @@ omglol_validate() {
if [ "" = "$omglol_address" ]; then if [ "" = "$omglol_address" ]; then
_err "omg.lol base address not provided. Exiting" _err "omg.lol base address not provided. Exiting"
exit 1 return 1
fi fi
if [ "" = "$omglol_apikey" ]; then if [ "" = "$omglol_apikey" ]; then
_err "omg.lol API key not provided. Exiting" _err "omg.lol API key not provided. Exiting"
exit 1 return 1
fi fi
_endswith "$fulldomain" "omg.lol" _endswith "$fulldomain" "omg.lol"
if [ ! $? ]; then if [ ! $? ]; then
_err "Domain name requested is not under omg.lol" _err "Domain name requested is not under omg.lol"
exit 1 return 1
fi fi
_endswith "$fulldomain" "$omglol_address.omg.lol" _endswith "$fulldomain" "$omglol_address.omg.lol"
if [ ! $? ]; then if [ ! $? ]; then
_err "Domain name is not a subdomain of provided omg.lol address $omglol_address" _err "Domain name is not a subdomain of provided omg.lol address $omglol_address"
exit 1 return 1
fi fi
_debug "omglol_validate(): Required environment parameters are all present" _debug "omglol_validate(): Required environment parameters are all present"