stages: tweak process_platforms_json to be slightly shorter
With the test the helper can now be slightly simplified. Because we only have two results it seems easier to just use them directly than to store them in an intermediate result struct.
This commit is contained in:
parent
6cc7309890
commit
e9c31c035b
1 changed files with 6 additions and 11 deletions
|
|
@ -70,17 +70,12 @@ def generate_console_settings_file(console_settings, file_path):
|
||||||
|
|
||||||
|
|
||||||
def process_platforms_json(json_file_path, platform):
|
def process_platforms_json(json_file_path, platform):
|
||||||
keys = ["grub_commands", "kernel_arguments"]
|
with open(json_file_path, 'r', encoding="utf8") as fp:
|
||||||
result = {}
|
data = json.load(fp)
|
||||||
with open(json_file_path, 'r', encoding="utf8") as file:
|
platform = data.get(platform, {})
|
||||||
data = json.load(file)
|
grub_cmds = platform.get("grub_commands", [])
|
||||||
if platform in data:
|
kernel_args = platform.get("kernel_arguments", [])
|
||||||
for key in keys:
|
return grub_cmds, kernel_args
|
||||||
if key in data[platform]:
|
|
||||||
result[key] = data[platform][key]
|
|
||||||
|
|
||||||
return result.get("grub_commands", []),\
|
|
||||||
result.get("kernel_arguments", [])
|
|
||||||
|
|
||||||
|
|
||||||
def main(paths, options):
|
def main(paths, options):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue