Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot update it #2

Open
et2017et opened this issue Apr 27, 2018 · 15 comments
Open

Cannot update it #2

et2017et opened this issue Apr 27, 2018 · 15 comments

Comments

@et2017et
Copy link

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

@xieranmaya
Copy link

me too

@fexofenadine
Copy link
Contributor

fexofenadine commented May 4, 2018

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

@KurinPawpad
Copy link

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.

@fexofenadine
Copy link
Contributor

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

@KurinPawpad
Copy link

KurinPawpad commented May 6, 2018

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.

@fexofenadine
Copy link
Contributor

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?

@KurinPawpad
Copy link

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.

@fexofenadine
Copy link
Contributor

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

@KurinPawpad
Copy link

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.

@fexofenadine
Copy link
Contributor

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

@KurinPawpad
Copy link

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.

@fexofenadine
Copy link
Contributor

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

@fexofenadine
Copy link
Contributor

Should be resolved now

@gu1ll0me
Copy link
Owner

gu1ll0me commented May 6, 2018

@fexofenadine Thanks for your pull requests!

@fexofenadine
Copy link
Contributor

Glad to help out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants