Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Important Statuses can be deleted and modified #6291

Closed
ocket8888 opened this issue Oct 15, 2021 · 1 comment · Fixed by #6817
Closed

Important Statuses can be deleted and modified #6291

ocket8888 opened this issue Oct 15, 2021 · 1 comment · Fixed by #6817
Assignees
Labels
bug something isn't working as intended low difficulty the estimated level of effort to resolve this issue is low medium impact impacts a significant portion of a CDN, or has the potential to do so Traffic Ops related to Traffic Ops

Comments

@ocket8888
Copy link
Contributor

This Bug Report affects these Traffic Control components:

  • Traffic Ops

Current behavior:

The Statuses named OFFLINE, ONLINE, REPORTED, PRE_PROD, and ADMIN_DOWN are handled specially by different parts of Traffic Control, and different parts of the code even go so far as to assume that OFFLINE, ONLINE, and REPORTED exist, but in fact there is no guarantee that any of the five exist at any given time.

That's because you can rename them (and less importantly change their descriptions):

GET /api/4.0/statuses?id=1 HTTP/1.1
Host: localhost:6443
Cookie: mojolicious=...
Content-Length: 0


HTTP/1.1 200 OK
Content-Type: application/json
Set-Cookie: mojolicious=...
Transfer-Encoding: chunked

{ "response": [{
	"description": "Server is Offline. Not active in any configuration.",
	"id": 1,
	"lastUpdated": "2021-10-14 08:04:39+00",
	"name": "OFFLINE"
}]}
PUT /api/3.0/statuses/1 HTTP/1.1
Cookie: mojolicious=...
Content-Length: 88
Content-Type: application/json

{"name": "Not OFFLINE anymore", "description": "an unhelpful or inaccurate description"}


HTTP/1.1 200 OK
Content-Type: application/json
Permissions-Policy: interest-cohort=()
Set-Cookie: mojolicious=...
Content-Length: 188

{
	"alerts": [
		{
			"text": "status was updated.",
			"level": "success"
		}
	],
	"response": {
		"description": "an unhelpful or inaccurate description",
		"id": 1,
		"lastUpdated": "2021-10-15 08:41:42+00",
		"name": "Not OFFLINE anymore"
	}
}

and even delete them:

DELETE /api/4.0/statuses/1 HTTP/1.1
Host: localhost:6443
Cookie: mojolicious=...
Content-Length: 0


HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked
Set-Cookie: mojolicious=...

{ "alerts": [{
	"text": "status was deleted.",
	"level": "success"
}]}

Expected behavior:

You shouldn't be able to get rid of things that we assume should exist. That means either disallowing those operations on certain of those objects, or disallowing those operations entirely. I've always been hopeful that we could do away with custom statuses, eliminating a server field, two endpoints, hundreds of lines of code, two database tables, and a lot of confusion and edge cases like this. However, that behavior is depended upon by many, so we can't get rid of it without at least an alternative (like the one proposed by #4819), so if nothing else we should ensure that all valid (i.e. only manipulated through the API) Traffic Ops server states contain the Statuses that ATC requires to function. At a minimum that would be REPORTED, but to avoid unexpected behavior when creating new Statuses with reserved names we should also do the same with the others mentioned above.

@ocket8888 ocket8888 added bug something isn't working as intended Traffic Ops related to Traffic Ops medium impact impacts a significant portion of a CDN, or has the potential to do so labels Oct 15, 2021
@ocket8888
Copy link
Contributor Author

Also afaik these Statuses and their meanings aren't documented anywhere, which ought to change

@ocket8888 ocket8888 added the low difficulty the estimated level of effort to resolve this issue is low label Dec 1, 2021
@srijeet0406 srijeet0406 self-assigned this May 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something isn't working as intended low difficulty the estimated level of effort to resolve this issue is low medium impact impacts a significant portion of a CDN, or has the potential to do so Traffic Ops related to Traffic Ops
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants