Skip to content

Commit

Permalink
Display Le if legacy metadata version
Browse files Browse the repository at this point in the history
Signed-off-by: mulhern <[email protected]>
  • Loading branch information
mulkieran committed Sep 15, 2023
1 parent 4a08a4c commit 1f813ea
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
6 changes: 3 additions & 3 deletions docs/stratis.txt
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ Properties::
property, a '~', for negation, is prepended to the property code.
If the engine experienced an error when obtaining the property, a
"?", representing "unknown", is prepended to the property code.
The property codes are: Ca - indicates the pool has a cache,
Cr - indicates the pool is encrypted, Op - indicates the pool allows
overprovisioning.
The property codes are: Le - indicates that the pool is a legacy pool,
Ca - indicates the pool has a cache, Cr - indicates the pool is
encrypted, Op - indicates the pool allows overprovisioning.
UUID::
The UUID of the pool.
Alerts::
Expand Down
19 changes: 6 additions & 13 deletions src/stratis_cli/_actions/_list_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,25 +332,18 @@ def gen_string(has_property, code):
"""
Generate the display string for a boolean property
:param has_property: whether the property is true or false
:type has_property: bool or object
:param bool has_property: whether the property is true or false
:param str code: the code to generate the string for
:returns: the generated string
:rtype: str
"""
# must check membership in dbus.Boolean, because dbus.Boolean is
# not a subclass of bool, but of int.
prefix = (
"?"
if not isinstance(has_property, Boolean)
else (" " if has_property else "~")
)
return prefix + code
return (" " if has_property else "~") + code

props_list = [
(mopool.HasCache(), "Ca"),
(mopool.Encrypted(), "Cr"),
(mopool.Overprovisioning(), "Op"),
(int(mopool.MetadataVersion()) == 1, "Le"),
(bool(mopool.HasCache()), "Ca"),
(bool(mopool.Encrypted()), "Cr"),
(bool(mopool.Overprovisioning()), "Op"),
]
return ",".join(gen_string(x, y) for x, y in props_list)

Expand Down

0 comments on commit 1f813ea

Please sign in to comment.