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

Make specifying an invalid unlock method a parser error #3719

Merged

Conversation

mulkieran
Copy link
Member

Related #3641

@mulkieran mulkieran self-assigned this Nov 18, 2024
@mulkieran
Copy link
Member Author

Now:

Usage: stratis-min pool start [OPTIONS] <id>

Arguments:
  <id>  

Options:
      --name                           
      --unlock-method <unlock_method>  [possible values: clevis, keyring, any]
      --prompt                         
  -h, --help                           Print help

@mulkieran mulkieran force-pushed the bad-unlock-method-parser-error branch from be8c362 to 266c8a1 Compare November 18, 2024 18:09
@mulkieran mulkieran marked this pull request as ready for review November 18, 2024 18:10
Copy link

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo yum install -y dnf-plugins-core on RHEL 8
  • sudo dnf install -y dnf-plugins-core on Fedora
  • dnf copr enable packit/stratis-storage-stratisd-3719
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

1 similar comment
Copy link

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo yum install -y dnf-plugins-core on RHEL 8
  • sudo dnf install -y dnf-plugins-core on Fedora
  • dnf copr enable packit/stratis-storage-stratisd-3719
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

@mulkieran
Copy link
Member Author

cockpit test failure has got to be infrastructure

@mulkieran mulkieran force-pushed the bad-unlock-method-parser-error branch from 266c8a1 to fa3cf4b Compare November 19, 2024 14:26
Because it would require implementing the ValueEnum trait for
UnlockMethod somewhere in stratisd rather than in stratis_min.rs, do
not attempt that approach at this time.

The gain is that the parser becomes responsible for useful things:
1. Listing the allowed options.
2. Exiting with error code 2 if the unlock_method option is used with an
   invalid unlock method value, rather than deferring the error until it
   is a runtime error.

Uses the trick explained here:
clap-rs/clap#4264

Signed-off-by: mulhern <[email protected]>
@mulkieran mulkieran removed the request for review from bmr-cymru November 19, 2024 16:41
@mulkieran mulkieran merged commit 6486432 into stratis-storage:master Nov 19, 2024
51 checks passed
@mulkieran mulkieran deleted the bad-unlock-method-parser-error branch November 19, 2024 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done(3)
Development

Successfully merging this pull request may close these issues.

2 participants