summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@gmail.com>2012-11-22 19:51:33 -0800
committerJoshua Harlow <harlowja@gmail.com>2012-11-22 19:51:33 -0800
commit9d91b156e4e81d07eb2f01946cea17c7565b7fc4 (patch)
tree50f6b417de054c84c299e4fcf68c160740857e84
parent3941466b3e065c9ce7bb7500e41f464993861672 (diff)
downloadvyos-cloud-init-9d91b156e4e81d07eb2f01946cea17c7565b7fc4.tar.gz
vyos-cloud-init-9d91b156e4e81d07eb2f01946cea17c7565b7fc4.zip
More cleanups.
-rw-r--r--cloudinit/mergers/dict.py3
-rw-r--r--cloudinit/mergers/list.py11
2 files changed, 4 insertions, 10 deletions
diff --git a/cloudinit/mergers/dict.py b/cloudinit/mergers/dict.py
index e7073bd9..bc392afa 100644
--- a/cloudinit/mergers/dict.py
+++ b/cloudinit/mergers/dict.py
@@ -21,9 +21,6 @@ class Merger(object):
def __init__(self, merger, opts):
self._merger = merger
self._overwrite = 'overwrite' in opts
-
- if opts and opts.lower().find("overwrite") != -1:
- self._overwrite = True
def _on_dict(self, value, merge_with):
if not isinstance(merge_with, (dict)):
diff --git a/cloudinit/mergers/list.py b/cloudinit/mergers/list.py
index 0c65d053..a848b8d6 100644
--- a/cloudinit/mergers/list.py
+++ b/cloudinit/mergers/list.py
@@ -21,15 +21,15 @@ class Merger(object):
def __init__(self, merger, opts):
self._merger = merger
self._discard_non = 'discard_non_list' in opts
- self._append = 'append' in opts
+ self._extend = 'extend' in opts
def _on_tuple(self, value, merge_with):
return self._on_list(list(value), merge_with)
def _on_list(self, value, merge_with):
+ new_value = list(value)
if isinstance(merge_with, (tuple, list)):
- new_value = list(value)
- if self._append:
+ if self._extend:
new_value.extend(merge_with)
else:
# Merge instead
@@ -42,9 +42,6 @@ class Merger(object):
if m_am == 0:
new_value.append(m_v)
else:
- new_value = list(value)
- if self._discard_non:
- pass
- else:
+ if not self._discard_non:
new_value.append(merge_with)
return new_value