apache / trafficcontrol

Apache Traffic Control is an Open Source implementation of a Content Delivery Network
https://trafficcontrol.apache.org/
Apache License 2.0
1.03k stars 339 forks source link

Attempt to unlink parameter from DS profile incorrectly shows 0 servers affected #1642

Closed guzzijason closed 6 years ago

guzzijason commented 6 years ago

Attempting to unlink an MSO parameter from a profile gives misleading warning message that the parameter is used by 0 servers, which is not true. Servers in this case would be mid tier, which may be a factor in why TO is not corelating.

image

mitchell852 commented 6 years ago

@guzzijason - I think what this message is supposed to say is something like "The DS_col-jitp2 profile is used by X delivery service(s). Are you sure you want to remove the mso.algo parameter from this profile"

All profiles with the exception of "DS profiles" are intended to be attached to servers so I"m guessing I just did a query to see which servers were explicitly assigned to the DS_col-jitp2 and there are none (because this is a DS profile and not a server profile).

So, does that make sense if i just fix the message?

guzzijason commented 6 years ago

Yes, that seems like totally reasonable solution.

mitchell852 commented 6 years ago

Ok, I'm a bit confused. I just tried removing the mso.algorithm parameter from the DS_col-jitp2 profile and got this message instead:

image

The only explanation I can think of is that at one time, the type of the DS_col-jitp2 profile was not correctly set to "DS_PROFILE" hence you saw the "is used by 0 server(s)" message instead of the "is used by X delivery service(s) message...

Let me know if you still see this problem.

guzzijason commented 6 years ago

Hmm.... I still seem to get the used by 0 server(s) message for that one.

guzzijason commented 6 years ago

It seems the difference is how you access the parameter. If I go Profiles -> DS_col-jitp2 -> Parameters, I see the same message you get. If I go Parameters -> mso.algorithm then View Profiles and try to unlink there, the message changes.

mitchell852 commented 6 years ago

ok, i reproduced the error. thanks!

mitchell852 commented 6 years ago

the problem has to do with GET api/1.3/parameters/:id/profiles is not returning the profile type for each profile therefore this conditional always returns false:

https://github.com/apache/incubator-trafficcontrol/blob/master/traffic_portal/app/src/common/modules/table/parameterProfiles/TableParameterProfilesController.js#L40

I'll make sure GET api/1.3/parameters/:id/profiles returns the profile type so that conditional will work properly