diff options
author | Joshua Harlow <harlowja@yahoo-inc.com> | 2013-04-22 12:43:35 -0700 |
---|---|---|
committer | Joshua Harlow <harlowja@yahoo-inc.com> | 2013-04-22 12:43:35 -0700 |
commit | 8441fe20fdd1d8bb195bc7d354c9e87d2f446ccd (patch) | |
tree | 10a9758005b0eb1dc2b7e89665d1acaf19621fe2 /cloudinit/mergers/__init__.py | |
parent | 50f91a1bca166b5e815a722aca573672b269bacb (diff) | |
download | vyos-cloud-init-8441fe20fdd1d8bb195bc7d354c9e87d2f446ccd.tar.gz vyos-cloud-init-8441fe20fdd1d8bb195bc7d354c9e87d2f446ccd.zip |
Continue working on merging.
Diffstat (limited to 'cloudinit/mergers/__init__.py')
-rw-r--r-- | cloudinit/mergers/__init__.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/cloudinit/mergers/__init__.py b/cloudinit/mergers/__init__.py index 2702496b..221e93b5 100644 --- a/cloudinit/mergers/__init__.py +++ b/cloudinit/mergers/__init__.py @@ -55,6 +55,9 @@ class UnknownMerger(object): if not meth: meth = self._handle_unknown args.insert(0, method_name) + LOG.debug("Merging '%s' into '%s' using method '%s' of '%s'", + type_name, type_utils.obj_name(merge_with), + meth.__name__, self) return meth(*args) @@ -66,6 +69,9 @@ class LookupMerger(UnknownMerger): else: self._lookups = lookups + def __str__(self): + return 'LookupMerger: (%s)' % (len(self._lookups)) + # For items which can not be merged by the parent this object # will lookup in a internally maintained set of objects and # find which one of those objects can perform the merge. If @@ -78,6 +84,8 @@ class LookupMerger(UnknownMerger): # First one that has that method/attr gets to be # the one that will be called meth = getattr(merger, meth_wanted) + LOG.debug(("Merging using located merger '%s'" + " since it had method '%s'"), merger, meth_wanted) break if not meth: return UnknownMerger._handle_unknown(self, meth_wanted, @@ -87,9 +95,9 @@ class LookupMerger(UnknownMerger): def dict_extract_mergers(config): parsed_mergers = [] - raw_mergers = config.get('merge_how') + raw_mergers = config.pop('merge_how', None) if raw_mergers is None: - raw_mergers = config.get('merge_type') + raw_mergers = config.pop('merge_type', None) if raw_mergers is None: return parsed_mergers if isinstance(raw_mergers, (str, basestring)): |