Merge ~dgadomski/curtin:grub-config-not-subsciptable into curtin:master

Proposed by Dariusz Gadomski
Status: Needs review
Proposed branch: ~dgadomski/curtin:grub-config-not-subsciptable
Merge into: curtin:master
Diff against target: 13 lines (+1/-1)
1 file modified
curtin/commands/curthooks.py (+1/-1)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
curtin developers Pending
Review via email: mp+466000@code.launchpad.net

Commit message

curthooks: fix deprecated GrubConfig properties syntax

There was a leftover example of accessing GrubConfig properties that has
been removed by commit 4587fd40dfd7eabd6677004e91340edcfe5a7472.

Description of the change

If the user tries to run an automated installation and will set
storage.grub.install_devices most likely they will end up in hitting curtin/commands/curthooks.py:782:
LOG.warn("Storage Config grub device config takes precedence "
                         "over grub 'install_devices' value, ignoring: %s",
                         grubcfg['install_devices'])

This will lead to:
TypeError: 'GrubConfig' object is not subscriptable
'GrubConfig' object is not subscriptable

The syntax used in this line is a pre-refactoring leftover probably skipped by mistake in commit 4587fd40dfd7eabd6677004e91340edcfe5a7472.

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Dan Bungert (dbungert) wrote :

The code change certainly looks correct but what sort of things should we be testing for to reproduce the issue? A new test would be preferable, or at least I would like information on a concrete example that produces the problem.

Revision history for this message
Dariusz Gadomski (dgadomski) wrote :

Thank you for looking into this Dan. I have added some info of how the user run into this problem. Reproducing it by setting install_devices in subiquity autoinstall seems consistent.

Unmerged commits

700b1f8... by Dariusz Gadomski

curthooks: fix deprecated GrubConfig properties syntax

There was a leftover example of accessing GrubConfig properties that has
been removed by commit 4587fd40dfd7eabd6677004e91340edcfe5a7472.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/curtin/commands/curthooks.py b/curtin/commands/curthooks.py
index 34ff660..264d7d0 100644
--- a/curtin/commands/curthooks.py
+++ b/curtin/commands/curthooks.py
@@ -779,7 +779,7 @@ def setup_grub(
779 grubcfg.install_devices is not grubcfg.install_devices_default:779 grubcfg.install_devices is not grubcfg.install_devices_default:
780 LOG.warn("Storage Config grub device config takes precedence "780 LOG.warn("Storage Config grub device config takes precedence "
781 "over grub 'install_devices' value, ignoring: %s",781 "over grub 'install_devices' value, ignoring: %s",
782 grubcfg['install_devices'])782 grubcfg.install_devices)
783 grubcfg.install_devices = storage_grub_devices783 grubcfg.install_devices = storage_grub_devices
784784
785 LOG.debug("install_devices: %s", grubcfg.install_devices)785 LOG.debug("install_devices: %s", grubcfg.install_devices)

Subscribers

People subscribed via source and target branches