Skip to content
This repository has been archived by the owner on Jul 4, 2024. It is now read-only.

gandi record update issues #220

Closed
axelsimon opened this issue Aug 17, 2017 · 5 comments
Closed

gandi record update issues #220

axelsimon opened this issue Aug 17, 2017 · 5 comments

Comments

@axelsimon
Copy link

Environment

OS/kernel:

uname -a
Linux computer 4.11.0-1-amd64 #1 SMP Debian 4.11.6-1 (2017-06-19) x86_64 GNU/Linux (debian testing Buster)

as well as

Linux also-a-computer 4.12.5-300.fc26.x86_64 #1 SMP Mon Aug 7 15:27:25 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux (Fedora 26)

Gandi cli version:

gandi --version
Gandi CLI 0.20

Issue

Hi,
Trying to update a TXT record to set a secret for the letsencrypt DNS challenge, using:

gandi record update --record "_acme-challenge 10800 TXT \"l0c6e6EHtX10Zz08uqAwz-mOTYQvCfDwY4XkijIaWDU\"" --new-record "_acme-challenge 3600 TXT \"MLlKzzZBWF40xVxB-uRYMVwkl2UNAemmXnbMjNnsDaY\"" example.com

returns the following error:

Creating new zone file
Updating zone records
Traceback (most recent call last):
File "/usr/local/bin/gandi", line 11, in
load_entry_point('gandi.cli==0.20', 'console_scripts', 'gandi')()
File "/usr/local/lib/python2.7/dist-packages/gandi/cli/main.py", line 8, in main
cli(obj={})
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 722, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python2.7/dist-packages/gandi/cli/core/cli.py", line 221, in invoke
click.Group.invoke(self, ctx)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args[1:], **kwargs)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/gandi/cli/commands/record.py", line 176, in update
result = gandi.record.update(zone_id, record, new_record)
File "/usr/local/lib/python2.7/dist-packages/gandi/cli/modules/record.py", line 102, in update
{'id': int(record[0]['id'])}, params_newrecord)
File "/usr/local/lib/python2.7/dist-packages/gandi/cli/core/base.py", line 92, in call
kwargs.get('return_dry_run', False)})
File "/usr/local/lib/python2.7/dist-packages/gandi/cli/core/client.py", line 71, in request
return func(apikey, *args)
File "/usr/lib/python2.7/xmlrpclib.py", line 1243, in call
return self.__send(self.__name, args)
File "/usr/lib/python2.7/xmlrpclib.py", line 1596, in __request
allow_none=self.__allow_none)
File "/usr/lib/python2.7/xmlrpclib.py", line 1094, in dumps
data = m.dumps(params)
File "/usr/lib/python2.7/xmlrpclib.py", line 638, in dumps
dump(v, write)
File "/usr/lib/python2.7/xmlrpclib.py", line 660, in __dump
f(self, value, write)
File "/usr/lib/python2.7/xmlrpclib.py", line 741, in dump_struct
dump(v, write)
File "/usr/lib/python2.7/xmlrpclib.py", line 660, in __dump
f(self, value, write)
File "/usr/lib/python2.7/xmlrpclib.py", line 671, in dump_int
raise OverflowError, "int exceeds XML-RPC limits"
OverflowError: int exceeds XML-RPC limits

Also, the documentation mentions the following way to update a record:

gandi record update example.com --record "@ 3600 IN A 127.0.0.1" --new-record "@ 3600 IN A 0.0.0.0"

But executing:

gandi record update --record "_acme-challenge 10800 IN TXT \"ll0c6e6EHtX10Zz08uqAwz-mOTYQvCfDwY4XkijIaWDU\"" --new-record "_acme-challenge 3600 IN TXT \"MLlKzzZBWF40xVxB-uRYMVwkl2UNAemmXnbMjNnsDaY\"" example.com

gandi.cli returns:

Creating new zone file
Usage: gandi record update [OPTIONS] DOMAIN
Error: Gandi API has returned an error: <Fault 500037: 'Error on object : OBJECT_UNKNOWN (CAUSE_BADPARAMETER) [type: IN not in list A,AAAA,CNAME,MX,NS,TXT,WKS,SRV,LOC,SPF,CAA,DS,SSHFP,PTR,DNAME,TLSA,CDS]'>

The documentation and gandi record update --help say to mention the record state, but in this case gandi cli understands IN to be a record type.:

-r, --record TEXT 'name TTL IN TYPE [A, AAAA, MX, TXT, SPF] value'

Also, it might be worth mentioning the CLI help says to put the current and new record values between single quotes ' whereas the README.md says to put them between double quotes ". Not sure which one is the right one. In any case, the documentation doesn't mention what to do if the record itself contains double quotes. I escaped them, but some clarification in the documentation would be nice.

Hope this helps.

@sayoun
Copy link
Contributor

sayoun commented Aug 17, 2017

Hello, thank you for opening this issue.

It seems that you have found two different bugs, both related to record update. I'll see how to fix this asap, the fix will be available on the master branch on github, if you have installed the CLI using github you will just have to update your repository.

@axelsimon
Copy link
Author

Thanks for the very quick answer.

I installed using pip. But I'll test the git version if there's a fix :)

Also, I just looked in my customer interface, and found this amusing result of my trying to update the records using gandi.cli:
screenshot from 2017-08-17 12-30-56
So, apparently the record update process goes halfway through and creates a new version of the zone file, but doesn't modify that newly created zone file nor activates it.

@sayoun
Copy link
Contributor

sayoun commented Aug 17, 2017

Yes as the process fail to update the record, the zone created is still present after the error, only not activated, I'll see if we can delete the zone in case of error to avoid this.

So you found 3 bugs in one issue, there should be an award for that :)

@sayoun sayoun closed this as completed in 2332d10 Aug 17, 2017
@sayoun
Copy link
Contributor

sayoun commented Aug 17, 2017

@axelsimon The master branch has been updated with a fix for your 3 issues, if you can test and validate this ? Thanks

@tintamarre
Copy link

I had the same problem and it's now working fine. Thx.

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

No branches or pull requests

3 participants