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

/v1/actions/add-comment: add param expiry #8035

Merged
merged 1 commit into from Dec 4, 2020

Conversation

Al2Klimov
Copy link
Member

fixes #4663

@yhabteab
Copy link
Member

yhabteab commented Jun 19, 2020

Testprotocol:
Well, until now you had to delete all the comments manually because Icinga2 was not able to delete them automatically because you couldn't enter an expiry date when you created a comment.

Command: curl -k -v -u root:icinga -H 'Accept: application/json' -X POST 'https://localhost:5665/v1/actions/add-comment' -d '{ "type": "Service", "filter": "service.name==\"ping6\"", "expiry": '$(perl -e 'print time + 30')', "author": "yonas", "comment": "Some comments here"}'

HTTP/1.1 500 Internal Server Error
Server: Icinga/v2.12.0-rc1-24-g5b7f7344d
Content-Type: application/json
Content-Length: 14

From now on you don't have to worry about these annoying comments yourself, because Icinga2 will take over for you and you only have to do one thing, namely when creating a comment don't forget to enter the expiry date.

HTTP/1.1 200 OK
Server: Icinga/v2.12.0-rc1-24-g5b7f7344d
Content-Type: application/json
Content-Length: 280

and if you look at Icinga log after the given expiry date you will get the following message..

[2020-06-19 13:32:42 +0200] information/ConfigObjectUtility: Deleted object 'example.domain!76d4612e-8b14-4c05-93a9-086387d27feb' of type 'Comment'.

v2.13.0 merge window automation moved this from To review to Done Jun 19, 2020
@Al2Klimov Al2Klimov moved this from Done to To review in v2.13.0 merge window Jun 19, 2020
v2.13.0 merge window automation moved this from To review to Approved Dec 4, 2020
@julianbrost julianbrost merged commit f2a532d into master Dec 4, 2020
v2.13.0 merge window automation moved this from Approved to Merged Dec 4, 2020
@icinga-probot icinga-probot bot deleted the feature/expiry-date-comments-4663 branch December 4, 2020 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api REST API enhancement New feature or request
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

[dev.icinga.com #12825] Set expiry date on comments
3 participants