-
Notifications
You must be signed in to change notification settings - Fork 339
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
Added the ability to change a server capability name #5605
Conversation
Added DB migration script for cascading PK to other associated tables.
traffic_ops/app/db/migrations/2021030300000000_server_capability_update_cascade.sql
Show resolved
Hide resolved
traffic_ops/app/db/migrations/2021030300000000_server_capability_update_cascade.sql
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TP code looks good!
I don't understand the |
Yes, so server_capability API uses CRUDer function. In CRUD Update, there is a function (SetKeys) that basically sets the name field (primary key) to that of the param key value. Due to which, we lose the new name (RequestedName) that the user is trying to change to. To ensure, we don't lose the new name and at the same time ensure CRUDer functionality says un-impacted, this new variable was introduced. |
Not that I think you need to/should do so in this PR, but this is something that would motivate me to rewrite the endpoint to not use the "CRUDer" |
IMO, we should get rid of all CRUDer functionality. This PR is a good example of how we end up applying a bandaid to not impact existing functionality |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good. API/ unit tests passed. Verified manually that I could change the server capability name from the UI and the API. LGTM.
I would love that. It's just hard to justify the time it would take to yank all of that stuff out. |
What does this PR (Pull Request) do?
Which Traffic Control components are affected by this PR?
What is the best way to verify this PR?
Method 1: curl PUT API end point `api/4.0/server_capabilities?name=<server_capability_name>
Method 2: Using TP's page for server capability to edit(update) the name and verify name was updated with right message
Method 3: Run TP's end to end test.
Method 4: Run TO's API-v4 test casse
If this is a bug fix, what versions of Traffic Control are affected?
The following criteria are ALL met by this PR
Additional Information