-
Notifications
You must be signed in to change notification settings - Fork 367
Closed
Description
Issue
Deleting orphaned routes in a space fails if the routes have a label
Steps to Reproduce
Deleting a route with a label works fine if done explicitly
$ cf create-route apps.internal --hostname foo
Creating route foo.apps.internal for org org-1 / space space-1 as admin...
Route foo.apps.internal has been created.
OK
$ cf set-label route foo.apps.internal foo=bar
Setting label(s) for route foo.apps.internal in org org-1 / space space-1 as admin...
OK
$ cf delete-route apps.internal --hostname foo
This action impacts all apps using this route.
Deleting this route will make apps unreachable via this route.
Really delete the route foo.apps.internal? [yN]: y
Deleting route foo.apps.internal...
OK
However if you use https://v3-apidocs.cloudfoundry.org/version/3.165.0/index.html#delete-unmapped-routes-for-a-space then you get the following error:
$ cf create-route apps.internal --hostname foo
Creating route foo.apps.internal for org org-1 / space space-1 as admin...
Route foo.apps.internal has been created.
OK
$ cf set-label route foo.apps.internal foo=bar
Setting label(s) for route foo.apps.internal in org org-1 / space space-1 as admin...
OK
cf delete-orphaned-routes
Really delete orphaned routes? [yN]: y
Deleting orphaned routes as admin...
Job (4ebb8e77-f0ad-4993-948b-ec1a185c37aa) failed: An unknown error occurred.
FAILED
And in the logs
"Request failed: 500: {\"error_code\"=>\"UnknownError\", \"description\"=>\"An unknown error occurred.\", \"code\"=>10001, \"test_mode_info\"=>{\"description\"=>\"Mysql2::Error: Cannot delete or update a parent row: a foreign key constraint fails (`ccdb`.`route_labels`, CONSTRAINT `fk_route_labels_resource_guid` FOREIGN KEY (`resource_guid`) REFERENCES `routes` (`guid`) ON DELETE RESTRICT ON UPDATE RESTRICT)\", \"error_code\"=>\"CF-ForeignKeyConstraintViolation\", \"backtrace\"=>[...
Expected
Labels on routes should not block deletion
Metadata
Metadata
Assignees
Labels
No labels