pbertera / PowerDNS-CLI

Python CLI managing a PowerDNS server trough the REST API
15 stars 5 forks source link

Issue creating/editing records #1

Open ivnandrade opened 7 years ago

ivnandrade commented 7 years ago

When I try to create/change a record against powerdns4.0.0 api, for example A record, I receive this error:

{"error":."Key.'ttl'.not.an.Integer.or.not.present"}

That is becouse ttl field is sent into 'rrsets' field when It's supposed to be outside it, as seen here https://github.com/PowerDNS/pdns/issues/3492

Correct portion of code

payload = { "rrsets": [ { "name": self.args.name + '.' + self.args.zone, "type": self.args.recordType, "changetype": "REPLACE", "ttl": self.args.ttl, "records": [ { "content": self.args.content, "disabled": self.args.disabled, "name": self.args.name + '.' + self.args.zone, "set-ptr": self.args.setPTR, "type": self.args.recordType, "priority": self.args.priority } ] }

[...]

"rrsets": [ { "name": row[0] + '.' + row[1], "type": row[2], "changetype": "REPLACE", "ttl": row[5], "records": [ { "content": row[3], "disabled": disabled, "name": row[0] + '.' + row[1], "set-ptr": set_ptr, "type": row[2], "priority": row[7] } ] }

pbertera commented 7 years ago

Thanks for reporting! I'll try to fix as soon I have a bit of time for that!

pbertera commented 7 years ago

Hi @ivnandrade,

please apologise for the so late answer, I'm just using the script against powerdns 4.0.4 and works properly with the ttl field into the rrsets. Can you tell me which pdns version you are using ?

Thanks!