Skip to content

HTTP not found on Alert Obj #8

@rrajeevan

Description

@rrajeevan

I faced this in the alert object but I suspect it occurs across all objects.

Issue: Per documentation, the check to see if alert exists only works if the alert exists.
If it doesn't, it throws httplib.NOT_FOUND(404) exception from here. Traceback below.

All actions including Alert creation/modification should be idempotent. So DELETE and PUT is the way to go. We just need a better mechanism for handling the error.
May be instead of raise, just catch the exception and gently let the calling function know? Thoughts?

Exception:

Traceback (most recent call last):
  File "alert.py", line 32, in <module>
    alertobj = argus.alerts.get_user_alert(user, alert_name, shared=False)
  File "client.py", line 473, in get_user_alert
    alerts = self.argus._request("get", "alerts/meta", params=dict(alertname=alertName, ownername=ownerName, shared=shared))
  File "client.py", line 555, in with_retry
    return f(*args, **kwargs)
  File "client.py", line 588, in with_auth_token
    return f(*args, **kwargs)
  File "client.py", line 708, in _request
    return self._request_no_auth(method, path, params, dataObj, encCls, decCls)
  File "client.py", line 730, in _request_no_auth
    res = check_success(resp, decCls)
  File "client.py", line 744, in check_success
    raise ArgusException("Object not found at endpoint: %s message: %s" % (resp.request.url, resp.text))
argusclient.client.ArgusException: Object not found at endpoint: 
https://<argus_url>/argusws/alerts/meta?shared=False&ownername=<owner_name>&alertname=<alert_name> 
message: {"status":404,"message":"Not Found"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions