mitchell852 edited a comment on pull request #4881:
URL: https://github.com/apache/trafficcontrol/pull/4881#issuecomment-661321717
> Noticing an issue in the following case:
>
> 1.) Create a server
> 2.) Change the host name
> 3.) The xmpp_id doesn't change -> so far it looks great
> 4.) Do a PUT to change the server's xmpp ID with a json payload that has a
different xmpp ID than the one in the database
> 5.) The Change doesn't take place in the DB (which is the expected
behavior), however, we get back a message saying that the server was updated
with the new xmpp ID. This is what the response looks like:
>
> `{"alerts":[{"text":"Server
updated","level":"success"}],"response":{"cachegroup":"edgeserver","cachegroupId":2,"cdnId":1,"cdnName":"ALL","domainName":"rima2","guid":null,"hostName":"rimatest2","httpsPort":443,"id":10,"iloIpAddress":null,"iloIpGateway":null,"iloIpNetmask":null,"iloPassword":null,"iloUsername":null,"lastUpdated":"2020-07-17
14:51:47-06","mgmtIpAddress":null,"mgmtIpGateway":null,"mgmtIpNetmask":null,"offlineReason":null,"physLocation":"phys2","physLocationId":2,"profile":"TRAFFIC_OPS","profileDesc":"Traffic
Ops
profile","profileId":3,"rack":null,"revalPending":false,"routerHostName":null,"routerPortName":null,"status":"ONLINE","statusId":2,"tcpPort":80,"type":"EDGE","typeId":11,"updPending":false,"xmppId":"5fa51f60-6606-4c9d-8b60-2d78f96018zf","xmppPasswd":null,"interfaces":[{"ipAddresses":[{"address":"192.23.27.67","gateway":"255.255.245.0","serviceAddress":true},{"address":"123.45.67.89","gateway":"255.255.255.0","serviceAddress":false}],"maxBandwidth":5,"monito
r":false,"mtu":1500,"name":"rima-interface"}]}}`
>
> The xmpp ID before this update was `5fa51f60-6606-4c9d-8b60-2d78f96018ae`
in the database.
> This remains the same even after the `PUT` (which is what we want),
however, notice how the response says that the server was updated with the new
xmpp ID of `5fa51f60-6606-4c9d-8b60-2d78f96018zf`. We do not want this. The
user should be notified that the `server couldn't be updated because change of
xmpp_id is not allowed`, or something to that effect.
I'm wondering if rather than simply ignoring the xmppId in the update query
(which I believe is what it is doing) maybe it makes sense to return a 400 bad
request if request.xmppId does not equal the xmpp_id found in the database for
that server. i.e. if the user is trying to update xmppId, return 400 bad
request with an alert of type error with a message like "xmppId cannot be
changed".
@ocket8888 - what do you think? xmppId is now immutable. if the user tries
to change it on PUT which of the following should happen?
- 400 bad request with error alert along the lines of xmppId is immutable or
- simply ignore the xmppId in the update query and continue w/ the update?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]