Esempio n. 1
0
    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
        device.format.passphrase = passphrase
        try:
            device.setup()
            device.format.setup()

            # Wait for the device.
            # Otherwise, we could get a message about no Linux partitions.
            time.sleep(2)

            try_populate_devicetree(self._storage.devicetree)
        except StorageError as serr:
            log.error("Failed to unlock %s: %s", device.name, serr)
            device.teardown(recursive=True)
            device.format.passphrase = None
            return False
        else:
            device_state.set_unlocked(passphrase)
            return True
Esempio n. 2
0
 def run(self):
     rc = self.window.run()
     self.window.destroy()
     # We need to call this to get the device nodes to show up
     # in our devicetree.
     if self._update_devicetree:
         try_populate_devicetree(self._storage.devicetree)
     return rc
Esempio n. 3
0
 def run(self):
     rc = self.window.run()
     self.window.destroy()
     # We need to call this to get the device nodes to show up
     # in our devicetree.
     if self._update_devicetree:
         try_populate_devicetree(self._storage.devicetree)
     return rc
Esempio n. 4
0
    def run(self):
        rc = self.window.run()
        self.window.destroy()

        if self._update_devicetree:
            try_populate_devicetree(self._storage.devicetree)

        return rc
Esempio n. 5
0
    def run(self):
        rc = self.window.run()
        self.window.destroy()

        if self._update_devicetree:
            try_populate_devicetree(self._storage.devicetree)

        return rc
Esempio n. 6
0
    def _create_snapshots(self, storage, requests, when):
        """Create the snapshots.

        :param storage: an instance of Blivet
        :param requests: a list of the snapshot requests
        :param when: when the snapshots are created
        """
        if when == SNAPSHOT_WHEN_POST_INSTALL:
            try_populate_devicetree(storage.devicetree)

        for request in requests:
            self._create_snapshot(storage, request)

        if when == SNAPSHOT_WHEN_PRE_INSTALL:
            try_populate_devicetree(storage.devicetree)
Esempio n. 7
0
 def on_refresh_clicked(self, widget, *args):
     try_populate_devicetree(self.storage.devicetree)
     self.refresh()