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

--filters with --max-results inconsistent #193

Open
wmendes-ionos opened this issue Sep 7, 2022 · 1 comment
Open

--filters with --max-results inconsistent #193

wmendes-ionos opened this issue Sep 7, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@wmendes-ionos
Copy link

Description

When I use --filters with --max-results I have inconsistent response.

Expected behavior

Using --max-results consistently return records.

Environment

Production, admin contract and dev contract.

Go Version:

1.19

Ionosctl version:

IONOS Cloud CLI version: DEV
SDK GO version: 6.1.0
SDK GO DBaaS Postgres version: v1.0.3
SDK GO Auth version: 1.0.4

OS:

macos Darwin

Shell:

zsh

Configuration Files

How to Reproduce

You can use the dev contract for a test. redacted the id for security reasons.

me@~$ ionosctl datacenter list --no-headers --filters name=webner --depth 1 --max-results 1 --cols DatacenterId
<returned id>
me@~$ ionosctl datacenter list --no-headers --filters name=webner --depth 1 --max-results 1 --cols DatacenterId
me@~$ ionosctl datacenter list --no-headers --filters name=webner --depth 1 --max-results 1 --cols DatacenterId
me@~$ ionosctl datacenter list --no-headers --filters name=webner --depth 1 --max-results 1 --cols DatacenterId
<returned id>
me@~$ ionosctl datacenter list --no-headers --filters name=webner --depth 1 --max-results 1 --cols DatacenterId
me@~$ ionosctl datacenter list --no-headers --filters name=webner --depth 1 --max-results 1 --cols DatacenterId
me@~$ ionosctl datacenter list --no-headers --filters name=webner --depth 1 --max-results 1 --cols DatacenterId
me@~$ ionosctl datacenter list --no-headers --filters name=webner --depth 1 --max-results 1 --cols DatacenterId
<returned id>
me@~$ ionosctl datacenter list --no-headers --filters name=webner --depth 1 --max-results 1 --cols DatacenterId
me@~$ ionosctl datacenter list --no-headers --filters name=webner --depth 1 --max-results 1 --cols DatacenterId
<returned id>
me@~$ ionosctl datacenter list --no-headers --filters name=webner --depth 1 --max-results 1 --cols DatacenterId
<returned id>

Removing the flag resolves for the first call, usually

me@~$ ionosctl datacenter list --no-headers --filters name=webner --depth 1 --max-results 1 --cols DatacenterId
me@~$ ionosctl datacenter list --no-headers --filters name=webner --depth 1 --max-results 1 --cols DatacenterId
me@~$ ionosctl datacenter list --no-headers --filters name=webner --depth 1 --max-results 1 --cols DatacenterId
me@~$ ionosctl datacenter list --no-headers --filters name=webner --depth 1 --max-results 1 --cols DatacenterId
me@~$ ionosctl datacenter list --no-headers --filters name=webner --depth 1 --max-results 2 --cols DatacenterId
me@~$ ionosctl datacenter list --no-headers --filters name=webner --depth 1  --cols DatacenterId
<returned id>
<returned id>
me@~$ ionosctl datacenter list --no-headers --filters name=webner --depth 1 --max-results 1 --cols DatacenterId
<returned id>
me@~$ ionosctl datacenter list --no-headers --filters name=webner --depth 1 --max-results 1 --cols DatacenterId
me@~$ ionosctl datacenter list --no-headers --filters name=webner --depth 1 --max-results 1 --cols DatacenterId
<returned id>
me@~$ ionosctl datacenter list --no-headers --filters name=webner --depth 1 --max-results 1 --cols DatacenterId
<returned id>
me@~$ ionosctl datacenter list --no-headers --filters name=webner --depth 1 --max-results 1 --cols DatacenterId
me@~$ ionosctl datacenter list --no-headers --filters name=webner --depth 1 --max-results 1 --cols DatacenterId
me@~$ ionosctl datacenter list --no-headers --filters name=webner --depth 1 --max-results 1 --cols DatacenterId

Error and Debug Output

No errors, just empty response.

Additional Notes

References

@wmendes-ionos wmendes-ionos added the bug Something isn't working label Sep 7, 2022
@avirtopeanu-ionos
Copy link
Contributor

Hi, sorry for the late reply. Unfortunately this bug is due to how the API handles the max results query param. A pagination rework will happen on the CLI side, although I don't have a timeline for that.

In the meantime you should pipe the output to sed -n '[row]p' or head -n [rows] and tail -n [rows] to select the first/last n rows

i.e. ionosctl [command] -F FIRST_FILTER -F SECOND_FILTER --no-headers | sed -n '1p'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants