Skip to content
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

[dev.icinga.com #10770] Status code 200 even if an object could not be deleted. #3745

Closed
icinga-migration opened this issue Dec 3, 2015 · 5 comments
Labels
area/api REST API bug Something isn't working
Milestone

Comments

@icinga-migration
Copy link

This issue has been migrated from Redmine: https://dev.icinga.com/issues/10770

Created by rjunich on 2015-12-03 18:24:04 +00:00

Assignee: jflach
Status: Resolved (closed on 2016-03-01 16:25:04 +00:00)
Target Version: 2.4.4
Last Update: 2016-03-11 15:00:02 +00:00 (in Redmine)

Icinga Version: 2.4.1
Backport?: Already backported
Include in Changelog: 1

When trying to delete an object on which others depend without cascade=1, the returned status code is 200. The returned JSON however contains the code 500 and the error message "Object cannot be deleted because other objects depend on it. Use cascading delete to delete it anyway."

The status code should be changed to something different than 200 to indicate that the request was not successful.

Changesets

2016-03-01 15:53:52 +00:00 by jflach 9cdea73

Fix delete object handler returning incorrect status codes

Now a 200 OK only gets returned if all objects could be deleted

fixes #10770

2016-03-11 14:59:52 +00:00 by jflach 4cf33b7

Fix delete object handler returning incorrect status codes

Now a 200 OK only gets returned if all objects could be deleted

fixes #10770
@icinga-migration
Copy link
Author

Updated by mfriedrich on 2016-02-24 21:15:59 +00:00

  • Status changed from New to Assigned
  • Assigned to set to jflach

@jean-marcel

Please evaluate a possible fix for this.

@icinga-migration
Copy link
Author

Updated by jflach on 2016-02-26 14:26:56 +00:00

Currently we iterate over all objects matching the filter and try to delete them. For every successful deletion we add a 200 to the json return body and for every failure we add a 500.
The code of the http response is 200 regardless of the result of the deletions.

Now we can and should send a 500 (or maybe even a 409) when all of the deletes fail. But what should we send when there are successful and failed deletions?

@icinga-migration
Copy link
Author

Updated by jflach on 2016-03-01 16:25:04 +00:00

  • Status changed from Assigned to Resolved
  • Done % changed from 0 to 100

Applied in changeset 9cdea73.

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2016-03-11 14:21:52 +00:00

  • Target Version set to 2.4.4

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2016-03-11 15:00:02 +00:00

  • Backport? changed from Not yet backported to Already backported

@icinga-migration icinga-migration added bug Something isn't working area/api REST API labels Jan 17, 2017
@icinga-migration icinga-migration added this to the 2.4.4 milestone Jan 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api REST API bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant