@@ -124,41 +124,41 @@ found_match=false
124124
125125# Extract RecordId from parameters
126126if [ -n " $( echo " ${paramEnc} " | grep RecordId) " ]; then
127- specRecordId=$( echo " $paramEnc " | grep -o ' RecordId=[^&]*' | cut -d' =' -f2)
127+ specRecordId=$( echo " $paramEnc " | grep -o ' RecordId=[^&]*' | cut -d' =' -f2)
128128fi
129129
130130# If RecordId is successfully extracted, try to match it
131131if [ -n " $specRecordId " ]; then
132- write_log 7 " specRecordId: ${specRecordId} "
133- idx=1
134- while json_is_a $idx object
135- do
136- json_select $idx
137- json_get_var tmp RecordId
138- write_log 7 " The $idx Domain RecordId: ${tmp} "
139- if [ " $tmp " = " $specRecordId " ]; then
140- __RECORD_ID=$specRecordId
141- json_get_var __RECORD_VALUE Value
142- write_log 7 " The $idx Domain Record Value: ${__RECORD_VALUE} "
143- found_match=true
132+ write_log 7 " specRecordId: ${specRecordId} "
133+ idx=1
134+ while json_is_a $idx object
135+ do
136+ json_select $idx
137+ json_get_var tmp RecordId
138+ write_log 7 " The $idx Domain RecordId: ${tmp} "
139+ if [ " $tmp " = " $specRecordId " ]; then
140+ __RECORD_ID=$specRecordId
141+ json_get_var __RECORD_VALUE Value
142+ write_log 7 " The $idx Domain Record Value: ${__RECORD_VALUE} "
143+ found_match=true
144144 break
145- fi
146- idx=$(( idx+ 1 ))
147- json_select ..
148- done
145+ fi
146+ idx=$(( idx+ 1 ))
147+ json_select ..
148+ done
149149fi
150150
151151# Fallback to default logic if no match found
152152if [ " $found_match " = false ]; then
153- write_log 7 " Using default logic to select record"
154- # If multiple records are found, only use the first one
155- if [ " $__RECORD_COUNT " -gt 1 ]; then
156- write_log 4 " WARNING: found multiple records of $__HOST , only use the first one"
157- fi
158- json_select 1
159- # Get the record id of the first DNS record
160- json_get_var __RECORD_ID RecordId
161- json_get_var __RECORD_VALUE Value
153+ write_log 7 " Using default logic to select record"
154+ # If multiple records are found, only use the first one
155+ if [ " $__RECORD_COUNT " -gt 1 ]; then
156+ write_log 4 " WARNING: found multiple records of $__HOST , only use the first one"
157+ fi
158+ json_select 1
159+ # Get the record id of the first DNS record
160+ json_get_var __RECORD_ID RecordId
161+ json_get_var __RECORD_VALUE Value
162162fi
163163
164164# dont update if the ip has not changed
0 commit comments