apache / trafficcontrol

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

DS creation - behaviour should be consistent when an associated field is deleted before DSR fulfillment #3723

Open lbathina opened 5 years ago

lbathina commented 5 years ago

Scenario1:

  1. Create a new Type for Delivery Service
  2. Create a new DS choosing the type created in step1, submit it for DSR
  3. delete the type created in step1 while the request is pending in DSR
  4. go to DSR and click on fulfill (assign it to yourself first) Expected: some kind of error that type doesn't exist Actual: Nothing happened!!!

On discussion with team it seem to be a static type that user is not supposed to create. In such case, the appropriate thing would be to restrict creation of types only to allowed ones.

Scenario2:

  1. create a DS_Profile
  2. Create a DS , choose DS_Profile created in step 1, submit for DSR
  3. click on fullfil page that DS_Profile is reflected, It is. Do not change anything. Go to step4
  4. delete the DS_Profile created in step1 , while the DSR is still pending
  5. click on fullfil page that DS_Profile is reflected Expected: Some kind of error that associated DS_Profile doesn't exist should be displayed Actual: DS_Profile is unassociated from the DS and no notification/message is displayed. Able to fullfil the DSR
mitchell852 commented 5 years ago

For scenario 1 these are the delivery service types:

image

and although TP and the TO api allows you to create new delivery service types, you really shouldn't because without other code changes, your new "type" will have no effect. These types are static in nature.

Can you check in the browser's dev console to ensure that an error isn't being returned and maybe the UI is simply failing to display it because fulfilling a ds without a type (because you deleted it) should DEFINITELY return an error.

^^ really, an issue here (in addition to the missing error message) is that TP/TO API should not let you create/edit/delete "static" types. On the other hand, creating/editing/deleting "dynamic" types is mostly OK. i.e. creating EDGE_FOO or MID_FOO is fine because creating anything that starts with EDGE or MID are the only 2 types that you can create dynamically. i'll created an issue for that - #3728

mitchell852 commented 5 years ago

@lbathina - i tried scenario 1 -

  1. created a DNS_FOO type
  2. created a new DS of type=DNS_FOO (which created a ds request)
  3. deleted DNS_FOO

and when i try to fulfill the ds request, i'm getting this error in the browser's dev console:

TypeError: Cannot read property 'name' of undefined at TableDeliveryServiceRequestsController.js:254

https://github.com/apache/trafficcontrol/blob/master/traffic_portal/app/src/common/modules/table/deliveryServiceRequests/TableDeliveryServiceRequestsController.js#L254

that is why "nothing" is happening. the error is preventing the UI from navigating to the fulfill page but the error is silent. I'll get a PR in for this.

mitchell852 commented 5 years ago

re: scenario 2.

  1. created an AAA DS_profile
  2. created a DS with profile=AAA (which created a ds request)
  3. deleted AAA profile
  4. checked ds request and profile is now blank

the real problem here is that the system should have never allowed you to delete a profile (AAA) that is associated with something. in this case the AAA is associated with an active ds request. the issue is really that you should not be able to delete any of these things (type, profile, cdn, tenant) if they are attached to an active (state=draft or submitted) ds request.

lbathina commented 5 years ago

Sure. Will spin a new ticket for #2

lbathina commented 5 years ago

Scenario 1 -> tracked in https://github.com/apache/trafficcontrol/issues/3728 this ticket for scenario 2