utils.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:charm-plumgrid-gateway 作者: openstack 项目源码 文件源码
def is_device_mounted(device):
    '''Given a device path, return True if that device is mounted, and False
    if it isn't.

    :param device: str: Full path of the device to check.
    :returns: boolean: True if the path represents a mounted device, False if
        it doesn't.
    '''
    try:
        out = check_output(['lsblk', '-P', device]).decode('UTF-8')
    except:
        return False
    return bool(re.search(r'MOUNTPOINT=".+"', out))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号