def lsblk(device, columns=None, abspath=False):
- result = lsblk_all(device=device,
- columns=columns,
- abspath=abspath)
+ result = []
+ if not os.path.isdir(device):
+ result = lsblk_all(device=device,
+ columns=columns,
+ abspath=abspath)
if not result:
raise RuntimeError(f"{device} not found is lsblk report")
This function assumes that ``device`` will be a partition.
"""
+ disk_meta = {}
if os.path.isdir(device):
mounts = system.Mounts(paths=True).get_mounts()
# yes, rebind the device variable here because a directory isn't going
# parent device name for the device so that we can query all of its
# associated devices and *then* look for one that has the 'lockbox' label
# on it. Thanks for being awesome ceph-disk
- disk_meta = lsblk(device, abspath=True)
+ if not device == 'tmpfs':
+ disk_meta = lsblk(device, abspath=True)
if not disk_meta:
return metadata
parent_device = disk_meta['PKNAME']