Revision 6e34b628 lib/objects.py
b/lib/objects.py | ||
---|---|---|
54 | 54 |
ret_dict.update(custom_dict) |
55 | 55 |
return ret_dict |
56 | 56 |
|
57 |
|
|
58 |
def UpgradeGroupedParams(target, defaults): |
|
59 |
"""Update all groups for the target parameter. |
|
60 |
|
|
61 |
@type target: dict of dicts |
|
62 |
@param target: {group: {parameter: value}} |
|
63 |
@type defaults: dict |
|
64 |
@param defaults: default parameter values |
|
65 |
|
|
66 |
""" |
|
67 |
if target is None: |
|
68 |
target = {constants.PP_DEFAULT: defaults} |
|
69 |
else: |
|
70 |
for group in target: |
|
71 |
target[group] = FillDict(defaults, target[group]) |
|
72 |
return target |
|
73 |
|
|
74 |
|
|
57 | 75 |
class ConfigObject(object): |
58 | 76 |
"""A generic config object. |
59 | 77 |
|
... | ... | |
763 | 781 |
self.hvparams[hypervisor] = FillDict( |
764 | 782 |
constants.HVC_DEFAULTS[hypervisor], self.hvparams[hypervisor]) |
765 | 783 |
|
766 |
if self.beparams is None: |
|
767 |
self.beparams = {constants.PP_DEFAULT: constants.BEC_DEFAULTS} |
|
768 |
else: |
|
769 |
for begroup in self.beparams: |
|
770 |
self.beparams[begroup] = FillDict(constants.BEC_DEFAULTS, |
|
771 |
self.beparams[begroup]) |
|
784 |
self.beparams = UpgradeGroupedParams(self.beparams, |
|
785 |
constants.BEC_DEFAULTS) |
|
772 | 786 |
|
773 | 787 |
if self.modify_etc_hosts is None: |
774 | 788 |
self.modify_etc_hosts = True |
Also available in: Unified diff