leapp icon indicating copy to clipboard operation
leapp copied to clipboard

Leapp CLI multiple filters broken

Open Pat-Ayres opened this issue 2 years ago • 1 comments

Describe the bug Using multiple filters with Leapp CLI commands e.g. leapp session list --filter="Foo=Foo" --filter="Bar=Bar"... should apply all filters to the search. This does not work on the latest version of the cli for me. Instead it only uses the query of the final --filter param.

In my case, we have the AWS SSO Integration turned on which creates sessions with non-unique names if you have mutliple sso roles for an AWS account. In order to pick the correct session, I have tried filtering on the session name and role in combination. However, instead of using both filters, it only uses the last filter and I get either all of the Sessions with the shared session name or all of the sessions using the same Role name depending on how I order the filters.

leapp session list --filter="Session Name=example" --filter="Role=reader"

Leapp Version

@noovolari/leapp-cli/0.1.49 darwin-arm64 node-v20.9.0

To Reproduce Steps to reproduce the behavior:

  1. set up multiple leapp sessions with the same name and different roles
  2. try to list sessions using multiple filters
  3. observe multiple results are returned based only on the final filter

Expected behavior Based on this comment I expected that using multiple filters in this way would apply all filters and correctly return only a single session, given enough filters to provide a unique query.

Desktop (please complete the following information):

  • OS: MacOS
  • OS Version 13.6
  • Leapp Version 0.22.2

Pat-Ayres avatar Dec 11 '23 19:12 Pat-Ayres

@Pat-Ayres thanks for reporting! We haven't conceived the --filter flag to accept multiple criteria, thus you can filter a single property per command. Therefore, this issue should be considered as an enhancement, as the --filter flag works as expected with a single criteria. To make the CLI accept multiple filter criteria, we should intervene at the Oclif level, in particular when the flag parsing logic happens

ericvilla avatar Feb 15 '24 10:02 ericvilla