dns/ddclient hetzner existing record update patch#5188
dns/ddclient hetzner existing record update patch#5188AdSchellevis merged 9 commits intoopnsense:masterfrom
Conversation
Added workaround for API bug on update record. Thanks to @ArcanConsulting
Added LOG_NOTICE for deletion.
|
wouldn't it be better to open a ticket at their end, it feels rather weird to patch the caller in this case (assuming its a bug and not a documented change of behavior) |
|
You are right, I've contacted the hoster again. I'll write it correct. |
Updated _update method. No workaround needed.
fix: correct indentation of return statement in _update_record
|
I was just going to open a pull request for the same issue but then I found yours. Since you also removed some code duplication, your changes are ahead of mine (see 7bc1af4). One thing I have noticed is that you are including the TTL parameter in your request. This should be removed as it's not used in the update_records action (see https://docs.hetzner.cloud/reference/cloud#tag/zone-rrset-actions/update_zone_rrset_records). |
fix: removed ttl from _update_record as its not supported (thanks to Ollienator).
Thank you, appreciate the hint. I've removed the ttl from the _update_record and tested again -> success. |
|
Any news on this? |
|
I'm waiting for a merge. Using this fix since 3 weeks without problems. |
|
Would also like to see this fix included. Want to keep using ddclient and migrate to Hetzner DNS via API. |
|
I have the same trouble with updating DNS records via new Hetzner API. I can confirm pulling this patch for hetzner.py seems to work properly. |
|
@jnikodemus I (quick) checked your source code and I'm not sure that I fully understood, so let me try to explain what I would do with the given
No need to Doing it that way will be resource and cost efficient. |
|
@TheRealBecks The request to update the IP of an RRSet Record is a POST action. (https://docs.hetzner.cloud/reference/cloud#tag/zone-rrset-actions/update_zone_rrset_records) |
|
It was intended as quickfix, to get things running without overengineering. After reviewieng the logic again I would agree with @TheRealBecks that the API-Call to check for existence is not needed as it creates the record anyway if not exists (not a typocheck as I thought in the first place). However, based on my reading of the documentation, I would still keep this as a POST, as @becast mentioned. Now that we are trying to improve the implementation in efficiency, I think the API call to retrieve the zone_id may also be unnecessary (not verified in depth yet). The new API supports changes based on zone_name, which is already extracted locally via _get_zone_name(). |
|
@becast Okay, understand, I referenced the calls of type
@jnikodemus No overengineering involved, only two calls as intended (and as you also said in your last post) 🙂 |
|
@TheRealBecks I've removed the check for existence and the now unneseccary method _get_record(). I’d appreciate a quick check. |
|
Code looks good to me, but the permission doesn't seems to be correct by now: |
|
I can confirm this is working excellently on my installation since last week. |
|
@AdSchellevis Are you okay with the changes? |
|
Looking at how the discussion started (a bug elsewhere being worked around here), it feels strange to patch anything. I don't mind that much merging changes if enough people tested it, but in that case it's probably a good idea to sweep this for whitespace changes to limit the amount of lines changed (there's a lot of noise in the PR now). |
|
@jnikodemus One more iteration without the whole file being auto-formatted (and therefore white spaces being deleted) could lead to a merge 😉 |
I added the deleted whitespaces and removed autogenerated Hyperlinks. Hope it's ok to merge now, as the patch would be nice for hetzner-people :) |
|
@jnikodemus thanks, I've merged it for you |
Great, thanks! @TheRealBecks thanks for your support :) |
* Update hetzner.py Added workaround for API bug on update record. Thanks to @ArcanConsulting * Update hetzner.py Added LOG_NOTICE for deletion. * Update hetzner.py Updated _update method. No workaround needed. * Update hetzner.py fix: correct indentation of return statement in _update_record * Update hetzner.py fix: removed ttl from _update_record as its not supported (thanks to Ollienator). * Removed _get_record() and existence-check of zone to save API-Calls. Thanks to @TheRealBecks * restored filepermissions to 755 and removed useless comment * removed links and added original whitespaces. * removed whitespace on line 62 --------- Co-authored-by: Julian Nikodemus <dev@nkdms.de>
Fix ddclient update Hetzner for new API
Reference
pull#5082
issue#5187
Problem
The actual update method returns code 200 for an update, because it doesnt use the right entrypoint.
Fix
Changed the API entrypoint "actions" and removed code duplication.
Testing
Tested on a local OPNsense instance with multiple records.