def unlock_device(self, device_name, passphrase): """Unlock a device. :param device_name: a name of the device :param passphrase: a passphrase :return: True if success, otherwise False """ device = self._get_device(device_name) return unlock_device(self.storage, device, passphrase)
def unlock_device(self, device_name, passphrase): """Unlocks LUKS device.""" device_state = self._find_device_state(device_name) if device_state is None: # TODO: raise an exception? log.error("Can't find device to unlock %s", device_name) return False device = device_state.device unlocked = unlock_device(self._storage, device, passphrase) if unlocked: device_state.set_unlocked(passphrase) return unlocked