From 670b46d151477d32056f3fa4eb968c7960f3b472 Mon Sep 17 00:00:00 2001
From: Joshua Harlow <harlowja@yahoo-inc.com>
Date: Thu, 9 May 2013 23:04:03 -0700
Subject: Allow lists to have no_replace option.

---
 cloudinit/mergers/m_list.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/cloudinit/mergers/m_list.py b/cloudinit/mergers/m_list.py
index 1184ded7..76591bea 100644
--- a/cloudinit/mergers/m_list.py
+++ b/cloudinit/mergers/m_list.py
@@ -17,7 +17,7 @@
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 DEF_MERGE_TYPE = 'replace'
-MERGE_TYPES = ('append', 'prepend', DEF_MERGE_TYPE,)
+MERGE_TYPES = ('append', 'prepend', DEF_MERGE_TYPE, 'no_replace')
 
 def _has_any(what, *keys):
     for k in keys:
@@ -67,14 +67,16 @@ class Merger(object):
             return merged_list
 
         def merge_same_index(old_v, new_v):
+            if self._method == 'no_replace':
+                # Leave it be...
+                return old_v
             if isinstance(new_v, (list, tuple)) and self._recurse_array:
                 return self._merger.merge(old_v, new_v)
             if isinstance(new_v, (str, basestring)) and self._recurse_str:
                 return self._merger.merge(old_v, new_v)
             if isinstance(new_v, (dict)) and self._recurse_dict:
                 return self._merger.merge(old_v, new_v)
-            # Otherwise leave it be...
-            return old_v
+            return new_v
 
         # Ok now we are replacing same indexes
         merged_list.extend(value)
-- 
cgit v1.2.3