Minimum TTL value allowed is zero
According to ITEF https://tools.ietf.org/html/rfc2181#section-8
the definition of the ttl value is unsigned integer and can have a
minimum value of 0. This patch changes the minimum value of 1 to allow
for 0. Unit test have also been modified accordingly.
Closes-Bug: #1926429
Change-Id: I7876b4c1e2c800b654ca750211ee2e58f3ea4309
(cherry picked from commit 6ac659d241)
This commit is contained in:
@@ -31,7 +31,7 @@ class Zone(base.DesignateObject, base.DictObjectMixin,
|
||||
'tenant_id': fields.StringFields(nullable=True, read_only=False),
|
||||
'name': fields.DomainField(maxLength=255),
|
||||
'email': fields.EmailField(maxLength=255, nullable=True),
|
||||
'ttl': fields.IntegerFields(nullable=True, minimum=1,
|
||||
'ttl': fields.IntegerFields(nullable=True, minimum=0,
|
||||
maximum=2147483647),
|
||||
'refresh': fields.IntegerFields(nullable=True, minimum=0,
|
||||
maximum=2147483647, read_only=False),
|
||||
|
||||
@@ -139,8 +139,8 @@ class ApiV2ZonesTest(ApiV2TestCase):
|
||||
fixture = self.get_zone_fixture(fixture=0)
|
||||
fixture['ttl'] = 0
|
||||
body = fixture
|
||||
self._assert_exception('invalid_object', 400, self.client.post_json,
|
||||
'/zones', body)
|
||||
response = self.client.post_json('/zones', body)
|
||||
self.assertEqual(202, response.status_int)
|
||||
|
||||
def test_create_zone_ttl_is_greater_than_max(self):
|
||||
fixture = self.get_zone_fixture(fixture=0)
|
||||
|
||||
@@ -715,18 +715,18 @@ class CentralServiceTest(CentralTestCase):
|
||||
self.policy({'use_low_ttl': '!'})
|
||||
self.config(min_ttl=100,
|
||||
group='service:central')
|
||||
context = self.get_context()
|
||||
context = self.get_context(project_id=1)
|
||||
|
||||
values = self.get_zone_fixture(fixture=1)
|
||||
values['ttl'] = 0
|
||||
values['ttl'] = 5
|
||||
|
||||
with testtools.ExpectedException(ValueError):
|
||||
with testtools.ExpectedException(exceptions.InvalidTTL):
|
||||
self.central_service.create_zone(
|
||||
context, objects.Zone.from_dict(values))
|
||||
|
||||
def test_create_zone_below_zero_ttl(self):
|
||||
self.policy({'use_low_ttl': '!'})
|
||||
self.config(min_ttl=1,
|
||||
self.config(min_ttl=0,
|
||||
group='service:central')
|
||||
context = self.get_context()
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Allows for a minimum TTL value of zero to be used instead of 1. As stated
|
||||
in RFC https://datatracker.ietf.org/doc/html/rfc2181#section-8.
|
||||
|
||||
.. _bug 1926429: https://bugs.launchpad.net/designate/+bug/1926429
|
||||
|
||||
Reference in New Issue
Block a user