The /zones API always returns 0 as the serial. /zones/:zone does return the correct serial.
Backend: sqlite3
Version: 4.0.1-1pdns.xenial
This happens for both zones I created. They were created through the API, following the API curl examples.
http://127.0.0.1:8081/api/v1/servers/localhost/zones
[
{
"account": "",
"dnssec": false,
"id": "example.com.",
"kind": "Native",
"last_check": 0,
"masters": [],
"name": "example.com.",
"notified_serial": 0,
"serial": 0,
"url": "api/v1/servers/localhost/zones/example.com."
},
...
]
http://127.0.0.1:8081/api/v1/servers/localhost/zones/example.com.
{
"account": "",
"dnssec": false,
"id": "example.com.",
"kind": "Native",
"last_check": 0,
"masters": [],
"name": "example.com.",
"notified_serial": 0,
"rrsets": [
{
"comments": [],
"name": "example.com.",
"records": [
{
"content": "a.misconfigured.powerdns.server. hostmaster.example.com. 2016081701 10800 3600 604800 3600",
"disabled": false
}
],
"ttl": 3600,
"type": "SOA"
},
{
"comments": [],
"name": "example.com.",
"records": [
{
"content": "ns1.example.org.",
"disabled": false
},
{
"content": "ns2.example.org.",
"disabled": false
}
],
"ttl": 3600,
"type": "NS"
}
],
"serial": 2016081701,
"soa_edit": "",
"soa_edit_api": "DEFAULT",
"url": "api/v1/servers/localhost/zones/example.com."
}
If you query the list again, is the serial now present?
What non-default pdns.conf/commandline options do you have set?
test code, but does not fail:
diff --git a/regression-tests.api/test_Zones.py b/regression-tests.api/test_Zones.py
index 93e345b..ede8ea1 100644
--- a/regression-tests.api/test_Zones.py
+++ b/regression-tests.api/test_Zones.py
@@ -124,6 +124,21 @@ class AuthZones(ApiTestCase, AuthZonesHelperMixin):
self.assertGreater(soa_serial, payload['serial'])
self.assertEquals(soa_serial, data['serial'])
+ def test_create_zone_serial_in_list(self):
+ name, payload, data = self.create_zone()
+
+ r = self.session.get(self.url("/api/v1/servers/localhost/zones"))
+ self.assert_success_json(r)
+ domains = r.json()
+ myzone = [domain for domain in domains if domain['name'] == name]
+ self.assertEquals(len(myzone), 1)
+ myzone = myzone[0]
+ print "myzone:", myzone
+ self.assertGreater(myzone['serial'], 0)
+ self.assertEqual(data['serial'], myzone['serial'])
+
def test_create_zone_with_account(self):
# soa_edit_api wins over serial
name, payload, data = self.create_zone(account='anaccount', serial=10)
I'm running it inside an Ubuntu 16.04 Docker container using the following command line copied from the systemd config:
/usr/sbin/pdns_server --guardian=no --daemon=no --disable-syslog --write-pid=no
The serial in the list is always zero for me, no matter if:
The sqlite3 backend config is the default one included in the docs, copied into /etc/powerdns/pdns.d/:
launch+=gsqlite3
gsqlite3-database=/var/lib/powerdns/pdns.sqlite3
gsqlite3-dnssec=on
The database was created like this:
sqlite3 /var/lib/powerdns/pdns.sqlite3 < /usr/share/doc/pdns-backend-sqlite3/schema.sqlite3.sql
chown -R pdns.pdns /var/lib/powerdns/
Switched to the master build APT repository and the problem persists (used version 1200gb4d889f).
Output of the gsqlite3-get-all-domains-query presumably used here:
# sqlite3 /var/lib/powerdns/pdns.sqlite3
SQLite version 3.11.0 2016-02-15 17:29:24
sqlite> select domains.id, domains.name, records.content, domains.type, domains.master, domains.notified_serial, domains.last_check, domains.account from domains LEFT JOIN records ON records.domain_id=domains.id AND records.type='SOA' AND records.name=domains.name WHERE records.disabled=0;
1|example.com|a.misconfigured.powerdns.server hostmaster.example.com 2016081701 10800 3600 604800 3600|NATIVE||||
2|example.org|a.misconfigured.powerdns.server hostmaster.example.org 2016081704 10800 3600 604800 3600|NATIVE||||
3|a.example|a.misconfigured.powerdns.server hostmaster.a.example 2016081801 10800 3600 604800 3600|NATIVE||||
JFTR, I could not reproduce this locally, but couldn't try it on Ubuntu.
I've now reproduced this (thanks to @wojas for more details), and the problem goes away the moment I disable bindbackend.
Bindbackend config:
launch+=bind
bind-config=/etc/powerdns/bindbackend.conf
Where /etc/powerdns/bindbackend.conf is an empty file.
Fixed in #4650
Most helpful comment
I've now reproduced this (thanks to @wojas for more details), and the problem goes away the moment I disable bindbackend.
Bindbackend config:
Where
/etc/powerdns/bindbackend.confis an empty file.