Skip to content

ValueError: 'TENANT_LIFECYCLE' is not a valid Category (also 'AGENT') #122

@JosephHobbs

Description

@JosephHobbs

Describe the bug
When pulling audit logs from Dynatrace via the API, an event with a Category of 'TENANT_LIFECYCLE' causes an exception to be thrown. This value is being returned by the SaaS tenant, but is not a value specified in the associated Enum.

To Reproduce
I'm not 100% sure how to trigger/cause a TENANT_LIFECYCLE event, but if you try to pull a set of audit logs that contain this event, the issue will occur.

Expected behavior
I would expect the API to accept and make available the value.

Screenshots

[ERROR] ValueError: 'TENANT_LIFECYCLE' is not a valid Category
Traceback (most recent call last):
  File "/var/task/collect_audit_events.py", line 39, in lambda_handler
    events = dt.audit_logs.list(
  File "/opt/python/dynatrace/environment_v2/audit_logs.py", line 41, in list
    return PaginatedList(
  File "/opt/python/dynatrace/pagination.py", line 37, in __init__
    self.__elements = self._get_next_page()
  File "/opt/python/dynatrace/pagination.py", line 68, in _get_next_page
    data = [self.__target_class(self.__http_client, response.headers, element) for element in elements]
  File "/opt/python/dynatrace/pagination.py", line 68, in <listcomp>
    data = [self.__target_class(self.__http_client, response.headers, element) for element in elements]
  File "/opt/python/dynatrace/dynatrace_object.py", line 35, in __init__
    self._create_from_raw_data(raw_element)
  File "/opt/python/dynatrace/environment_v2/audit_logs.py", line 89, in _create_from_raw_data
    self.category: Category = Category(raw_element.get("category"))
  File "/var/lang/lib/python3.10/enum.py", line 385, in __call__
    return cls.__new__(cls, value)
  File "/var/lang/lib/python3.10/enum.py", line 710, in __new__
    raise ve_exc

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions