Revision 784cd737 lib/cmdlib.py
b/lib/cmdlib.py | ||
---|---|---|
721 | 721 |
return params_copy |
722 | 722 |
|
723 | 723 |
|
724 |
def _UpdateAndVerifySubDict(base, updates, type_check): |
|
725 |
"""Updates and verifies a dict with sub dicts of the same type. |
|
726 |
|
|
727 |
@param base: The dict with the old data |
|
728 |
@param updates: The dict with the new data |
|
729 |
@param type_check: Dict suitable to ForceDictType to verify correct types |
|
730 |
@returns: A new dict with updated and verified values |
|
731 |
|
|
732 |
""" |
|
733 |
def fn(old, value): |
|
734 |
new = _GetUpdatedParams(old, value) |
|
735 |
utils.ForceDictType(new, type_check) |
|
736 |
return new |
|
737 |
|
|
738 |
ret = copy.deepcopy(base) |
|
739 |
ret.update(dict((key, fn(base.get(key, {}), value)) |
|
740 |
for key, value in updates.items())) |
|
741 |
return ret |
|
742 |
|
|
743 |
|
|
724 | 744 |
def _ReleaseLocks(lu, level, names=None, keep=None): |
725 | 745 |
"""Releases locks owned by an LU. |
726 | 746 |
|
Also available in: Unified diff