From 27c187084bd705a9aaa7cddc7d2d4bc663b4bc0e Mon Sep 17 00:00:00 2001 From: shivanandvp Date: Wed, 6 Jul 2022 20:01:50 -0500 Subject: [PATCH] fix: Check for name key based on comments on PR --- src/modules/services-systemd/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/services-systemd/main.py b/src/modules/services-systemd/main.py index 4eef3f096..ef2984fba 100644 --- a/src/modules/services-systemd/main.py +++ b/src/modules/services-systemd/main.py @@ -29,7 +29,7 @@ def pretty_name(): def systemctl(units): """ For each entry in @p units, run "systemctl ", - where each unit is a map of unit name, action, and a flag. + where each unit is a mapping of unit name, action, and a flag. Returns a failure message, or None if this was successful. Units that are not mandatory have their failures suppressed @@ -42,6 +42,9 @@ def systemctl(units): action = "enable" mandatory = False else: + if not unit.has_key("name"): + libcalamares.utils.error("The key 'name' is missing from the mapping {_unit!s}. Continuing to the next unit.".format(_unit=str(unit))) + continue name = unit["name"] action = unit.get("action", "enable") mandatory = unit.get("mandatory", False)