Skip to content

Commit

Permalink
Specify default values, show them in help text
Browse files Browse the repository at this point in the history
Signed-off-by: mulhern <[email protected]>
  • Loading branch information
mulkieran committed Dec 18, 2024
1 parent 542ebe6 commit 5703023
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
12 changes: 2 additions & 10 deletions src/stratis_cli/_actions/_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,8 @@ def create_pool(namespace): # pylint: disable=too-many-locals
if clevis_info is None
else (True, (clevis_info.pin, json.dumps(clevis_info.config)))
),
"journal_size": (
(False, 0)
if namespace.journal_size is None
else (True, namespace.journal_size.magnitude.numerator)
),
"tag_spec": (
(False, 0)
if namespace.tag_spec is None
else (True, namespace.tag_spec)
),
"journal_size": (True, namespace.journal_size.magnitude.numerator),
"tag_spec": (True, namespace.tag_spec),
},
)

Expand Down
19 changes: 14 additions & 5 deletions src/stratis_cli/_parser/_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
from argparse import SUPPRESS, ArgumentTypeError
from uuid import UUID

# isort: THIRDPARTY
from justbytes import MiB, Range

from .._actions import BindActions, PoolActions
from .._constants import (
Clevis,
Expand Down Expand Up @@ -185,9 +188,12 @@ def _ensure_nat(arg):
"Size of integrity device's journal. "
"Each block is written to this journal "
"before being written to its address. "
"The size of the journal must be a "
"multiple of 4 KiB."
"The default is %(default)s. Specify "
"0B if you have determined that you "
"will never make use of integrity "
"features."
),
"default": Range(128, MiB),
"type": parse_range,
},
),
Expand All @@ -198,10 +204,13 @@ def _ensure_nat(arg):
"Integrity tag specification defining "
"the size of the tag used to store a "
"checksum or other value for each "
"block on a device. stratisd chooses "
"a default specification if none is "
"given."
"block on a device. All size "
"specifications are in bits. The "
"default is %(default)s. Specify 0b "
"if you have determined that you will "
"never make use of integrity features."
),
"default": IntegrityTagSpec.B512,
"choices": list(IntegrityTagSpec),
"type": IntegrityTagSpec,
},
Expand Down

0 comments on commit 5703023

Please sign in to comment.