Revert "Read Pillar files into OrderedDict to preserve source order"

This commit is contained in:
Thomas S Hatch 2014-11-18 09:11:27 -07:00
parent f31cd73808
commit e07cd2134b
3 changed files with 4 additions and 11 deletions

View File

@ -13,7 +13,6 @@ import logging
import salt.log
import salt.crypt
from salt.exceptions import SaltReqTimeoutError
from salt.utils.odict import OrderedDict
import six
# Import third party libs
@ -93,11 +92,7 @@ class Serial(object):
Run the correct loads serialization format
'''
try:
# msgpack >= 0.2.0 supports object_pairs_hook parameter to return an OrderedDict
if msgpack.version >= (0, 2, 0):
return msgpack.loads(msg, use_list=True, object_pairs_hook=OrderedDict)
else:
return msgpack.loads(msg, use_list=True)
return msgpack.loads(msg, use_list=True)
except Exception as exc:
log.critical('Could not deserialize msgpack message: {0}'
'This often happens when trying to read a file not in binary mode.'

View File

@ -441,7 +441,7 @@ class Pillar(object):
Extract the sls pillar files from the matches and render them into the
pillar
'''
pillar = OrderedDict()
pillar = {}
errors = []
for saltenv, pstates in matches.items():
mods = set()
@ -578,7 +578,7 @@ class Pillar(object):
top, terrors = self.get_top()
if ext:
if self.opts.get('ext_pillar_first', False):
self.opts['pillar'] = self.ext_pillar(OrderedDict(), pillar_dirs)
self.opts['pillar'] = self.ext_pillar({}, pillar_dirs)
matches = self.top_matches(top)
pillar, errors = self.render_pillar(matches)
pillar = self.merge_sources(pillar, self.opts['pillar'])

View File

@ -9,14 +9,12 @@ from __future__ import absolute_import
import collections
import six
# Import salt libs
from salt.utils.odict import OrderedDict
def update(dest, upd):
for key, val in six.iteritems(upd):
if isinstance(val, collections.Mapping):
ret = update(dest.get(key, OrderedDict()), val)
ret = update(dest.get(key, {}), val)
dest[key] = ret
else:
dest[key] = upd[key]