Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.

Enables the use of offline reason for all "offline" statuses (those that are not ONLINE/REPORTED) and makes it optional#7042

Draft
mitchell852 wants to merge 2 commits intoapache:masterfrom
mitchell852:offline-status
Draft

Enables the use of offline reason for all "offline" statuses (those that are not ONLINE/REPORTED) and makes it optional#7042
mitchell852 wants to merge 2 commits intoapache:masterfrom
mitchell852:offline-status

Conversation

@mitchell852
Copy link
Copy Markdown
Member

@mitchell852 mitchell852 commented Aug 29, 2022

This change treats any status that is not ONLINE/REPORTED as "offline" and therefore the offline reason is available for use.


Which Traffic Control components are affected by this PR?

  • Traffic Ops
  • Traffic Portal

What is the best way to verify this PR?

If this is a bugfix, which Traffic Control versions contained the bug?

PR submission checklist

@mitchell852 mitchell852 added Traffic Ops related to Traffic Ops Traffic Portal v1 related to Traffic Portal version 1 labels Aug 29, 2022

if *status.Name == tc.CacheStatusAdminDown.String() || *status.Name == tc.CacheStatusOffline.String() {
if *status.Name != tc.CacheStatusOnline.String() && *status.Name != tc.CacheStatusReported.String() {
if reqObj.OfflineReason == nil {
Copy link
Copy Markdown
Member Author

@mitchell852 mitchell852 Aug 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this actually makes offline reason required for a bunch of statuses (anything that is not online/reported) so if this is considered a breaking api change, i will just hold off until api 5.x....or, the offline reason requirement could simply be removed and always optional if not online/reported.

@mitchell852 mitchell852 added the improvement The functionality exists but it could be improved in some way. label Aug 31, 2022
@mitchell852 mitchell852 changed the title Enables the use of "offline reason" for all statuses not ONLINE/REPORTED Enables the use of offline reason for all "offline" statuses (those that are not ONLINE/REPORTED) Aug 31, 2022
}

if *status.Name == tc.CacheStatusAdminDown.String() || *status.Name == tc.CacheStatusOffline.String() {
if *status.Name != tc.CacheStatusOnline.String() && *status.Name != tc.CacheStatusReported.String() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if I make a server have the status ONLINE1 or ONLINE_BUT_NOT_IN_SERVICE I then have to enter a reason why my ostensibly online server is offline?

Copy link
Copy Markdown
Member Author

@mitchell852 mitchell852 Aug 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, unless we made "offline reason" always optional (never required as it is now) which makes more sense to me anyhow

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ONLINE1 or ONLINE_BUT_NOT_IN_SERVICE is not considered "online" from TC's perspective :)

Copy link
Copy Markdown
Member Author

@mitchell852 mitchell852 Aug 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well i guess it could be for some servers :) i.e. TP or TO where status has no impact and is purely informational

Copy link
Copy Markdown
Contributor

@ocket8888 ocket8888 Aug 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Server statuses should not be mutable. It's one of a million places where we hijacked a concept to provide arbitrary informative tagging, which is better provided by actual tags. As it is, there's no guarantee that a status with any given name exists, or that a status with any given ID won't be renamed arbitrarily at any moment. Doing these kinds of checks becomes a lot easier once we can say what the actual values are and should mean.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, i get it but that ship has sailed (the immutable part), we already have many "offline" status types in production (i.e. TEST, PRE_PROD, DECOM, etc) that are all "offline" yet you can't add an offline reason to them.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That can be retconned:

  1. Implement tags
  2. Migrate existing, unrecognized statuses to tags
  3. Apply those tags on the servers that use those statuses
  4. Convert all unknown statuses to "OFFLINE"
  5. Eliminate the concept of a "Status" as an ATC object, use constant strings only.

@mitchell852 mitchell852 changed the title Enables the use of offline reason for all "offline" statuses (those that are not ONLINE/REPORTED) Enables the use of offline reason for all "offline" statuses (those that are not ONLINE/REPORTED) and makes it optional Aug 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

improvement The functionality exists but it could be improved in some way. Traffic Ops related to Traffic Ops Traffic Portal v1 related to Traffic Portal version 1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants