sensu / sensu-go-chef

Chef Library Cookbook for Sensu Go
https://sensu.io
MIT License
11 stars 22 forks source link

sensu-backend :init resource should have a returns #82

Closed tarcinil closed 4 years ago

tarcinil commented 4 years ago

This is based on a discussion from the sensu-go repo.

Chef Version

Chef 14

Input

Code: https://github.com/sensu/sensu-go-chef/blob/master/resources/backend.rb#L76

Discussion about sensu-backend init in https://github.com/sensu/sensu-go/issues/3511

Output

I would recommend allowed returns [0,3] on this resource.

Impact

The resource will stop failing chef runs with an exit code of 3.

Expected Behavior

It should have succeed.

Actual Behavior

It should have failed, because of how sensu-go sends an exit code when the backend in already initialized.

Steps to Reproduce your problem

derekgroh commented 4 years ago

The :init action on the resource is an execute which supports the returns option.

Could you test this by adding returns [0,3] to line 79 of https://github.com/sensu/sensu-go-chef/blob/master/resources/backend.rb and let us know if it solves the error you are seeing?

tarcinil commented 4 years ago

I don't use your cookbook and I have my own where we enforce idempotency. I can confirm that it resolves the issue in mine.

I am contributing back the things that I have learned about creating my own sensu-go site cookbook.

derekgroh commented 4 years ago

Awesome, could you submit a PR to resolve this issue?