Delete an outage through the REST API is not working

Description

This is related with the Customer Ticket 1080.

When trying to DELETE an outage using new sched-outages REST API, the system responds with the following error:

curl -v -X DELETE -u 'admin:admin' 'http:/localhost:8980/opennms/rest/sched-outages/r4'

DELETE /opennms/rest/sched-outages/r4 HTTP/1.1
Authorization: Basic YWRtaW46YWRwaXB0MQ==
User-Agent: curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5
OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
Host: 127.0.0.1:8980
Accept: /

< HTTP/1.1 400 Bad Request
< Content-Type: text/plain
< Transfer-Encoding: chunked
< Server: Jetty(7.5.1.v20110908)

  • Connection #0 to host 127.0.0.1 left intact

  • Closing connection #0
    Can't delete the scheduled outage r4 because, null

Here's poll-outages.xml before:

<?xml version="1.0" encoding="UTF-8"?>
<outages xmlns="http://xmlns.opennms.org/xsd/config/poller/outages">
<outage name="r4" type="specific">
<time begins="23-Feb-2012 11:00:00" ends="24-Feb-2012 11:25:00"/>
<node id="27"/>
</outage>
</outages>

And after:

<?xml version="1.0" encoding="UTF-8"?>
<outages xmlns="http://xmlns.opennms.org/xsd/config/poller/outages">
</outages>

The code does two things when deleting an outage:

  • It removes the outage from poll-outages.xml

  • It updates the configuration of the services to remove the reference to the outage in question.

The second part is failing ...

Acceptance / Success Criteria

None

Lucidchart Diagrams

Activity

Show:

Alejandro Galue February 23, 2012 at 8:50 AM

I've refactored the class ScheduledOutagesRestService to be more intelligent when returning errors to the user and also I've fixed the problem with the delete operation.

I've added JUnit tests for all related operation with PUT/DELETE of ScheduledOutagesRestService.

1.10 Revision 9f7d03293880eb0153a1b1f89a7931bb373c1b9e

Fixed

Details

Assignee

Reporter

Labels

Components

Fix versions

Affects versions

Priority

PagerDuty

Created February 23, 2012 at 8:42 AM
Updated January 27, 2017 at 4:21 PM
Resolved February 23, 2012 at 8:50 AM