Skip to content

Invalidation Type restricted message could be better #6340

@ocket8888

Description

@ocket8888

This Improvement request (usability, performance, tech debt, etc.) affects these Traffic Control components:

  • Traffic Ops

Current behavior:

When attempting to create a "REFETCH" Content Invalidation Job when no refetch_enabled Parameter exists (or is not set to a case-insensitive "true") yields the error:

{
	"alerts": [
		{
			"text": "InvalidationType is invalid",
			"level": "error"
		}
	]
}

Similarly, if you try to change the Invalidation Type of an existing Content Invalidation Job to "REFETCH" when it's disallowed, the message incorrectly reports that "REFRESH" is not allowed:

PUT /api/4.0/jobs?id=1 HTTP/1.1
User-Agent: python-requests/2.25.1
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
Cookie: mojolicious=...
Content-Length: 191

{
  "deliveryService": "demo1",
  "ttlHours": 72,
  "startTime": "2021-11-09T01:02:03Z",
  "assetUrl": "http://origin.infra.ciab.test/.+",
  "createdBy": "admin",
  "id": 1,
  "invalidationType": "REFETCH"
}

Response:

{
	"alerts": [
		{
			"text": "Invalidation Type REFRESH is disallowed",
			"level": "error"
		}
	]
}

New behavior:

Firstly, the field is called "invalidationType", not "InvalidationType" - but that's less important than that the value "REFETCH" is actually valid, just not allowed, and the error message doesn't give the user enough information to know what will cause the request to succeed.

Also, the response from a PUT request should not lie to the user.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Traffic Opsrelated to Traffic Opsbugsomething isn't working as intendedimprovementThe functionality exists but it could be improved in some way.low difficultythe estimated level of effort to resolve this issue is lowlow impactaffects only a small portion of a CDN, and cannot itself break one

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions