pdns icon indicating copy to clipboard operation
pdns copied to clipboard

[docs] Lua record usage with the API.

Open libesz opened this issue 5 years ago • 1 comments

  • Program: Authoritative
  • Issue type: Bug report

Short description

I could not find Lua record usage description with the API explained in the documentation. I could figure out based on the generic SQL examples that the record type should be LUA instead of i.e. A and then the content should contain the record type, followed by the quoted script. However the record format in general is briefly explained, this is not straightforward. I would suggest to add this to the API docs here and here.

Environment

  • Operating system: Alpine 3.12
  • Software version: 4.2.2
  • Software source: alpine package

libesz avatar Jul 08 '20 11:07 libesz

@libesz were you able to figure out what the API wants here? I've tried sending in:

{
    "name": "lua.exxampled.com",
    "type": "LUA",
    "ttl": 3600,
    "changetype": "REPLACE",
    "records": [{
        "content": "A \\"\'1.2.3.4\'\\"",
        "disabled": false
    }]
}

And a bunch of other variants without any luck. I went into the DB backing my local pdns server and created the above record with SQL. When I query with dig it works as expected. When I list things in the API I get back:

{
    "comments": [],
    "name": "lua.exxampled.com.",
    "records": [{
        "content": "A \\"\'1.2.3.4\'\\"",
        "disabled": false
    }],
    "ttl": 3600,
    "type": "LUA"
}

which seems to match up afaict.

No matter what I do I end up getting a 422:

422 Client Error: Unprocessable Entity for url: http://127.0.0.1:8081/api/v1/servers/localhost/zones/exxampled.com.

/cc https://github.com/octodns/octodns-powerdns/issues/7

ross avatar Jun 01 '22 21:06 ross

I've tried the other way around, by creating a Lua record through an open-source solution like Poweradmin, then tried fetching the records using their API.

Unfortunately, the API responds with 500 Internal Server Error. @ross Did you manage to get it to work?

KAloraifi avatar Nov 02 '23 11:11 KAloraifi

Unfortunately, the API responds with 500 Internal Server Error. @ross Did you manage to get it to work?

What does the server log report in this case?

zeha avatar Nov 02 '23 12:11 zeha

Unfortunately, the API responds with 500 Internal Server Error. @ross Did you manage to get it to work?

It's been long enough that I don't really remember. I definitely wasn't hitting 500 errors though. My end conclusion was that the lua support in API wasn't particularly polished. Wonder if Poweradmin is using it. If so maybe it's worth looking at what it's doing.

ross avatar Nov 02 '23 15:11 ross

Unfortunately, the API responds with 500 Internal Server Error. @ross Did you manage to get it to work?

What does the server log report in this case?

Hello @zeha, I wasn't able to inspect the response body when I was trying. Will have to get back to you on that next week.

KAloraifi avatar Nov 03 '23 09:11 KAloraifi