-def get_err_config(subset, superset):
- for k, v in subset.items():
- if k not in superset:
- return {k: v}
- if v is not None and superset[k] is not None:
- if not isinstance(v, type(superset[k])):
- return {k: v}
- if isinstance(v, dict):
- res = get_err_config(v, superset[k])
- if res:
- return {k: res}
- return None
+def _validate_config(subset, superset, whitelist_keys):
+ def get_err_config(subset, superset):
+ result = {}
+ for k, v in list(subset.items()):
+ if k not in whitelist_keys:
+ if k not in superset:
+ result.update({k: v})
+ elif v is not None and superset[k] is not None:
+ if not isinstance(v, type(superset[k])):
+ result.update({k: v})
+ continue
+ if isinstance(v, dict):
+ res = get_err_config(v, superset[k])
+ if res:
+ result.update({k: res})
+ if not result:
+ return None
+ return result