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

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

Closed
Sudavar opened this issue Jul 29, 2023 · 7 comments
Closed

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

Sudavar opened this issue Jul 29, 2023 · 7 comments
Labels
bug issues that report a bug

Comments

@Sudavar
Copy link

Sudavar commented Jul 29, 2023

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

@Sudavar Sudavar added the bug issues that report a bug label Jul 29, 2023
@Sudavar Sudavar changed the title [Bug]: [Bug]: events ls cannot filter on entity.type Jul 30, 2023
@Sudavar Sudavar changed the title [Bug]: events ls cannot filter on entity.type [Bug]: 'events ls' sub-command cannot filter on entity.type Jul 30, 2023
@lgarber-akamai
Copy link
Contributor

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
Copy link
Author

Sudavar commented Aug 4, 2023

Great, thank you very much.

lgarber-akamai added a commit that referenced this issue Aug 9, 2023
## 📝 Description

This change alters the filter header generation logic to only use `+and`
when multiple attributes are being filtered on. This is a workaround to
limit the impact of inconsistencies between top-level and nested
filters.

Related to #500 

## ✔️ How to Test

```
make testunit
```

## 📷 Preview

**If applicable, include a screenshot or code snippet of this change.
Otherwise, please remove this section.**
@Sudavar
Copy link
Author

Sudavar commented Nov 28, 2023

Hello,

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

@zliang-akamai
Copy link
Member

zliang-akamai commented Dec 5, 2023

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
Copy link
Author

Sudavar commented Dec 5, 2023

@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
Copy link
Member

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.

@jriddle-linode
Copy link
Collaborator

After reviewing this issue with internal teams we have found it goes beyond CLI and is a API level issue, it is planned to be fixed with Linode API v5.

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

No branches or pull requests

4 participants