From a352bd946ee3b593816ede4abe2a31c187d993d6 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 2 Feb 2022 15:02:58 +0100 Subject: [PATCH] [grubcfg] snake-case one configuration key This makes all the keys in grubcfg consistently snake-case (rather than one being a camel). --- src/modules/grubcfg/grubcfg.conf | 6 ++---- src/modules/grubcfg/grubcfg.schema.yaml | 3 +-- src/modules/grubcfg/main.py | 10 +++++----- src/modules/grubcfg/tests/2.job | 2 +- src/modules/grubcfg/tests/3.job | 2 +- src/modules/grubcfg/tests/4.job | 2 +- 6 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/modules/grubcfg/grubcfg.conf b/src/modules/grubcfg/grubcfg.conf index afc5e89b8..2d58e5dc2 100644 --- a/src/modules/grubcfg/grubcfg.conf +++ b/src/modules/grubcfg/grubcfg.conf @@ -9,7 +9,7 @@ # # Calculated values are: # - GRUB_DISTRIBUTOR, branding module, *bootloaderEntryName* (this -# string is sanitized, and see also setting *keepDistributor*) +# string is sanitized, and see also setting *keep_distributor*) # - GRUB_ENABLE_CRYPTODISK, based on the presence of filesystems # that use LUKS # - GRUB_CMDLINE_LINUX_DEFAULT, adding LUKS setup and plymouth @@ -29,9 +29,7 @@ prefer_grub_d: false # kept, not updated to the *bootloaderEntryName* from the branding file. # Use this if the GRUB_DISTRIBUTOR setting in the file is "smart" in # some way (e.g. uses shell-command substitution). -# -# TODO:3.3:snake-case this key -keepDistributor: false +keep_distributor: false # The default kernel params that should always be applied. # This is an array of strings. If it is unset, the default is diff --git a/src/modules/grubcfg/grubcfg.schema.yaml b/src/modules/grubcfg/grubcfg.schema.yaml index 35d63c063..f10b03a83 100644 --- a/src/modules/grubcfg/grubcfg.schema.yaml +++ b/src/modules/grubcfg/grubcfg.schema.yaml @@ -7,8 +7,7 @@ additionalProperties: false type: object properties: overwrite: { type: boolean, default: false } - # TODO:3.3:snake-case this key - keepDistributor: { type: boolean, default: false } + keep_istributor: { type: boolean, default: false } prefer_grub_d: { type: boolean, default: false } kernel_params: { type: array, items: { type: string } } defaults: diff --git a/src/modules/grubcfg/main.py b/src/modules/grubcfg/main.py index d7e581da6..b992629dd 100644 --- a/src/modules/grubcfg/main.py +++ b/src/modules/grubcfg/main.py @@ -95,10 +95,10 @@ def modify_grub_default(partitions, root_mount_point, distributor): :param root_mount_point: :param distributor: name of the distributor to fill in for GRUB_DISTRIBUTOR. Must be a string. If the job setting - *keepDistributor* is set, then this is only used if no - GRUB_DISTRIBUTOR is found at all (otherwise, when *keepDistributor* + *keep_distributor* is set, then this is only used if no + GRUB_DISTRIBUTOR is found at all (otherwise, when *keep_distributor* is set, the GRUB_DISTRIBUTOR lines are left unchanged). - If *keepDistributor* is unset or false, then GRUB_DISTRIBUTOR + If *keep_distributor* is unset or false, then GRUB_DISTRIBUTOR is always updated to set this value. :return: """ @@ -230,11 +230,11 @@ def modify_grub_default(partitions, root_mount_point, distributor): have_kernel_cmd = True elif (lines[i].startswith("#GRUB_DISTRIBUTOR") or lines[i].startswith("GRUB_DISTRIBUTOR")): - if libcalamares.job.configuration.get("keepDistributor", False): + if libcalamares.job.configuration.get("keep_distributor", False): lines[i] = distributor_line have_distributor_line = True else: - # We're not updating because of *keepDistributor*, but if + # We're not updating because of *keep_distributor*, but if # this was a comment line, then it's still not been set. have_distributor_line = have_distributor_line or not lines[i].startswith("#") # If btrfs or f2fs is used, don't save default diff --git a/src/modules/grubcfg/tests/2.job b/src/modules/grubcfg/tests/2.job index 92e598394..5265ef5c8 100644 --- a/src/modules/grubcfg/tests/2.job +++ b/src/modules/grubcfg/tests/2.job @@ -2,7 +2,7 @@ # SPDX-License-Identifier: CC0-1.0 --- overwrite: true -keepDistributor: false +keep_distributor: false defaults: GRUB_TIMEOUT: 5 GRUB_DEFAULT: "saved" diff --git a/src/modules/grubcfg/tests/3.job b/src/modules/grubcfg/tests/3.job index 7d579839c..94f394373 100644 --- a/src/modules/grubcfg/tests/3.job +++ b/src/modules/grubcfg/tests/3.job @@ -3,7 +3,7 @@ --- overwrite: true prefer_grub_d: true # But it doesn't exist -keepDistributor: false +keep_distributor: false defaults: GRUB_TIMEOUT: 5 GRUB_DEFAULT: "saved" diff --git a/src/modules/grubcfg/tests/4.job b/src/modules/grubcfg/tests/4.job index 58fd8bcb7..4fdc2e25c 100644 --- a/src/modules/grubcfg/tests/4.job +++ b/src/modules/grubcfg/tests/4.job @@ -3,7 +3,7 @@ --- overwrite: true prefer_grub_d: true -keepDistributor: false +keep_distributor: false defaults: GRUB_TIMEOUT: 5 GRUB_DEFAULT: "saved"