From 88e43448f7a807f56539e08b4848042771bf2e1b Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Mon, 18 Jul 2022 09:50:02 -0400 Subject: [PATCH] teuthology/misc: support MappingProxyType in deep_merge Signed-off-by: Patrick Donnelly --- teuthology/misc.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/teuthology/misc.py b/teuthology/misc.py index 85285cc783..9fc344b674 100644 --- a/teuthology/misc.py +++ b/teuthology/misc.py @@ -17,6 +17,7 @@ import json import re import pprint import datetime +from types import MappingProxyType from tarfile import ReadError @@ -1010,12 +1011,14 @@ def deep_merge(a, b): a.extend(b) return a elif isinstance(a, dict): - assert isinstance(b, dict) + assert isinstance(b, dict) or isinstance(b, MappingProxyType) for (k, v) in b.items(): a[k] = deep_merge(a.get(k), v) return a elif isinstance(b, dict) or isinstance(b, list): return deep_merge(b.__class__(), b) + elif isinstance(b, MappingProxyType): + return deep_merge(dict(), b) else: return b -- 2.39.5