stratis-storage/stratis-cli

Clevis info in stratis pool list --name [NAME] uses D-Bus types

jbaublitz opened this issue · 6 comments

This is a little bit ugly and I think we'd probably prefer to make it Python types instead of D-Bus types for readability purposes.

@mulkieran I'm assuming you'll want to take care of this one.

@jbaublitz Could you give an example of what you've seen?

Sure!

~/ stratis pool list --name testpool
UUID: 43e74130-43f1-42bf-be0c-08f32aede4c6
Name: testpool
Alerts: 1
     WS001: All devices fully allocated
Actions Allowed: fully_operational
Cache: No
Filesystem Limit: 100
Allows Overprovisioning: Yes
Key Description: testkey
Clevis Configuration: dbus.Struct((dbus.String('tang'), dbus.String('{"thp":"Zjzo7vxW_3WooTE290uH5PU9TiPYAWdVe0NpoGbrHR4","url":"localhost"}')), signature=None)
Space Usage:
Fully Allocated: Yes
    Size: 9.98 GiB
    Allocated: 9.98 GiB
    Used: 527.37 MiB

The problem is that we invoke str() on these D-Bus values, relying on dbus-python to render a usable string value, but in the case of a D-Bus struct it just defaults to __repr__.

We'll have to write a Clevis-specific function for representing that particular D-Bus struct.

Likely we'll have to abstract a bit more, to get some kind of Clevis info class.