[grubcfg] Avoid crashes in tests
- remove "bogus" key when it's not needed - check for existence of "branding" key in GS before subscripting it (this happens in tests, where no GS contents are loaded, but not in regular use, where startup loads the branding data into GS)
This commit is contained in:
parent
0c79418393
commit
6a9d9700d4
@ -281,6 +281,9 @@ def run():
|
|||||||
partitions = libcalamares.globalstorage.value("partitions")
|
partitions = libcalamares.globalstorage.value("partitions")
|
||||||
root_mount_point = libcalamares.globalstorage.value("rootMountPoint")
|
root_mount_point = libcalamares.globalstorage.value("rootMountPoint")
|
||||||
branding = libcalamares.globalstorage.value("branding")
|
branding = libcalamares.globalstorage.value("branding")
|
||||||
|
if branding is None:
|
||||||
|
distributor = None
|
||||||
|
else:
|
||||||
distributor = branding["bootloaderEntryName"]
|
distributor = branding["bootloaderEntryName"]
|
||||||
|
|
||||||
if libcalamares.globalstorage.value("bootLoader") is None and fw_type != "efi":
|
if libcalamares.globalstorage.value("bootLoader") is None and fw_type != "efi":
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# SPDX-FileCopyrightText: no
|
# SPDX-FileCopyrightText: no
|
||||||
# SPDX-License-Identifier: CC0-1.0
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
---
|
---
|
||||||
bogus: true
|
branding:
|
||||||
|
bootloaderEntryName: generic
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
# SPDX-FileCopyrightText: no
|
# SPDX-FileCopyrightText: no
|
||||||
# SPDX-License-Identifier: CC0-1.0
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
---
|
---
|
||||||
bogus: true
|
|
||||||
firmwareType: bios
|
firmwareType: bios
|
||||||
bootLoader: grub
|
bootLoader: grub
|
||||||
rootMountPoint: /tmp/calamares/grubcfg-test-2
|
rootMountPoint: /tmp/calamares/grubcfg-test-2
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
# SPDX-FileCopyrightText: no
|
# SPDX-FileCopyrightText: no
|
||||||
# SPDX-License-Identifier: CC0-1.0
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
---
|
---
|
||||||
bogus: true
|
|
||||||
firmwareType: bios
|
firmwareType: bios
|
||||||
bootLoader: grub
|
bootLoader: grub
|
||||||
rootMountPoint: /tmp/calamares/grubcfg-test-3
|
rootMountPoint: /tmp/calamares/grubcfg-test-3
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
# SPDX-FileCopyrightText: no
|
# SPDX-FileCopyrightText: no
|
||||||
# SPDX-License-Identifier: CC0-1.0
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
---
|
---
|
||||||
bogus: true
|
|
||||||
firmwareType: bios
|
firmwareType: bios
|
||||||
bootLoader: grub
|
bootLoader: grub
|
||||||
rootMountPoint: /tmp/calamares/grubcfg-test-4
|
rootMountPoint: /tmp/calamares/grubcfg-test-4
|
||||||
|
Loading…
Reference in New Issue
Block a user