summaryrefslogtreecommitdiff
path: root/meta-phosphor/recipes-phosphor/settings
diff options
context:
space:
mode:
authorAllen.Wang <Allen_Wang@quantatw.com>2022-03-07 12:05:21 +0300
committerPatrick Williams <patrick@stwcx.xyz>2022-03-08 00:48:57 +0300
commit4818d0e67f65eeb3ac0d0947556c6a8dc41cdc79 (patch)
tree19d2e30fb8814af83b817dfcf4e3c7fa6f281e7f /meta-phosphor/recipes-phosphor/settings
parent882b78b52ceabb3a0b63de4006738d92c8c55360 (diff)
downloadopenbmc-4818d0e67f65eeb3ac0d0947556c6a8dc41cdc79.tar.xz
phosphor-settings-manager: Avoid build fail at non-clean build
To perform removing interfaces feature from: https://gerrit.openbmc-project.xyz/c/openbmc/openbmc/+/51394 phosphor-settings-manager build fail while rebuild without clean. For example, add xxx.remove.yml contains a key: /xyz/openbmc_project/control/host0/auto_reboot Build will success at first build ,but rebuild will fail. Error Message: Traceback (most recent call last): ...... File "....../merge_settings.py", line 39, in dict_merge target.pop(k) KeyError: '/xyz/openbmc_project/control/host0/auto_reboot' the key seems already be removed at first build so keyError occurs, add key existence check before calling pop() to avoid this problem. Signed-off-by: Allen.Wang <Allen_Wang@quantatw.com> Change-Id: Id98c8b9d755ba6083b1df88159ad47a41286c4a1
Diffstat (limited to 'meta-phosphor/recipes-phosphor/settings')
-rwxr-xr-xmeta-phosphor/recipes-phosphor/settings/phosphor-settings-manager/merge_settings.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/meta-phosphor/recipes-phosphor/settings/phosphor-settings-manager/merge_settings.py b/meta-phosphor/recipes-phosphor/settings/phosphor-settings-manager/merge_settings.py
index 68c2437505..62a8f4a94e 100755
--- a/meta-phosphor/recipes-phosphor/settings/phosphor-settings-manager/merge_settings.py
+++ b/meta-phosphor/recipes-phosphor/settings/phosphor-settings-manager/merge_settings.py
@@ -35,7 +35,7 @@ def dict_merge(target, source, remove):
if k in target and isinstance(target[k], dict):
dict_merge(target[k], v, remove)
else:
- if remove is True:
+ if remove is True and k in target:
target.pop(k)
else:
target[k] = copy.deepcopy(v)