Skip to content

Commit

Permalink
Return parser error on non-numeric value for integrity journal size
Browse files Browse the repository at this point in the history
Signed-off-by: mulhern <[email protected]>
  • Loading branch information
mulkieran committed Dec 16, 2024
1 parent 5ab1681 commit 0a68e34
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/bin/utils/cmds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ pool is encrypted, setting this option has no effect on the prediction."),
Arg::new("integrity_journal_size")
.long("integrity-journal-size")
.num_args(1)
.value_parser(clap::value_parser!(u64))
.help("Size of the integrity journal. Default is 128 MiB. Units are bytes.")
.next_line_help(true)
),
Expand Down Expand Up @@ -141,9 +142,8 @@ impl<'a> UtilCommand<'a> for StratisPredictUsage {
.get_many::<u128>("filesystem-size")
.map(|szs| szs.map(|n| Bytes(*n)).collect::<Vec<_>>()),
sub_m
.get_one::<String>("integrity_journal_size")
.map(|s| s.parse::<u64>().map(Bytes::from))
.transpose()?
.get_one::<u64>("integrity_journal_size")
.map(|n| Bytes::from(*n))
.map(|b| {
if b % 4096u64 != Bytes(0) {
Err(format!("Value {b} is not aligned to 4096"))
Expand Down

0 comments on commit 0a68e34

Please sign in to comment.