Gandi / gandi.cli

⚠ ARCHIVED - Command line interface to Gandi.net products using the public API
http://cli.gandi.net/
GNU General Public License v3.0
347 stars 62 forks source link

dns update command reports "Remote API service is unreachable" #285

Open Ronmi opened 5 years ago

Ronmi commented 5 years ago

Failed to run gandi dns update, which shows An error occured during call: Remote API service is unreachable when calling domain record api

Here's part of the log

[DEBUG] calling url: GET https://dns.api.gandi.net/api/v5/domains/gg-in.in
[DEBUG] with params: {'headers': {'X-Api-Key': '**********'}}
[DUMP] responded: {'zone_uuid': '5fb3e900-472b-11e9-ae02-00163e4e76d5', 'zone_records_href': 'https://dns.api.gandi.net/api/v5/zones/5fb3e900-472b-11e9-ae02-00163e4e76d5/records', 'fqdn': 'gg-in.in', 'zone_href': 'https://dns.api.gandi.net/api/v5/zones/5fb3e900-472b-11e9-ae02-00163e4e76d5', 'domain_href': 'https://dns.api.gandi.net/api/v5/domains/gg-in.in', 'domain_keys_href': 'https://dns.api.gandi.net/api/v5/domains/gg-in.in/keys', 'domain_records_href': 'https://dns.api.gandi.net/api/v5/domains/gg-in.in/records'}
[DEBUG] calling url: PUT https://dns.api.gandi.net/api/v5/domains/gg-in.in/records
[DEBUG] with params: {'data': b'@ 10800 IN SOA ns1.gandi.net. hostmaster.gandi.net. 1556293726 10800 3600 604800 10800\n*.home 3600 IN CNAME home.gg-in.in.\n@ 3600 IN A 45.79.84.159\n@ 3600 IN TXT "v=spf1" "ip4:45.79.84.159" "~all"\n_imap._tcp.gg-in.in 3600 IN SRV 0 0 993 mail.gg-in.in.\n_imaps._tcp.gg-in.in 3600 IN SRV 0 0 993 mail.gg-in.in.\n_submission._tcp.gg-in.in 3600 IN SRV 0 0 587 mail.gg-in.in.\nhome 3600 IN A 114.35.100.230\nimap 3600 IN CNAME mail.gg-in.in.\nmail 3600 IN A 45.79.84.159\nsmtp 3600 IN CNAME mail.gg-in.in.\ntest 60 IN CNAME home.gg-in.in.', 'headers': {'X-Api-Key': '******', 'Content-Type': 'text/plain'}}
An error occured during call: Remote API service is unreachable
srgvg commented 4 years ago

Adding this patch, I managed to get details on what went wrong: https://github.com/srgvg/gandi.cli/commit/6c8efe99120fb3b69ed0f856cceddab710ac56fb In my case, I wanted to add a (second) TXT record on a domain, and the API returned {"code": 409, "message": "This record already exists", "object": "HTTPConflict", "cause": "Duplicate Entry"} which must be some bug, as it's perfectly possible to have multiple, different TXT records (I ended up adding it through the web interface.)