brianreumere / gandi-automatic-dns

Dynamic DNS shell script for Gandi
Other
100 stars 22 forks source link

ipv6 record issue #36

Closed cyayon closed 9 months ago

cyayon commented 9 months ago

Hi ,

there is an issue with the new version 2.1. the json_get_field() function failed to get the correct record_value for ipv6 records :

record_json:
---
{"rrset_name":"xxx","rrset_type":"AAAA","rrset_ttl":300,"rrset_values":["2a01:cb15:aaa:bbbb::cccc"],"rrset_href":"https://api.gandi.net/v5/livedns/domains/nbux.org/records/xxxx/AAAA"}Connecting to xxxxx
---

record_value:
---
2a01
---

It should be :

record_value:
---
2a01:cb15:aaa:bbbb::cccc
---

Thanks.

cyayon commented 9 months ago

I suggest to replace :

field_value=$(printf "%s" "$i" | awk -F ': ?' '{print $2}' | tr -d '"' | tr -d '[]')

with :

field_value=$(printf "%s" "$i" | cut -d: -f2- | tr -d '"' | tr -d '[]')
brianreumere commented 9 months ago

Thanks for reporting this! I updated the awk field separator regex to correctly handle IPv6 addresses, and it should be fixed in v2.1.1.

brianreumere commented 9 months ago

Deleted comment that was duplicate of #37.