"Push DNS records to registrar" failures

My YunoHost server

Hardware: Raspberry Pi 4 at home
YunoHost version: 11.0.10.2
I have access to my server : Through SSH | through the webadmin | direct access via keyboard / screen

Description of my issue

I’m trying to push my DNS records to Gandi using the “Domains → domain name → DNS → Push DNS records to registrar” functionality.
Just as in this topic, I’m getting various “Failed to create record A/domain name : list indices must be integers or slices, not str” errors.

I have tried to follow the suggestion of that topic to bump error severity, but I’m not getting much more. To be precise, the “History” bottom drawer just gives the error I listed. In yunohost-api.log I get something more (I paste here an excerpt - had to add some spaces around api.gandi.net endpoints otherwise they were detected as links and I couldn’t post the logs, since I’m a new user):

2023-01-03 10:35:38,312 DEBUG lexicon.providers.gandi (unknown function) - create_record: True
2023-01-03 10:35:38,312 INFO yunohost.domain (unknown function) - [517.95] [#########…] > create A / @
2023-01-03 10:35:38,329 DEBUG urllib3.connectionpool (unknown function) - Starting new HTTPS connection (1): api .gandi.net:443
2023-01-03 10:35:38,648 DEBUG urllib3.connectionpool (unknown function) - https:// api .gandi.net:443 “GET /v5/livedns/domains/foxthesystem.space HTTP/1.1” 200 310
2023-01-03 10:35:38,655 DEBUG urllib3.connectionpool (unknown function) - Starting new HTTPS connection (1): api .gandi.net:443
2023-01-03 10:35:38,995 DEBUG urllib3.connectionpool (unknown function) - https:// api .gandi.net:443 “GET /v5/livedns/domains/foxthesystem.space/records//A HTTP/1.1” 200 2
2023-01-03 10:35:39,007 ERROR yunohost.domain (unknown function) - [517.95] Failed to create record A/foxthesystem.space : list indices must be integers or slices, not s>
2023-01-03 10:35:39,009 INFO yunohost.domain (unknown function) - [517.95] [##########…] > create A / pleroma
2023-01-03 10:35:39,048 DEBUG urllib3.connectionpool (unknown function) - Starting new HTTPS connection (1): api .gandi.net:443
2023-01-03 10:35:39,317 DEBUG urllib3.connectionpool (unknown function) - https:// api .gandi.net:443 “GET /v5/livedns/domains/foxthesystem.space HTTP/1.1” 200 310
2023-01-03 10:35:39,324 DEBUG urllib3.connectionpool (unknown function) - Starting new HTTPS connection (1): api .gandi.net:443
2023-01-03 10:35:39,658 DEBUG urllib3.connectionpool (unknown function) - https:// api .gandi.net:443 "GET /v5/livedns/domains/foxthesystem.space/records/pleroma/A HTTP/1.>
2023-01-03 10:35:39,662 DEBUG lexicon.providers.gandi (unknown function) - list_records:

I don’t know if there’s something more I can provide or test I can make.

Sooo can you confirm that you did apply the suggested debug trick with sudo sed -i 's/logger.error(msg)/logger.exception(msg)/g' /usr/lib/python3/dist-packages/yunohost/dns.py ?

Note that this was mainly intended for CLI debugging, not API … though maybe restarting yunohost-api and retriggering the issue may yield some relevant info

Hi, thanks for the answer!

Yes, I can confirm the change was made, I checked inside the file and saw that there was no logger.error(msg), but there was a logger.exception(msg).

I tried restarting yunohost-api from Services → yunohost-api → Restart. Weirdly enough, first time I received an authentication error (?), but the second time the service actually restarted (or at least that’s what I guessed from the logs below and the " Running since 3 minutes ago" message).

I tried pushing again the DNS, but the result was the same as before.

After a bit of digging I think I got the correct CLI command (tell me if it’s wrong or if it needs to be something else), but there is no extra info anyway:

root@foxthesystem:~# yunohost domain dns push foxthesystem.space
Info: Pushing DNS records…
Info: [######…] > create CAA / @
Error: Failed to create record CAA/foxthesystem.space : list indices must be integers or slices, not str
Info: [#############…] > create MX / @
Error: Failed to create record MX/foxthesystem.space : list indices must be integers or slices, not str
Info: [####################] > create TXT / @
Error: Failed to create record TXT/foxthesystem.space : list indices must be integers or slices, not str
Error: Updating the DNS records failed miserably.
errors:

  • Failed to create record CAA/foxthesystem.space : list indices must be integers or slices, not str
  • Failed to create record MX/foxthesystem.space : list indices must be integers or slices, not str
  • Failed to create record TXT/foxthesystem.space : list indices must be integers or slices, not str

warnings:
root@foxthesystem:~#

Is there some other test I can make? In case: I’m a long time linux user, but not a yunohost one, so tell me what to run exactly or where to go, because I have no idea what yunohost architecture is behind the scenes (I just discovered today there’s a yunohost CLI ;-D)

Hmokay let’s try something more elaborate to have details:

sed -i 's/logger.exception(msg)/import traceback; logger.error(traceback.format_exc())/g' /usr/lib/python3/dist-packages/yunohost/dns.py

There’s finally some traceback ;D

root@foxthesystem:~# yunohost domain dns push foxthesystem.space
Info: Pushing DNS records…
Info: [######…] > create CAA / @
Error: Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/yunohost/dns.py”, line 980, in domain_dns_push
result = LexiconClient(query).execute()
File “/usr/lib/python3/dist-packages/lexicon/client.py”, line 88, in execute
return self.provider.create_record(record_type, name, content)
File “/usr/lib/python3/dist-packages/lexicon/providers/base.py”, line 79, in create_record
return self._create_record(rtype, name, content)
File “/usr/lib/python3/dist-packages/lexicon/providers/gandi.py”, line 102, in _create_record
record[“content”] for record in self._list_records(rtype=rtype, name=name)
File “/usr/lib/python3/dist-packages/lexicon/providers/gandi.py”, line 166, in _list_records
for value in query_result[“rrset_values”]:
TypeError: list indices must be integers or slices, not str

Info: [#############…] > create MX / @
Error: Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/yunohost/dns.py”, line 980, in domain_dns_push
result = LexiconClient(query).execute()
File “/usr/lib/python3/dist-packages/lexicon/client.py”, line 88, in execute
return self.provider.create_record(record_type, name, content)
File “/usr/lib/python3/dist-packages/lexicon/providers/base.py”, line 79, in create_record
return self._create_record(rtype, name, content)
File “/usr/lib/python3/dist-packages/lexicon/providers/gandi.py”, line 102, in _create_record
record[“content”] for record in self._list_records(rtype=rtype, name=name)
File “/usr/lib/python3/dist-packages/lexicon/providers/gandi.py”, line 166, in _list_records
for value in query_result[“rrset_values”]:
TypeError: list indices must be integers or slices, not str

Info: [####################] > create TXT / @
Error: Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/yunohost/dns.py”, line 980, in domain_dns_push
result = LexiconClient(query).execute()
File “/usr/lib/python3/dist-packages/lexicon/client.py”, line 88, in execute
return self.provider.create_record(record_type, name, content)
File “/usr/lib/python3/dist-packages/lexicon/providers/base.py”, line 79, in create_record
return self._create_record(rtype, name, content)
File “/usr/lib/python3/dist-packages/lexicon/providers/gandi.py”, line 102, in _create_record
record[“content”] for record in self._list_records(rtype=rtype, name=name)
File “/usr/lib/python3/dist-packages/lexicon/providers/gandi.py”, line 166, in _list_records
for value in query_result[“rrset_values”]:
TypeError: list indices must be integers or slices, not str

Error: Updating the DNS records failed miserably.
errors:

  • Failed to create record CAA/foxthesystem.space : list indices must be integers or slices, not str
  • Failed to create record MX/foxthesystem.space : list indices must be integers or slices, not str
  • Failed to create record TXT/foxthesystem.space : list indices must be integers or slices, not str
    warnings:
    root@foxthesystem:~#

I have also digged a bit more. When dns.py calls “current_records = client.provider.list_records()”, this in turns arrives at lexicon/providers.gandi.py and in _list_records the variable query_results is correctly populated, that is, something like:

[{‘rrset_href’: ‘https://api.gandi.net/v5/livedns/domains/foxthesystem.space/records/*/A’,
‘rrset_name’: ‘*’,
‘rrset_ttl’: 3600,
‘rrset_type’: ‘A’,
‘rrset_values’: [‘82.54.229.247’]},
{‘rrset_href’: ‘https://api.gandi.net/v5/livedns/domains/foxthesystem.space/records/%40/A’,
‘rrset_name’: ‘@’,
‘rrset_ttl’: 3600,

But then later on dns.py calls “result = LexiconClient(query).execute()”, and that in turns also ends up in _list_records, but in that case query_results has value [] (array of empty array), which causes the exception.

I didn’t investigate any further because I don’t really know about all the machinery involved and probably would not end up anywhere.

Welll not bad for somebody that supposedly needs to be told “what to run exactly or where to go, because I have no idea” :stuck_out_tongue_winking_eye:

I think I would dig further by checking here : yunohost/dns.py at dev · YunoHost/yunohost · GitHub what’s the content of record by adding print(record) (with the same indentation)

(The corresponding file is still /usr/lib/python3/dist-packages/yunohost/dns.py)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.