godaddy-ddns icon indicating copy to clipboard operation
godaddy-ddns copied to clipboard

Cannot update it

Open et2017et opened this issue 7 years ago • 15 comments
trafficstars

hi, i do not know if godaddy changed API recently, your script is not working recently. the error just showing "fail". i was able to use your script to update ddns.

thanks ET

et2017et avatar Apr 27 '18 11:04 et2017et

me too

xieranmaya avatar Apr 29 '18 09:04 xieranmaya

the api was slightly changed by godaddy to use square brackets around put requests like so: [{"data":"111.123.234.345","name":"@","ttl":3600,"type":"A"}] (an array) instead of {"data":"124.180.19.215","name":"@","ttl":3600,"type":"A"}, the script has been updated

commit

fexofenadine avatar May 04 '18 09:05 fexofenadine

The Update= line works to update the DNS entry, however it always says it fails (and gives no reason as to why), and always updates even if the entry matches the current IP.

KurinPawpad avatar May 06 '18 08:05 KurinPawpad

I've written a pull request to fix that but it hasn't been approved yet

fexofenadine avatar May 06 '18 09:05 fexofenadine

Tested the changes and yes, that resolves the fail/success issue, however it will still run even if the IP does not need to be changed. The Check= line is not parsing the json properly to get ONLY the IP, and thus it does not match.

KurinPawpad avatar May 06 '18 09:05 KurinPawpad

it should be writing your old IP to /tmp/current_ip and comparing that - do you have write access to that file? does it contain your cached IP?

fexofenadine avatar May 06 '18 10:05 fexofenadine

It is cached, however my server randomly reboots from time to time, deleting the temp file. If I remove that, it fails the check and forces an update even if the IP is the same as the DNS entry.

KurinPawpad avatar May 06 '18 10:05 KurinPawpad

ah ok, maybe change the path of the file to somewhere it wont be deleted - '~/current_ip' perhaps

fexofenadine avatar May 06 '18 10:05 fexofenadine

That solution only covers up the problem that the Check= line is malformed and fails 100% of the time.

I've mocked up a solution: Replace the end of the Check= line after the pipe with: |sed -r 's/([|])//g' | jq -r '.data'

This uses jq (json parser utility) to pull out the data variable, but you need to strip out the square-braces so it can do so. Hacky, but it works so far.

KurinPawpad avatar May 06 '18 10:05 KurinPawpad

it's actually designed to overwrite any existing DNS entry, is it a problem if it writes the same DNS as the existing entry? The script could be reworked to compare the existing IP to the one in DNS and only update if it's different, rather than using a temp file

fexofenadine avatar May 06 '18 10:05 fexofenadine

Why poll GoDaddy for the IP assigned, but then ignore the result? A wasted query. Also, it isn't a problem to overwrite with identical information, but it can easily be avoided.

KurinPawpad avatar May 06 '18 10:05 KurinPawpad

you're right, I'd missed your point initially

fexofenadine avatar May 06 '18 10:05 fexofenadine

Should be resolved now

fexofenadine avatar May 06 '18 13:05 fexofenadine

@fexofenadine Thanks for your pull requests!

gu1ll0me avatar May 06 '18 13:05 gu1ll0me

Glad to help out!

fexofenadine avatar May 07 '18 00:05 fexofenadine