ZettaIO / cachet-client

A python 3.6+ client for the Cachet API : https://cachet-client.readthedocs.io/
MIT License
14 stars 8 forks source link

Component tag is not case-sensitive #17

Closed chanpl closed 3 years ago

chanpl commented 4 years ago

Hi,

I created a component with tags, it seems all tags are converted to lowercase. Can we support case-sensitive tag?

>>> cli.components.create(name="test1", status=1, tags="TAG1,Tag2,tag3")
{'order': 0, 'group_id': 0, 'description': '', 'link': '', 'enabled': True, 'meta': None, 'name': 'test1', 'status': 1, 'updated_at': '2020-07-19 14:31:57', 'created_at': '2020-07-19 14:31:57', 'id': 3574, 'status_name': 'Operational', 'tags': {'tag1': 'TAG1', 'tag2': 'Tag2', 'tag3': 'tag3'}}
>>> cli.components.get(3574)
{'id': 3574, 'name': 'test1', 'description': '', 'link': '', 'status': 1, 'order': 0, 'group_id': 0, 'created_at': '2020-07-19 14:31:57', 'updated_at': '2020-07-19 14:31:57', 'deleted_at': None, 'enabled': True, 'meta': None, 'status_name': 'Operational', 'tags': {'tag1': 'TAG1', 'tag2': 'Tag2', 'tag3': 'tag3'}}
>>> cli.components.get(3574).tags
{'tag3', 'tag2', 'tag1'}
>>> cli.components.get(3574).has_tag("TAG1")
False
>>> cli.components.get(3574).has_tag("tag1")
True
>>>

Thanks.

einarf commented 4 years ago

As far as I know tags are unique (lower case). has_tag should probably ignore case. It's definitely a bit that the tag name is converted to lower case. The tag key is the unique id and the tag value is the display name.

Does this sound reasonable?

chanpl commented 4 years ago

Thanks, I am fine if this is a behavior in Cachet.

einarf commented 4 years ago

I still want to make some improvements for this, so re-opening as a reminder.

einarf commented 3 years ago

Think I will look at this for 3.1.1 as I'm wrapping up a few more smaller things. Right now the most important thing was to get schedules support out.

einarf commented 3 years ago

4.0.x is now released with improved tag support