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

'sensu.client_delete' fails if client was already deleted #3

Open
arm4b opened this issue Jun 7, 2017 · 1 comment
Open

'sensu.client_delete' fails if client was already deleted #3

arm4b opened this issue Jun 7, 2017 · 1 comment
Labels

Comments

@arm4b
Copy link
Member

arm4b commented Jun 7, 2017

The error

# st2 run sensu.client_delete client=st2-pkg-unstable-u14-ent-d01ba3d6c8.uswest2

.
id: 59372a4badf59216541c7566
status: failed
parameters: 
  client: st2-pkg-unstable-u14-ent-d01ba3d6c8.uswest2
result: 
  exit_code: 1
  result: None
  stderr: "No handlers could be found for logger "pysensu.api"
Traceback (most recent call last):
  File "/opt/stackstorm/st2/local/lib/python2.7/site-packages/st2common/runners/python_action_wrapper.py", line 259, in <module>
    obj.run()
  File "/opt/stackstorm/st2/local/lib/python2.7/site-packages/st2common/runners/python_action_wrapper.py", line 155, in run
    output = action.run(**self._parameters)
  File "/opt/stackstorm/packs/sensu/actions/client_delete.py", line 10, in run
    return self.api.delete_client(client)
  File "/opt/stackstorm/virtualenvs/sensu/lib/python2.7/site-packages/pysensu/api.py", line 99, in delete_client
    self._request('DELETE', '/clients/{}'.format(client))
  File "/opt/stackstorm/virtualenvs/sensu/lib/python2.7/site-packages/pysensu/api.py", line 64, in _request
    raise SensuAPIException('API bad response')
pysensu.api.SensuAPIException: API bad response
"
  stdout: ''

Sensu API response is 404 and it happens when client we want to delete doesn't exist.
According to specification this is correct: https://sensuapp.org/docs/latest/api/clients-api.html#clientsclient-delete


We should try to catch the exception and return Success action execution result if client we want to delete is already deleted.

@LindsayHill
Copy link
Contributor

Ideally should use sangoma/pysensu#11, if it ever gets merged.

Otherwise we could maintain our own fork

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants