Skip to content

Commit

Permalink
storage: try to unlock all devices that cockpit gives us passwords for
Browse files Browse the repository at this point in the history
  • Loading branch information
KKoukiou committed Feb 14, 2024
1 parent 74d64f3 commit 5309469
Showing 1 changed file with 7 additions and 20 deletions.
27 changes: 7 additions & 20 deletions src/components/storage/CockpitStorageIntegration.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -257,27 +257,18 @@ const CheckStorageDialog = ({
return;
}

const cockpitDevices = (
Object.keys(newMountPoints)
.map(devicePath => ({
devicePath,
deviceName: getDeviceNameByPath(deviceData, devicePath),
}))
);

const devicesToUnlock = (
cockpitDevices
Object.keys(cockpitPassphrases)
.map(dev => ({
deviceName: deviceData[dev] ? dev : getDeviceNameByPath(deviceData, dev),
passphrase: cockpitPassphrases[dev]
})))
.filter(({ devicePath, deviceName }) => {
return (
newMountPoints[devicePath].type === "crypto" &&
deviceData[deviceName].formatData.type.v === "luks" &&
deviceData[deviceName].formatData.attrs.v.has_key !== "True"
);
})
.map(({ devicePath, deviceName }) => ({
deviceName,
passphrase: cockpitPassphrases[devicePath],
}))
);

if (devicesToUnlock.some(dev => !dev.passphrase)) {
onCritFail()({ message: _("Cockpit storage did not provide the passphrase to unlock encrypted device.") });
Expand Down Expand Up @@ -341,11 +332,7 @@ const CheckStorageDialog = ({
task,
onSuccess: () => dispatch(getDevicesAction())
.then(() => {
if (useConfiguredStorage) {
setCheckStep("luks");
} else {
setCheckStep();
}
setCheckStep("luks");
})
.catch(exc => {
setCheckStep();
Expand Down

0 comments on commit 5309469

Please sign in to comment.