def active():
    '''
    List existing device-mapper device details.
    '''
    ret = {}
    # TODO: This command should be extended to collect more information, such as UUID.
    devices = __salt__['cmd.run_stdout']('dmsetup ls --target crypt')
    out_regex = re.compile(r'(?P<devname>\w+)\W+\((?P<major>\d+), (?P<minor>\d+)\)')

    log.debug(devices)
    for line in devices.split('\n'):
        match = out_regex.match(line)
        if match:
            dev_info = match.groupdict()
            ret[dev_info['devname']] = dev_info
        else:
            log.warning('dmsetup output does not match expected format')

    return ret
def active ( ) : ret = { } devices = __salt__ [ 'cmd.run_stdout' ] ( 'dmsetup ls --target crypt' ) out_regex = re . compile ( r'(?P<devname>\w+)\W+\((?P<major>\d+), (?P<minor>\d+)\)' ) log . debug ( devices ) for line in devices . split ( '\n' ) : match = out_regex . match ( line ) if match : dev_info = match . groupdict ( ) ret [ dev_info [ 'devname' ] ] = dev_info else : log . warning ( 'dmsetup output does not match expected format' ) return ret
List existing device-mapper device details.