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

test: Use stratis key set --keyfile-path #19549

Merged
merged 1 commit into from
Nov 1, 2023

Conversation

martinpitt
Copy link
Member

@martinpitt martinpitt commented Oct 31, 2023

The --capture-key, despite its documentation, is very insistent on
reading the password from the tty. In stratis-cli 3.6.0 it also changed
behaviour to expect the password twice. Move to the --capture-key
option which behaves as intended.

As this is non-trivial, and could change again in the future, factor it
into a helper function.

See https://bugzilla.redhat.com/show_bug.cgi?id=2246923


Triggering an extra run against updates-testing to cover both "old" and "new" case.

@martinpitt
Copy link
Member Author

After this lands, we can close cockpit-project/bots#5468 and drop the naughty.

@martinpitt martinpitt marked this pull request as draft October 31, 2023 07:52
@martinpitt
Copy link
Member Author

Ah, --key-file-path does not what we want/need, see https://bugzilla.redhat.com/show_bug.cgi?id=2246923#c4 . I'll go back to --capture-key and feed it in twice.

@martinpitt martinpitt changed the title test: Use stratis key set --keyfile-path test: Fix stratis key set for stratis-cli 3.6.0 Oct 31, 2023
@martinpitt martinpitt marked this pull request as ready for review October 31, 2023 10:14
@@ -41,6 +41,11 @@ def get_stratis_stop_type_opt(execute):
return ""


def create_pool_key(machine, keyname, passphrase):
# this is a bit complicated, see https://bugzilla.redhat.com/show_bug.cgi?id=2246923
machine.execute(f"echo -n '{passphrase}\n{passphrase}' | stratis key set --capture-key {keyname}")
Copy link
Member

Choose a reason for hiding this comment

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

echo -n {passphrase} | stratis key set --keyfile-path /dev/stdin {keyname} should work. I think you didn't use -n, and your passphrases would have an additional newline.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, I really meant echo -e here, but as I simultaneously forgot to mark it as a raw string, it worked by accident 🙈

I tried with echo -n | --keyfile-path, but that breaks TestStorageStratisNBDE.testBasic for me locally. But giving it a shot here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Nevermind, that failure is cockpit-project/bots#4796 -- why is everything so broken here 😢

So this does work on f38, f39 and f39/updates-testing. I updated the commit again.

@martinpitt martinpitt added the no-test For doc/workflow changes, or experiments which don't need a full CI run, label Oct 31, 2023
@martinpitt martinpitt marked this pull request as draft October 31, 2023 15:14
The `--capture-key`, despite its documentation, is very insistent on
reading the password from the tty. In stratis-cli 3.6.0 it also changed
behaviour to expect the password twice. Move to the `--capture-key`
option which behaves as intended.

As this is non-trivial, and could change again in the future, factor it
into a helper function.

See https://bugzilla.redhat.com/show_bug.cgi?id=2246923
@martinpitt martinpitt removed the no-test For doc/workflow changes, or experiments which don't need a full CI run, label Oct 31, 2023
@martinpitt martinpitt changed the title test: Fix stratis key set for stratis-cli 3.6.0 test: Use stratis key set --keyfile-path Oct 31, 2023
@martinpitt martinpitt marked this pull request as ready for review October 31, 2023 15:46
@@ -41,6 +41,11 @@ def get_stratis_stop_type_opt(execute):
return ""


def create_pool_key(machine, keyname, passphrase):
# this is a bit complicated, see https://bugzilla.redhat.com/show_bug.cgi?id=2246923
Copy link
Member

Choose a reason for hiding this comment

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

I don't actually think it's that complicated, and there is no bug worth fixing here. (Well, maybe the docs.) So I think this comment is misleading. It was a mistake to not use --keyfile-path from the start in our tests, since --capture-key is the mode for interactive use.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm, if --capture-key is for interactive use, it is highly misleading. "Interactive" means "human on a tty" for me, and that is more robust than stdin. Piping in a password is usually "noninteractive"/automated in my book. But yes, we can discuss that in the bugzilla.

@mvollmer mvollmer merged commit 2a8d3ac into cockpit-project:main Nov 1, 2023
94 checks passed
@martinpitt martinpitt deleted the stratis-key branch November 1, 2023 08:18
martinpitt added a commit to martinpitt/bots that referenced this pull request Nov 3, 2023
The change in cockpit-project/cockpit#19549
avoids running into this issue.
mvollmer pushed a commit to cockpit-project/bots that referenced this pull request Nov 3, 2023
The change in cockpit-project/cockpit#19549
avoids running into this 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.

2 participants