formats/v2: fix describe for mount without source

Commit 5b1cd2b made `source` and `target` for mounts optional, but
the corresponding code in `describe` still assumes that the device
will always be present. Fix this so that source will only be used
if it is set.
This commit is contained in:
Christian Kellner 2021-11-07 23:00:37 +00:00 committed by Tom Gundersen
parent 52cb27631b
commit e63fa48504

View file

@ -77,10 +77,12 @@ def describe(manifest: Manifest, *, with_id=False) -> Dict:
desc = {
"name": mnt.name,
"type": mnt.info.name,
"source": mnt.device.name,
"target": mnt.target
}
if mnt.device:
desc["source"] = mnt.device.name
if mnt.options:
desc["options"] = mnt.options
return desc