linode / linode-cli

The official Linode command line interface.
https://linode.com
BSD 3-Clause "New" or "Revised" License
369 stars 130 forks source link

[Bug]: 'events ls' sub-command cannot filter on entity.type #500

Open Sudavar opened 11 months ago

Sudavar commented 11 months ago

CLI Version

linode-cli 5.41.3 Built off spec version 4.159.0

Command

linode-cli events ls --entity.type linode

Output

Request failed: 400
                  errors                   
┌──────────┬──────────────────────────────┐
│ field    │ reason                       │
├──────────┼──────────────────────────────┤
│ X-Filter │ Cannot filter on entity.type │
└──────────┴──────────────────────────────┘

Expected Behavior

List of events based on the type (linode in this case/example). This works in version linode-cli 5.41.2 Built off spec version 4.157.1 like a charm:

┌───────────┬────────────┬──────────────────────┬───────────────────┬─────────────────────┬──────────┬──────────────┬─────────┐
│ id        │ username   │ action               │ label             │ created             │ duration │ status       │ message │
├───────────┼────────────┼──────────────────────┼───────────────────┼─────────────────────┼──────────┼──────────────┼─────────┤
│ XXXXXXXXX │ user       │ linode_shutdown      │ TEST              │ 2023-07-29T20:32:03 │ 8.0      │ finished     │         │

Actual Behavior

API rejects saying Cannot filter on entity.type

Steps to Reproduce

Each time the events subcommand is invoked with --entity.type argument

lgarber-akamai commented 11 months ago

Thanks for the bug report!

This issue seems to have started occurring after we started using the +and operator when building the filter header. As a temporary workaround, we could consider using the +and operator only if multiple filters are defined.

I've reported this issue internally and will let you know when we have any updates to share 🙂

Sudavar commented 11 months ago

Great, thank you very much.

Sudavar commented 7 months ago

Hello,

do you have any information about when will this be released in an update?

zliang-akamai commented 7 months ago

Hi @Sudavar, I think the issue has been fixed in the latest version of Linode CLI. Can you still see similar issue on your end?

myusername@mylaptop ~ % linode --version
linode-cli 5.45.2
Built off spec version 4.167.3
myusername@mylaptop ~ % linode events ls --entity.type linode 
┌─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬────────┐
│ id      │ userna… │ action  │ entity… │ created │ durati… │ status  │ messa… │
├─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼────────┤
│ 605767… │ zliang… │ linode… │ tf_tes… │ 2023-1… │ 22.0    │ finish… │        │
│ 605767… │ zliang… │ linode… │ tf_tes… │ 2023-1… │ 17.0    │ finish… │        │
Sudavar commented 7 months ago

@zliang-akamai I actually want to filter based on entity.type and entity.id - I did test with the latest version and still get the error:

yury@host:~$ linode --version
linode-cli 5.45.2
Built off spec version 4.167.3

yury@host:~$ linode events ls --entity.type linode --entity.id XXXXXX
Request failed: 400
errors                                     
┌──────────┬──────────────────────────────┐
│ field    │ reason                       │
├──────────┼──────────────────────────────┤
│ X-Filter │ Cannot filter on entity.id   │
│ X-Filter │ Cannot filter on entity.type │
└──────────┴──────────────────────────────┘

This version however, does not throw error when filtering only based on entity.type linode

zliang-akamai commented 7 months ago

Hey @Sudavar, Thanks for the extra info! I checked with my team and there is still some work in progress on the back-end to make this fully fixed. We will let you know when there is an update available.