A zone import defaults to a ttl of zero (outside schema limits)

Bug #1586178 reported by Paul Glass
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Designate
Fix Released
Undecided
Dai Dang Van
Mitaka
Triaged
Undecided
Unassigned
Newton
Triaged
High
sonu

Bug Description

To reproduce, create a zone with no ttls specified:

    POST /v2/zones/tasks/imports HTTP/1.1
    Content-Type: text/dns
    Accept: application/json

    $ORIGIN wumbo.com.
    wumbo.com. IN SOA ns.wumbo.com. nsadmin.wumbo.com. 101 102 103 104 105
    wumbo.com. IN NS ns.wumbo.com.
    ns.wumbo.com. IN A 127.0.0.1

Designate assigns a ttl of zero to the zone:

    {
      "status": "ACTIVE",
      "name": "wumbo.com.",
      "id": "447c28b7-f117-4366-b017-11afc1bef7d9",
      "ttl": 0,
      ...
    }

This is outside of the allowed ttl boundaries, according to the schema: https://github.com/openstack/designate/blob/master/designate/objects/zone.py#L57-L63.

This is a problem because all updates to the zone will fail (provided the update does not rectify the ttl). For example,

Request:

    ## Patching the zone with an empty json object
    PATCH /v2/zones/447c28b7-f117-4366-b017-11afc1bef7d9 HTTP/1.1
    Content-Type: application/json
    Accept: application/json

    {}

Response:

    {
      "code": 400,
      "type": "invalid_object",
      "errors": {
        "errors": [
          {
            "path": [
              "ttl"
            ],
            "message": "0 is less than the minimum of 1",
            "validator": "minimum",
            "validator_value": 1
          }
        ]
      },
      "request_id": "req-7055407e-87b0-45c0-8540-8ed4101f066a"
    }

Tim Simmons (timsim)
Changed in designate:
status: New → Triaged
importance: Undecided → High
milestone: none → newton-2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to designate (master)

Fix proposed to branch: master
Review: https://review.openstack.org/464037

Changed in designate:
assignee: nobody → Graham Hayes (grahamhayes)
status: Triaged → In Progress
Changed in designate:
assignee: Graham Hayes (grahamhayes) → Hieu LE (hieulq)
Changed in designate:
assignee: Hieu LE (hieulq) → Nguyen Van Trung (trungnv)
Changed in designate:
assignee: Nguyen Van Trung (trungnv) → Dai Dang Van (daidv)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to designate (master)

Reviewed: https://review.openstack.org/464037
Committed: https://git.openstack.org/cgit/openstack/designate/commit/?id=5d9ae0ce395beedab34277b1836dae7181d5309e
Submitter: Jenkins
Branch: master

commit 5d9ae0ce395beedab34277b1836dae7181d5309e
Author: Graham Hayes <email address hidden>
Date: Thu May 11 12:15:23 2017 -0400

    Ensure TTL is not 0 for zone imports

    If zone imports have a ttl of 0 update
    the zone ttl to the min_ttl configured for
    the designate install

    Change-Id: Idec854997fa9b6ad5d6af29bf6935c069dcbc40a
    Closes-Bug: #1586178

Changed in designate:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/designate 5.0.0.0b3

This issue was fixed in the openstack/designate 5.0.0.0b3 development milestone.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.