Skip to content

Prefer reading query from stdin if available #1917

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

Merged
merged 13 commits into from
Nov 1, 2021

Conversation

dominiklohmann
Copy link
Member

@dominiklohmann dominiklohmann commented Oct 20, 2021

📔 Description

A recent change made it so not providing a query causes everything to be exported. However, that made it so providing a query on stdin required the option vast.export.read to be set to "-", which was far from intuitive. This change streamlines the option, giving the user an error if conflicting ways to read the query exist and preferring stdin over exporting everything if a query is provided on stdin but not on the command line.

📝 Checklist

  • All user-facing changes have changelog entries.
  • The changes are reflected on docs.tenzir.com/vast, if necessary.
  • The PR description contains instructions for the reviewer, if necessary.

🎯 Review Instructions

It's a simple change; reading the code and passing CI should suffice.

A recent change made it so not providing a query causes everything to be
exported. However, that made it so providing a query on stdin required
the option `vast.export.read` to be set to `"-"`, which was far from
intuitive. This change streamlines the option, giving the user an error
if conflicting ways to read the query exist and preferring stdin over
exporting everything if a query is provided on stdin but not on the
command line.
@dominiklohmann dominiklohmann force-pushed the story/ch29085/prefer-stdin-over-exporting-all branch from 158a663 to c5cec4f Compare October 20, 2021 12:26
@dominiklohmann dominiklohmann force-pushed the story/ch29085/prefer-stdin-over-exporting-all branch from 2244908 to 19de763 Compare October 21, 2021 07:53
@dominiklohmann dominiklohmann force-pushed the story/ch29085/prefer-stdin-over-exporting-all branch from 7695435 to a727c20 Compare October 21, 2021 12:06
@dominiklohmann
Copy link
Member Author

I am really stumped at why the CI makes the integration test framework think we have input on stdin, when we really don't. While we could downgrade the error to a warning and simply live with it—everything works as expected locally for both @tobim and me—, I would like to understand what's wrong here first.

@dominiklohmann dominiklohmann force-pushed the story/ch29085/prefer-stdin-over-exporting-all branch from a727c20 to f0bacf8 Compare October 25, 2021 09:39
@lava lava force-pushed the story/ch29085/prefer-stdin-over-exporting-all branch 11 times, most recently from 3221101 to 1736530 Compare October 28, 2021 11:46
@tobim tobim force-pushed the story/ch29085/prefer-stdin-over-exporting-all branch from 1736530 to 51cbd60 Compare October 28, 2021 14:41
Using `!isatty()` is didn't work in case vast run in a scrip in
headleass mode, i.e. during the integration tests in CI. We now
use stat to check if the input is a pipe or a regular file.
@tobim tobim force-pushed the story/ch29085/prefer-stdin-over-exporting-all branch from 6a7cd64 to 8002d83 Compare October 28, 2021 15:47
Copy link
Member

@lava lava left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Things seem to work now (and even if it turns out the new logic is still not quite what we want, this should at least not be a regression), so I think with the CI going through we're good to go.

There are a few more nits below, but I think none of them is important enough to justify delaying the rc any further.

Copy link
Member

@lava lava left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good assuming CI is happy this time; a few minor issues but as discussed I can fixup them myself.

@lava lava force-pushed the story/ch29085/prefer-stdin-over-exporting-all branch from beb7156 to 37b07dc Compare November 1, 2021 11:50
@lava lava force-pushed the story/ch29085/prefer-stdin-over-exporting-all branch from 37b07dc to b7cd11d Compare November 1, 2021 12:02
lava added 3 commits November 1, 2021 16:14
This test provides an explicit query as input, so according to the
updated logic this should not be interpreted as "export everything"
anymore but as a query, and the reference data was reverted to the
original state accordingly.
@lava lava merged commit 61e8402 into master Nov 1, 2021
@lava lava deleted the story/ch29085/prefer-stdin-over-exporting-all branch November 1, 2021 18:48
@mavam
Copy link
Member

mavam commented Nov 1, 2021

Finally, what a pesky issue!

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

Successfully merging this pull request may close these issues.

4 participants